ci(pages): moving notice on the old GitHub Pages address

poli0981.github.io/youtube-generator still serves v0.38 to old bookmarks,
and the data people saved there can't follow to ytgenerator.stream on its
own (browser storage belongs to a site). A single static page replaces it:

- reads the ytdescgen-* stores this browser saved on the old address and
  downloads them as a backup file in the new format (Settings › Restore
  reads it: migrations, the preview and Undo apply as for any backup);
- points to ytgenerator.stream, in English or Vietnamese;
- noindex, canonical to the new site, and a 404 copy for old deep links.

pages-migration.yml deploys it by hand (workflow_dispatch, pinned
actions, job-scoped permissions). The page, the workflow and the
github-pages environment go on 2026-11-29.

A regression test feeds the page's exact output through the restore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
poli0981andClaude Opus 5.5 committed 2026-09-30 22:33:29 +07:00
1 parent 1e42a2975b
commit dc8fc396f1
6 files changed
+552

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
name: Pages migration notice
# The app moved to https://ytgenerator.stream. What used to be the GitHub
# Pages site (poli0981.github.io/youtube-generator) is replaced by a single
# static page that hands visitors the data their browser saved there — as a
# backup file the new site restores — and points them to the new address.
#
# Run by hand once; the page is removed on 2026-11-29 together with this
# workflow and the github-pages environment (tracked in an issue).
on:
workflow_dispatch:
permissions: {}
concurrency:
group: pages
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: migration-page
- id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
+55
View File
@@ -0,0 +1,55 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noindex" />
<meta name="color-scheme" content="dark light" />
<title>YTDescGen has moved to ytgenerator.stream</title>
<meta
name="description"
content="YTDescGen now lives at ytgenerator.stream. Download the data you saved here and restore it there."
/>
<link rel="canonical" href="https://ytgenerator.stream/" />
<link rel="stylesheet" href="/youtube-generator/style.css" />
<script src="/youtube-generator/app.js" defer></script>
</head>
<body>
<main class="card">
<p class="brand">YTDescGen</p>
<h1 data-i18n="title">YTDescGen has moved to ytgenerator.stream</h1>
<p data-i18n="lead">
The app now lives at its own address. Everything you saved on this old address — profiles,
presets, templates, history, settings — stays in this browser, so bring it along in two
steps.
</p>
<ol class="steps">
<li>
<strong data-i18n="step1">Download your data</strong>
<p id="found" class="muted" data-i18n="searching">Looking for saved data…</p>
<button id="download" type="button" disabled data-i18n="download">
Download my data
</button>
</li>
<li>
<strong data-i18n="step2">Restore it on the new site</strong>
<p class="muted" data-i18n="step2Hint">
Open Settings › Backup &amp; restore, choose Restore and pick the file — or drop it
there. You'll see what's new before anything changes.
</p>
<a class="button primary" href="https://ytgenerator.stream/settings" data-i18n="open">
Open ytgenerator.stream
</a>
</li>
</ol>
<p class="muted small" data-i18n="notice">
This page stays until 29 November 2026. The desktop and Android apps aren't affected.
</p>
<p class="small">
<button id="language" type="button" class="link" data-i18n="switch">Tiếng Việt</button>
</p>
</main>
</body>
</html>
+173
View File
@@ -0,0 +1,173 @@
// YTDescGen moved from poli0981.github.io/youtube-generator to
// ytgenerator.stream. Browser storage belongs to a site, so data saved on the
// old address can't follow on its own: this page reads it and hands it over
// as a backup file (the format the new site's Settings › Restore reads).
(function () {
"use strict";
// Store key, where a list section keeps its items, and the backup section.
var STORES = [
{ key: "ytdescgen-profiles", section: "profiles", list: "profiles" },
{ key: "ytdescgen-presets", section: "presets", list: "presets" },
{ key: "ytdescgen-templates", section: "templates", list: "templates" },
{ key: "ytdescgen-history", section: "history", list: "entries" },
{ key: "ytdescgen-settings", section: "settings", list: null },
{ key: "ytdescgen-editor-draft", section: "draft", list: null },
];
var TEXT = {
en: {
title: "YTDescGen has moved to ytgenerator.stream",
lead: "The app now lives at its own address. Everything you saved on this old address — profiles, presets, templates, history, settings — stays in this browser, so bring it along in two steps.",
step1: "Download your data",
searching: "Looking for saved data…",
found: "Found: {list}.",
none: "Nothing was saved in this browser — you can go straight to the new site.",
unavailable:
"This browser won't let the page read its storage (private mode?). Open the page in the browser you used before.",
download: "Download my data",
step2: "Restore it on the new site",
step2Hint:
"Open Settings › Backup & restore, choose Restore and pick the file — or drop it there. You'll see what's new before anything changes.",
open: "Open ytgenerator.stream",
notice:
"This page stays until 29 November 2026. The desktop and Android apps aren't affected.",
switch: "Tiếng Việt",
profiles: "Profiles ({n})",
presets: "Game presets ({n})",
templates: "Templates ({n})",
history: "History ({n})",
settings: "Settings",
draft: "Editor draft",
},
vi: {
title: "YTDescGen đã chuyển sang ytgenerator.stream",
lead: "Ứng dụng giờ có địa chỉ riêng. Mọi thứ bạn đã lưu ở địa chỉ cũ này — hồ sơ, preset, template, lịch sử, cài đặt — vẫn nằm trong trình duyệt này, hãy mang theo bằng hai bước.",
step1: "Tải dữ liệu của bạn",
searching: "Đang tìm dữ liệu đã lưu…",
found: "Tìm thấy: {list}.",
none: "Trình duyệt này chưa lưu gì — bạn có thể sang thẳng trang mới.",
unavailable:
"Trình duyệt không cho trang đọc bộ nhớ (chế độ ẩn danh?). Hãy mở trang bằng trình duyệt bạn đã dùng trước đây.",
download: "Tải dữ liệu của tôi",
step2: "Khôi phục trên trang mới",
step2Hint:
"Mở Cài đặt › Sao lưu & khôi phục, chọn Khôi phục rồi chọn tệp — hoặc thả tệp vào đó. Bạn sẽ xem trước những gì mới trước khi có thay đổi nào.",
open: "Mở ytgenerator.stream",
notice:
"Trang này tồn tại đến ngày 29/11/2026. Ứng dụng desktop và Android không bị ảnh hưởng.",
switch: "English",
profiles: "Hồ sơ ({n})",
presets: "Preset game ({n})",
templates: "Template ({n})",
history: "Lịch sử ({n})",
settings: "Cài đặt",
draft: "Bản nháp editor",
},
};
var lang = /^vi\b/i.test(navigator.language || "") ? "vi" : "en";
var found = null; // { data, parts } once read
var readFailed = false;
function format(template, values) {
return template.replace(/\{(\w+)\}/g, function (_, name) {
return String(values[name]);
});
}
function readStores() {
var data = {};
var parts = [];
STORES.forEach(function (store) {
var raw = localStorage.getItem(store.key);
if (!raw) return;
var saved;
try {
saved = JSON.parse(raw);
} catch (e) {
return;
}
// Zustand's saved shape: { state, version }.
var state = saved && saved.state ? saved.state : saved;
var version = saved && typeof saved.version === "number" ? saved.version : 0;
if (!state || typeof state !== "object") return;
if (store.list) {
var items = state[store.list];
if (!Array.isArray(items) || items.length === 0) return;
data[store.section] = { version: version, items: items };
parts.push({ section: store.section, n: items.length });
} else {
data[store.section] = { version: version, value: state };
parts.push({ section: store.section, n: 1 });
}
});
return { data: data, parts: parts };
}
function render() {
var text = TEXT[lang];
document.documentElement.lang = lang;
document.title = text.title;
Array.prototype.forEach.call(document.querySelectorAll("[data-i18n]"), function (el) {
var key = el.getAttribute("data-i18n");
if (text[key] && key !== "searching") el.textContent = text[key];
});
var status = document.getElementById("found");
var button = document.getElementById("download");
if (readFailed) {
status.textContent = text.unavailable;
button.disabled = true;
} else if (!found || found.parts.length === 0) {
status.textContent = text.none;
button.disabled = true;
} else {
var list = found.parts.map(function (part) {
return format(text[part.section], { n: part.n });
});
status.textContent = format(text.found, { list: list.join(", ") });
button.disabled = false;
}
}
function download() {
if (!found) return;
var now = new Date();
var envelope = {
_app: "ytdescgen",
_format: 2,
_type: "backup",
_schemaVersion: 1,
_appVersion: "0.38.0",
_exportedAt: now.toISOString(),
_source: "poli0981.github.io/youtube-generator",
data: found.data,
};
var blob = new Blob([JSON.stringify(envelope, null, 2)], { type: "application/json" });
var url = URL.createObjectURL(blob);
var link = document.createElement("a");
var day = now.toISOString().slice(0, 10);
link.href = url;
link.download = "ytdescgen-legacy-backup-" + day + ".json";
document.body.appendChild(link);
link.click();
link.remove();
setTimeout(function () {
URL.revokeObjectURL(url);
}, 1000);
}
document.addEventListener("DOMContentLoaded", function () {
try {
found = readStores();
} catch (e) {
readFailed = true;
}
document.getElementById("download").addEventListener("click", download);
document.getElementById("language").addEventListener("click", function () {
lang = lang === "vi" ? "en" : "vi";
render();
});
render();
});
})();
+55
View File
@@ -0,0 +1,55 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noindex" />
<meta name="color-scheme" content="dark light" />
<title>YTDescGen has moved to ytgenerator.stream</title>
<meta
name="description"
content="YTDescGen now lives at ytgenerator.stream. Download the data you saved here and restore it there."
/>
<link rel="canonical" href="https://ytgenerator.stream/" />
<link rel="stylesheet" href="/youtube-generator/style.css" />
<script src="/youtube-generator/app.js" defer></script>
</head>
<body>
<main class="card">
<p class="brand">YTDescGen</p>
<h1 data-i18n="title">YTDescGen has moved to ytgenerator.stream</h1>
<p data-i18n="lead">
The app now lives at its own address. Everything you saved on this old address — profiles,
presets, templates, history, settings — stays in this browser, so bring it along in two
steps.
</p>
<ol class="steps">
<li>
<strong data-i18n="step1">Download your data</strong>
<p id="found" class="muted" data-i18n="searching">Looking for saved data…</p>
<button id="download" type="button" disabled data-i18n="download">
Download my data
</button>
</li>
<li>
<strong data-i18n="step2">Restore it on the new site</strong>
<p class="muted" data-i18n="step2Hint">
Open Settings › Backup &amp; restore, choose Restore and pick the file — or drop it
there. You'll see what's new before anything changes.
</p>
<a class="button primary" href="https://ytgenerator.stream/settings" data-i18n="open">
Open ytgenerator.stream
</a>
</li>
</ol>
<p class="muted small" data-i18n="notice">
This page stays until 29 November 2026. The desktop and Android apps aren't affected.
</p>
<p class="small">
<button id="language" type="button" class="link" data-i18n="switch">Tiếng Việt</button>
</p>
</main>
</body>
</html>
+122
View File
@@ -0,0 +1,122 @@
:root {
color-scheme: dark light;
--bg: #0b0b12;
--surface: #151522;
--border: #2a2a3d;
--text: #ececf4;
--muted: #a0a0b8;
--accent: #7c6cf6;
--accent-text: #ffffff;
}
@media (prefers-color-scheme: light) {
:root {
--bg: #f5f5fa;
--surface: #ffffff;
--border: #dcdce8;
--text: #16161f;
--muted: #5c5c70;
--accent: #5b4de0;
}
}
* {
box-sizing: border-box;
}
body {
margin: 0;
min-height: 100dvh;
display: grid;
place-items: center;
padding: 24px 16px;
background: var(--bg);
color: var(--text);
font:
15px/1.6 system-ui,
-apple-system,
"Segoe UI",
Roboto,
sans-serif;
}
.card {
width: 100%;
max-width: 34rem;
padding: 28px;
border: 1px solid var(--border);
border-radius: 20px;
background: var(--surface);
}
.brand {
margin: 0 0 8px;
color: var(--accent);
font-weight: 700;
letter-spacing: 0.02em;
}
h1 {
margin: 0 0 12px;
font-size: 1.45rem;
line-height: 1.3;
}
.steps {
margin: 20px 0;
padding-left: 1.2rem;
}
.steps li {
margin-bottom: 18px;
}
.steps p {
margin: 4px 0 10px;
}
.muted {
color: var(--muted);
}
.small {
font-size: 0.85rem;
}
button,
.button {
display: inline-block;
padding: 9px 16px;
border: 1px solid var(--border);
border-radius: 10px;
background: transparent;
color: var(--text);
font: inherit;
font-weight: 600;
text-decoration: none;
cursor: pointer;
}
button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.primary,
#download:not(:disabled) {
border-color: var(--accent);
background: var(--accent);
color: var(--accent-text);
}
.link {
padding: 0;
border: 0;
color: var(--accent);
font-weight: 500;
}
:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
+109
View File
@@ -0,0 +1,109 @@
import { describe, expect, it } from "vitest";
import fs from "fs";
import path from "path";
import { readBackupText } from "@utils/backup/detect";
import { sanitizeSections } from "@utils/backup/sanitize";
import { initialSettings } from "@store/settings-heal";
/**
* The page left on poli0981.github.io/youtube-generator hands users their
* old data as a backup file. This is the file it writes for a typical
* v0.38 browser (zustand's `{ state, version }` per store), byte for byte.
*/
const FROM_MIGRATION_PAGE = JSON.stringify({
_app: "ytdescgen",
_format: 2,
_type: "backup",
_schemaVersion: 1,
_appVersion: "0.38.0",
_exportedAt: "2026-09-30T15:32:31.505Z",
_source: "poli0981.github.io/youtube-generator",
data: {
profiles: {
version: 2,
items: [
{
id: "old-1",
name: "Old main",
channelName: "Skullmute",
social: {},
rig: { gpu: "nvidia|rtx_40|RTX 4070" },
resolution: "1080p",
fps: "60",
graphicsPreset: "Ultra",
thirdPartyAdText: "",
createdAt: "2026-05-01T00:00:00.000Z",
updatedAt: "2026-05-01T00:00:00.000Z",
},
],
},
history: {
version: 2,
items: [
{
id: "h1",
gameName: "Hades",
videoType: "part",
language: "en",
genres: ["action"],
title: "Hades Part 1",
description: "d",
tags: "t",
createdAt: "2026-05-02T00:00:00.000Z",
},
{
id: "h2",
gameName: "Hades",
videoType: "part",
language: "en",
genres: ["action"],
title: "Hades Part 1",
description: "d2",
tags: "t",
createdAt: "2026-05-03T00:00:00.000Z",
},
],
},
settings: { version: 12, value: { theme: "light", appLanguage: "vi", legalConsentVersion: 1 } },
},
});
describe("GitHub Pages migration page", () => {
it("writes a file the restore reads, migrating the old data", () => {
const result = readBackupText(FROM_MIGRATION_PAGE);
if (!result.ok || result.file.kind !== "data") throw new Error("not restorable");
const clean = sanitizeSections(result.file.sections, {
...initialSettings,
legalConsentVersion: 2,
});
expect(clean.profiles?.[0]).toMatchObject({
name: "Old main",
rig: { gpu: "gpu:nvidia-rtx-4070" },
graphicsPreset: "ultra",
});
// v0.38 history piled up one entry per Output visit; v3 keeps one per video.
expect(clean.history).toHaveLength(1);
expect(clean.settings).toMatchObject({
theme: "light",
appLanguage: "vi",
legalConsentVersion: 2,
});
});
it("reads every store the app saved, under the keys the app used", () => {
const script = fs.readFileSync(
path.resolve(import.meta.dirname, "../../migration-page/app.js"),
"utf8",
);
for (const key of [
"ytdescgen-profiles",
"ytdescgen-presets",
"ytdescgen-templates",
"ytdescgen-history",
"ytdescgen-settings",
"ytdescgen-editor-draft",
]) {
expect(script).toContain(`"${key}"`);
}
});
});