feat(theme): локальный выбор и показанная тема handoff (#13)
This commit is contained in:
1 parent
3740839321
commit
9c06977e03
11 files changed
+163
-49
No files matched your search
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/** preland#13: local manual не переписывает рекламную UTM; строгий standalone canonical format. */
|
||||
require dirname(__DIR__) . '/components/theme-preference.php';
|
||||
$revision = str_repeat('a', 16);
|
||||
$checks = 0;
|
||||
foreach (['light','dark'] as $theme) foreach (['manual','preland'] as $source) {
|
||||
$_COOKIE['theme_choice'] = "v1:$theme:$source:$revision";
|
||||
if (prelandThemePreference() !== ['theme'=>$theme,'source'=>$source,'revision'=>$revision]
|
||||
|| prelandThemeResolve($theme === 'light' ? 'dark' : 'light') !== $theme) throw new RuntimeException('Canonical preference не побеждает fallback');
|
||||
$checks++;
|
||||
}
|
||||
foreach ([null, [], false, 1, '', "v1:light:manual:$revision\n", 'v1:dark:other:'.$revision, 'v1:dark:manual:'.str_repeat('a',15), 'v1:dark:manual:'.str_repeat('a',65), str_repeat('a',129)] as $value) {
|
||||
$_COOKIE['theme_choice'] = $value;
|
||||
if (prelandThemePreference() !== null || prelandThemeResolve('light') !== 'light') throw new RuntimeException('Невалидная preference принята');
|
||||
$checks++;
|
||||
}
|
||||
$source = file_get_contents(dirname(__DIR__) . '/components/form.php');
|
||||
if (!str_contains($source, 'const shownTheme = window.ZoomzillaTheme.current();')
|
||||
|| !str_contains($source, "targetUrl += '&shown_theme=' + encodeURIComponent(shownTheme)")) throw new RuntimeException('Handoff должен читать показанную тему в момент навигации');
|
||||
echo "OK: $checks standalone theme cases + dynamic shown_theme handoff\n";
|
||||
Reference in new issue
Block a user