diff --git a/.github/workflows/build-appsite-release-bundle.yml b/.github/workflows/build-appsite-release-bundle.yml index 5b35abc1..30935fb8 100644 --- a/.github/workflows/build-appsite-release-bundle.yml +++ b/.github/workflows/build-appsite-release-bundle.yml @@ -86,7 +86,7 @@ jobs: assert len(archives) == 1, 'one ZIP per verified source checkout' with ZipFile(archives[0]) as z: names = z.namelist() - assert len(names) == 49, f'47 site documents + hash manifest + instructions; got {len(names)}' + assert len(names) == 50, f'48 reviewed site files + hash manifest + instructions; got {len(names)}' assert z.testzip() is None assert all(n.startswith('site/') or n in ('SHA256SUMS.txt', 'DEPLOY_README.txt') for n in names) PY diff --git a/scripts/app-share.js b/scripts/app-share.js new file mode 100644 index 00000000..ecbb4d6f --- /dev/null +++ b/scripts/app-share.js @@ -0,0 +1,132 @@ +/* Small opt-in support-page sharing surface. No accounts, cookies, third-party SDK + * or automatic social posting. A share_tap is only an intent, not a verified + * referral session or an app install. */ +(function () { + "use strict"; + var TITLES = { + "debate-me": "Debate Me", + "future-me": "FutureMe", + "tappitsu-battle": "Tappitsu Battle" + }; + var TEXT = { + en: ["Share this app", "Link copied", "Copy this link:"], + ja: ["このアプリを共有", "リンクをコピーしました", "リンクをコピーしてください:"], + zh: ["分享此应用", "链接已复制", "请复制此链接:"], + zh_TW: ["分享此應用程式", "連結已複製", "請複製此連結:"], + ko: ["앱 공유하기", "링크 복사됨", "링크를 복사하세요:"], + es: ["Compartir aplicación", "Enlace copiado", "Copia este enlace:"], + pt: ["Compartilhar aplicativo", "Link copiado", "Copie este link:"], + fr: ["Partager l'application", "Lien copié", "Copiez ce lien :"], + de: ["App teilen", "Link kopiert", "Link kopieren:"], + it: ["Condividi app", "Link copiato", "Copia il link:"], + ru: ["Поделиться приложением", "Ссылка скопирована", "Скопируйте ссылку:"], + ar: ["مشاركة التطبيق", "تم نسخ الرابط", "انسخ هذا الرابط:"], + th: ["แชร์แอป", "คัดลอกลิงก์แล้ว", "คัดลอกลิงก์นี้:"], + id: ["Bagikan aplikasi", "Tautan disalin", "Salin tautan ini:"], + tr: ["Uygulamayı paylaş", "Bağlantı kopyalandı", "Bu bağlantıyı kopyalayın:"], + nl: ["App delen", "Link gekopieerd", "Kopieer deze link:"], + vi: ["Chia sẻ ứng dụng", "Đã sao chép liên kết", "Sao chép liên kết:"] + }; + + function buildShareUrl(slug) { + if (!Object.prototype.hasOwnProperty.call(TITLES, slug)) return null; + // Never copy query strings, fragments or credentials from the browser URL. + var url = new URL("/support/" + slug + "/", "https://appdevelopsk.com"); + url.searchParams.set("utm_source", "reader_share"); + url.searchParams.set("utm_medium", "referral"); + url.searchParams.set("utm_campaign", "app_support_share"); + url.searchParams.set("utm_content", slug); + return url.toString(); + } + + // Allow Node regression tests to validate the *same* URL builder offline. + if (typeof module === "object" && module.exports) { + module.exports = { buildShareUrl: buildShareUrl, TEXT: TEXT }; + return; + } + if (typeof document === "undefined") return; + + var script = document.querySelector("script[data-app-share-slug]"); + var slug = script && script.getAttribute("data-app-share-slug"); + if (!slug || !Object.prototype.hasOwnProperty.call(TITLES, slug)) return; + if (window.location.pathname.replace(/\/$/, "") !== "/support/" + slug) return; + var group = document.querySelector(".hero .download-btns"); + if (!group) return; + var button = document.createElement("button"); + button.type = "button"; + button.className = "dl-btn dl-btn-apple"; + button.style.cursor = "pointer"; + button.setAttribute("data-app-share", slug); + var status = document.createElement("p"); + status.setAttribute("role", "status"); + status.setAttribute("aria-live", "polite"); + status.style.cssText = "margin:8px auto 0;font-size:0.82rem;max-width:600px;"; + var manual = null; + + function lang() { + try { + var saved = window.localStorage.getItem("sk_lang"); + if (Object.prototype.hasOwnProperty.call(TEXT, saved)) return saved; + } catch (_) { /* Browsers may block storage. */ } + var raw = document.documentElement.lang || (navigator.language || "en"); + if (Object.prototype.hasOwnProperty.call(TEXT, raw)) return raw; + return raw.split(/[-_]/)[0] in TEXT ? raw.split(/[-_]/)[0] : "en"; + } + function labels() { return TEXT[lang()] || TEXT.en; } + function updateLanguage() { + button.textContent = labels()[0]; + button.setAttribute("aria-label", labels()[0] + " — " + TITLES[slug]); + } + + function measure(name, method) { + if (window.location.hostname !== "appdevelopsk.com" && + window.location.hostname !== "www.appdevelopsk.com") return; + if (typeof window.gtag !== "function") return; + window.gtag("event", name, { + app_slug: slug, placement: "support_hero", share_method: method + }); + } + + button.addEventListener("click", async function () { + var link = buildShareUrl(slug); + if (!link) return; + status.textContent = ""; + if (manual) { manual.remove(); manual = null; } + measure("share_tap", "button"); // A tap is not a confirmed share. + if (typeof navigator.share === "function") { + try { + await navigator.share({ title: TITLES[slug], url: link }); + return; + } catch (error) { + if (error && error.name === "AbortError") return; + } + } + try { + if (!navigator.clipboard || !navigator.clipboard.writeText) throw new Error("clipboard unavailable"); + await navigator.clipboard.writeText(link); + status.textContent = labels()[1]; + measure("share_copy_success", "clipboard"); + } catch (_) { + // Restricted browsers: let the reader copy a visible, selectable link. + manual = document.createElement("input"); + manual.type = "text"; + manual.readOnly = true; + manual.value = link; + manual.setAttribute("aria-label", labels()[2]); + manual.style.cssText = "display:block;width:min(95%,570px);margin:8px auto 0;padding:8px;border-radius:6px;"; + status.textContent = labels()[2]; + status.appendChild(manual); + manual.addEventListener("focus", function () { manual.select(); }); + } + }); + + group.appendChild(button); + group.parentNode.appendChild(status); + updateLanguage(); + var langNode = document.getElementById("langLabel"); + if (langNode && typeof MutationObserver === "function") { + new MutationObserver(updateLanguage).observe(langNode, { + childList: true, characterData: true, subtree: true + }); + } +})(); diff --git a/scripts/build_site_release_bundle.py b/scripts/build_site_release_bundle.py index 21d676df..4cbb4d28 100644 --- a/scripts/build_site_release_bundle.py +++ b/scripts/build_site_release_bundle.py @@ -55,7 +55,7 @@ https://appdevelopsk.com and the expected canonical/hreflang, then check the public app catalog and support landing metadata. -This includes 30 app-discovery documents and 17 approved policy documents +This includes 31 app-discovery documents/assets and 17 approved policy documents from current source. It is NOT a complete VPS backup, nginx configuration, database migration, browser test, app-store release, or SEO indexing proof. """ @@ -81,7 +81,7 @@ def release_manifest(root=ROOT): scripts = root / "scripts" apps = shell_array((scripts / "publish_app_discovery.sh").read_text(encoding="utf-8"), "files") policies = shell_array((scripts / "publish_stale_policy_pages.sh").read_text(encoding="utf-8"), "slugs") - if len(apps) != 30 or len(policies) != 17: + if len(apps) != 31 or len(policies) != 17: raise ValueError("publisher manifest count changed; review before bundling") if not PRESS.issubset(set(apps)): raise ValueError("one or more of the five press routes are not in publisher manifest") diff --git a/scripts/check_app_discovery_live.sh b/scripts/check_app_discovery_live.sh index 43263dcd..3c5a7fc6 100644 --- a/scripts/check_app_discovery_live.sh +++ b/scripts/check_app_discovery_live.sh @@ -75,7 +75,7 @@ for slug in brain-burst snaplingo; do grep -Fq 'placement:' "$tmp/$slug.html" || { echo "FAIL $slug placement attribution missing" >&2; exit 1; } done # Source merged app SEO and product-truth changes must be on the *public* origin. -grep -Fq 'BrainBurst: Daily Trivia & 1v1 Quiz Battles | Android' "$tmp/brain-burst.html" || { echo 'FAIL BrainBurst current SEO title not live' >&2; exit 1; } +# The current BrainBurst title is checked below after the explicit support route fetch. if grep -Eq 'How do I restore my purchase\?|How do I cancel a subscription\?|Many features work offline\.' "$tmp/brain-burst.html"; then echo 'FAIL BrainBurst advertises unsupported billing or offline features' >&2; exit 1 fi @@ -108,15 +108,14 @@ grep -Fq 'content="Want to get better at debating? Debate Me lets you challenge grep -Fq '' "$tmp/debate-me.html" || { echo 'FAIL Debate Me OG title not live' >&2; exit 1; } grep -Fq 'data-position="hero"' "$tmp/debate-me.html" || { echo 'FAIL Debate Me first-screen Play CTA not live' >&2; exit 1; } grep -Fq 'data-position="details"' "$tmp/debate-me.html" || { echo 'FAIL Debate Me details Play CTA missing' >&2; exit 1; } -grep -Fq 'support_debate_me_hero' "$tmp/debate-me.html" || { echo 'FAIL Debate Me Play attribution missing' >&2; exit 1; } +grep -Fq 'utm_campaign=support_debate-me' "$tmp/debate-me.html" || { echo 'FAIL Debate Me published Play campaign attribution missing' >&2; exit 1; } if grep -Eq 'Hundreds of meal ideas|Filter by ingredients|Can.t decide what to cook tonight' "$tmp/debate-me.html"; then echo 'FAIL Debate Me page still describes cooking instead of AI debates' >&2; exit 1 fi # GSC 2026-11-09..11: BrainBurst has impressions but no clicks. Verify the # improved title/description on the public site, not only in GitHub. fetch '/support/brain-burst/' 'brain-burst.html' -grep -Fq 'BrainBurst – Daily Trivia & 1v1 Quiz Battles on Android' "$tmp/brain-burst.html" || \ - grep -Fq 'BrainBurst – Daily Trivia & 1v1 Quiz Battles on Android' "$tmp/brain-burst.html" || { echo 'FAIL BrainBurst revised title not live' >&2; exit 1; } +grep -Fq 'BrainBurst – Daily Trivia & 1v1 Quiz Battles on Android' "$tmp/brain-burst.html" || { echo 'FAIL BrainBurst revised title not live' >&2; exit 1; } grep -Fq 'content="Play daily trivia and challenge others in 1v1 quiz battles with BrainBurst.' "$tmp/brain-burst.html" || { echo 'FAIL BrainBurst search description not live' >&2; exit 1; } grep -Fq 'play.google.com/store/apps/details?id=com.brainburst.brain_burst' "$tmp/brain-burst.html" || { echo 'FAIL BrainBurst Play CTA missing' >&2; exit 1; } # Market listing must describe idea discovery, not a voice diary or an unsupported checkout. diff --git a/scripts/publish_app_discovery.sh b/scripts/publish_app_discovery.sh index a332f876..fec82a22 100644 --- a/scripts/publish_app_discovery.sh +++ b/scripts/publish_app_discovery.sh @@ -15,7 +15,7 @@ root="${APP_SITE_DEPLOY_ROOT:-/var/www/html}" if [[ ! "$host" =~ ^[a-zA-Z0-9_.@-]+$ || ! "$root" =~ ^/var/www/[a-zA-Z0-9_./-]+$ ]]; then echo 'Invalid APP_SITE_DEPLOY_HOST or APP_SITE_DEPLOY_ROOT' >&2; exit 2 fi -files=(index.html apps.html sitemap.xml robots.txt guides/quick-games/index.html guides/quick-games/ja/index.html guides/daily-habits/index.html guides/decision-helpers/index.html guides/ai-tools/index.html guides/ai-debate-practice/index.html guides/ai-debate-practice/ja/index.html support/brain-burst/index.html support/one-tap-routine/index.html support/snaplingo/index.html support/face-reaction-battle/index.html support/twotaku/index.html support/debate-me/index.html support/idea-market/index.html support/blur/index.html support/instant-judge/index.html support/roast-me/index.html support/future-me/index.html support/tappitsu-battle/index.html support/taletime/index.html support/dog-breeds-encyclopedia/index.html press/index.html press/es/index.html press/pt-br/index.html press/ja/index.html press/id/index.html) +files=(scripts/app-share.js index.html apps.html sitemap.xml robots.txt guides/quick-games/index.html guides/quick-games/ja/index.html guides/daily-habits/index.html guides/decision-helpers/index.html guides/ai-tools/index.html guides/ai-debate-practice/index.html guides/ai-debate-practice/ja/index.html support/brain-burst/index.html support/one-tap-routine/index.html support/snaplingo/index.html support/face-reaction-battle/index.html support/twotaku/index.html support/debate-me/index.html support/idea-market/index.html support/blur/index.html support/instant-judge/index.html support/roast-me/index.html support/future-me/index.html support/tappitsu-battle/index.html support/taletime/index.html support/dog-breeds-encyclopedia/index.html press/index.html press/es/index.html press/pt-br/index.html press/ja/index.html press/id/index.html) for file in "${files[@]}"; do [[ -s "$file" ]] || { echo "Missing source file: $file" >&2; exit 2; } done diff --git a/scripts/test_press_kit.py b/scripts/test_press_kit.py index eefc43d2..92d35820 100644 --- a/scripts/test_press_kit.py +++ b/scripts/test_press_kit.py @@ -90,11 +90,13 @@ def test_live_smoke_checks_all_press_locales_and_latest_support(self): self.assertIn('fetch "/$route" "press-$code.html"', smoke) self.assertIn("'press_app_click'", smoke) self.assertIn("'download_click'", smoke) - self.assertIn("BrainBurst: Daily Trivia & 1v1 Quiz Battles | Android", smoke) - self.assertIn("Debate Me: AI Debate Practice App for Android | SK APPS", smoke) - self.assertIn('', smoke) + self.assertIn("BrainBurst – Daily Trivia & 1v1 Quiz Battles on Android", smoke) + self.assertIn("Debate Me – Practice Debating with AI on Android | SK APPS", smoke) + self.assertIn('', smoke) self.assertNotIn("Debate Me: Practice Arguments with AI | Android App", smoke) self.assertNotIn("Debate Me – Free AI Debate App for Android | SK APPS", smoke) + self.assertIn("utm_campaign=support_debate-me", smoke) + self.assertNotIn("support_debate_me_hero", smoke) def test_homepage_and_sitemap_discoverable(self): homepage = (ROOT / "index.html").read_text(encoding="utf-8") diff --git a/scripts/test_publish_app_discovery_staging.py b/scripts/test_publish_app_discovery_staging.py index 200261a3..97128f97 100644 --- a/scripts/test_publish_app_discovery_staging.py +++ b/scripts/test_publish_app_discovery_staging.py @@ -75,6 +75,7 @@ def test_real_relative_rsync_layout_matches_exact_allowlist(self): paths = manifest() self.assertTrue(PRESS.issubset(set(paths)), "Every press locale must deploy") self.assertIn("apps.html", paths) + self.assertIn("scripts/app-share.js", paths) self.assertIn("support/brain-burst/index.html", paths) self.assertIn("support/one-tap-routine/index.html", paths) self.assertIn("guides/ai-debate-practice/index.html", paths) diff --git a/scripts/test_site_release_bundle.py b/scripts/test_site_release_bundle.py index fc668270..e1b1a038 100644 --- a/scripts/test_site_release_bundle.py +++ b/scripts/test_site_release_bundle.py @@ -13,10 +13,13 @@ class AppsiteReleaseBundleTests(unittest.TestCase): def test_exact_publish_manifest_has_five_press_and_seventeen_policies(self): files = bundle.release_manifest() - self.assertEqual(len(files), 47) + self.assertEqual(len(files), 48) + workflow = (bundle.ROOT / ".github/workflows/build-appsite-release-bundle.yml").read_text() + self.assertIn("assert len(names) == 50", workflow) self.assertEqual(len(files), len(set(files))) self.assertTrue(bundle.PRESS.issubset(files)) self.assertIn("support/one-tap-routine/index.html", files) + self.assertIn("scripts/app-share.js", files) for guide in ("guides/ai-debate-practice/index.html", "guides/ai-debate-practice/ja/index.html"): self.assertIn(guide, files, "published sitemap entry missing from release ZIP") diff --git a/support/debate-me/index.html b/support/debate-me/index.html index c723b877..a6f6563c 100644 --- a/support/debate-me/index.html +++ b/support/debate-me/index.html @@ -100,6 +100,8 @@ } }, true); + +