+
{TABS.map((x) => (
) : tab === "launch" ? (
+ ) : tab === "changes" ? (
+
) : tab === "notes" ? (
) : (
diff --git a/src/i18n/messages/en/library.ts b/src/i18n/messages/en/library.ts
index 5aac730..2de7bfd 100644
--- a/src/i18n/messages/en/library.ts
+++ b/src/i18n/messages/en/library.ts
@@ -71,6 +71,7 @@ export default {
dontShow: "Don't show this again",
},
tabs: {
+ changes: "Changes",
label: "Project",
overview: "Overview",
graphics: "Graphics",
@@ -80,6 +81,17 @@ export default {
running: "Running",
hidden: "Hidden in Screenshot mode.",
},
+ changes: {
+ installed: "Installed commit",
+ available: "Available update",
+ previous: "Previous build",
+ noUpdate: "No update offered",
+ compare: "Compare commits on GitHub",
+ releases: "Releases and changelog",
+ hint: "Links open GitHub without installing anything. Commit history may be unavailable for other hosts or local builds.",
+ confirm: "Restore previous build?",
+ restoreHint: "This swaps the installed and previous build. It does not restore a saved game.",
+ },
overview: {
newBuild: "A new build is out",
versionHidden: "Version hidden",
diff --git a/src/i18n/messages/es/library.ts b/src/i18n/messages/es/library.ts
index 57a7c1d..e8a6050 100644
--- a/src/i18n/messages/es/library.ts
+++ b/src/i18n/messages/es/library.ts
@@ -68,6 +68,7 @@ export default {
dontShow: "No volver a mostrar esto",
},
tabs: {
+ changes: "Cambios",
label: "Proyecto",
overview: "Resumen",
graphics: "Gráficos",
@@ -77,6 +78,17 @@ export default {
running: "En ejecución",
hidden: "Oculto en el modo captura.",
},
+ changes: {
+ installed: "Commit instalado",
+ available: "Actualización disponible",
+ previous: "Compilación anterior",
+ noUpdate: "No hay actualizaciones ofrecidas",
+ compare: "Comparar commits en GitHub",
+ releases: "Versiones y registro de cambios",
+ hint: "Los enlaces abren GitHub sin instalar nada. El historial puede no estar disponible para otros servidores o compilaciones locales.",
+ confirm: "¿Restaurar la compilación anterior?",
+ restoreHint: "Esto intercambia la compilación instalada y la anterior. No restaura una partida guardada.",
+ },
overview: {
newBuild: "Hay una nueva compilación disponible",
versionHidden: "Versión oculta",
diff --git a/src/i18n/messages/fr/library.ts b/src/i18n/messages/fr/library.ts
index 4faceb4..d98a61d 100644
--- a/src/i18n/messages/fr/library.ts
+++ b/src/i18n/messages/fr/library.ts
@@ -68,6 +68,7 @@ export default {
dontShow: "Ne plus afficher ce message",
},
tabs: {
+ changes: "Modifications",
label: "Projet",
overview: "Aperçu",
graphics: "Graphismes",
@@ -77,6 +78,17 @@ export default {
running: "En cours",
hidden: "Masqué en mode capture d’écran.",
},
+ changes: {
+ installed: "Commit installé",
+ available: "Mise à jour disponible",
+ previous: "Build précédent",
+ noUpdate: "Aucune mise à jour proposée",
+ compare: "Comparer les commits sur GitHub",
+ releases: "Versions et journal des modifications",
+ hint: "Les liens ouvrent GitHub sans rien installer. L’historique peut être indisponible pour les autres hébergeurs ou les builds locaux.",
+ confirm: "Restaurer le build précédent ?",
+ restoreHint: "Cela échange le build installé et le précédent, sans restaurer de sauvegarde.",
+ },
overview: {
newBuild: "Un nouveau build est disponible",
versionHidden: "Version masquée",
diff --git a/src/i18n/messages/ru/library.ts b/src/i18n/messages/ru/library.ts
index a3b43ad..49ca11a 100644
--- a/src/i18n/messages/ru/library.ts
+++ b/src/i18n/messages/ru/library.ts
@@ -71,6 +71,7 @@ export default {
dontShow: "Больше не показывать",
},
tabs: {
+ changes: "Изменения",
label: "Проект",
overview: "Обзор",
graphics: "Графика",
@@ -80,6 +81,17 @@ export default {
running: "Выполняется",
hidden: "Скрыто в режиме скриншотов.",
},
+ changes: {
+ installed: "Установленный коммит",
+ available: "Доступное обновление",
+ previous: "Предыдущая сборка",
+ noUpdate: "Обновление не предложено",
+ compare: "Сравнить коммиты на GitHub",
+ releases: "Релизы и список изменений",
+ hint: "Ссылки открывают GitHub без установки. История может быть недоступна для других хостингов или локальных сборок.",
+ confirm: "Восстановить предыдущую сборку?",
+ restoreHint: "Установленная и предыдущая сборки поменяются местами. Игровые сохранения не восстанавливаются.",
+ },
overview: {
newBuild: "Вышла новая сборка",
versionHidden: "Версия скрыта",
diff --git a/src/i18n/messages/zh-CN/library.ts b/src/i18n/messages/zh-CN/library.ts
index 9d99e41..93932f9 100644
--- a/src/i18n/messages/zh-CN/library.ts
+++ b/src/i18n/messages/zh-CN/library.ts
@@ -68,6 +68,7 @@ export default {
dontShow: "不再显示",
},
tabs: {
+ changes: "变更",
label: "项目",
overview: "概览",
graphics: "图形",
@@ -77,6 +78,17 @@ export default {
running: "运行中",
hidden: "截图模式下不显示。",
},
+ changes: {
+ installed: "已安装的提交",
+ available: "可用更新",
+ previous: "上一个构建版本",
+ noUpdate: "暂无可用更新",
+ compare: "在 GitHub 上比较提交",
+ releases: "发布版本与变更记录",
+ hint: "链接只打开 GitHub,不会安装任何内容。其他托管平台或本地构建版本可能没有提交历史。",
+ confirm: "还原上一个构建版本?",
+ restoreHint: "这会交换已安装版本和上一个构建版本,不会还原游戏存档。",
+ },
overview: {
newBuild: "有新的构建版本",
versionHidden: "已隐藏版本",
diff --git a/src/i18n/messages/zh-TW/library.ts b/src/i18n/messages/zh-TW/library.ts
index 6068a34..3689144 100644
--- a/src/i18n/messages/zh-TW/library.ts
+++ b/src/i18n/messages/zh-TW/library.ts
@@ -68,6 +68,7 @@ export default {
dontShow: "不再顯示",
},
tabs: {
+ changes: "變更",
label: "專案",
overview: "總覽",
graphics: "圖形",
@@ -77,6 +78,17 @@ export default {
running: "執行中",
hidden: "截圖模式下不顯示。",
},
+ changes: {
+ installed: "已安裝的提交",
+ available: "可用更新",
+ previous: "上一個建置版本",
+ noUpdate: "暫無可用更新",
+ compare: "在 GitHub 上比較提交",
+ releases: "發布版本與變更記錄",
+ hint: "連結只開啟 GitHub,不會安裝任何內容。其他託管平台或本機建置版本可能沒有提交歷史。",
+ confirm: "還原上一個建置版本?",
+ restoreHint: "這會交換已安裝版本和上一個建置版本,不會還原遊戲存檔。",
+ },
overview: {
newBuild: "有新的建置版本",
versionHidden: "已隱藏版本",
diff --git a/src/lib/store.ts b/src/lib/store.ts
index 76d4558..da88257 100644
--- a/src/lib/store.ts
+++ b/src/lib/store.ts
@@ -6,7 +6,7 @@ import { act as send, getBackend } from "./api"
import type { Action, PlayChoice, Project, Snapshot } from "./types"
export type View = "library" | "settings"
-export type ProjectTab = "overview" | "graphics" | "launch" | "notes" | "activity"
+export type ProjectTab = "overview" | "graphics" | "launch" | "notes" | "activity" | "changes"
export type Dialog =
| { kind: "import" }
diff --git a/src/lib/version-links.test.ts b/src/lib/version-links.test.ts
new file mode 100644
index 0000000..3ee9686
--- /dev/null
+++ b/src/lib/version-links.test.ts
@@ -0,0 +1,21 @@
+import { describe, expect, it } from "vitest"
+import { githubVersionLinks } from "./version-links"
+
+describe("githubVersionLinks", () => {
+ it("compares installed and offered commits", () => {
+ expect(githubVersionLinks("https://github.com/example/project", "1234567", "abcdef0")).toEqual({
+ releases: "https://github.com/example/project/releases",
+ compare: "https://github.com/example/project/compare/1234567...abcdef0",
+ })
+ })
+ it("does not compare unknown, equal or invalid versions", () => {
+ for (const [a, b] of [[null, "abcdef0"], ["local", "abcdef0"], ["1234567", "1234567"], ["1234567", "../other"]]) {
+ expect(githubVersionLinks("https://github.com/example/project", a, b)?.compare).toBeNull()
+ }
+ })
+ it("rejects non-GitHub links and non-repository paths", () => {
+ for (const url of [null, "https://github.com.evil.example/a/b", "http://github.com/a/b", "https://github.com/a/b/issues", "https://user@github.com/a/b"]) {
+ expect(githubVersionLinks(url, "1234567", "abcdef0")).toBeNull()
+ }
+ })
+})
diff --git a/src/lib/version-links.ts b/src/lib/version-links.ts
new file mode 100644
index 0000000..32e1da2
--- /dev/null
+++ b/src/lib/version-links.ts
@@ -0,0 +1,25 @@
+/** Only link to a genuine GitHub repository and validated commit IDs.
+ * Custom hosts and local/ZIP builds do not have a known GitHub history.
+ */
+export function githubVersionLinks(
+ webUrl: string | null,
+ built: string | null,
+ update: string | null,
+) {
+ if (!webUrl) return null
+ let url: URL
+ try {
+ url = new URL(webUrl)
+ } catch {
+ return null
+ }
+ if (url.origin !== "https://github.com" || url.username || url.password || url.search || url.hash) return null
+ const path = url.pathname.replace(/\/$/, "").replace(/\.git$/, "")
+ if (!/^\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(path)) return null
+ const root = url.origin + path
+ const valid = (sha: string | null): sha is string => !!sha && /^[a-f0-9]{7,40}$/i.test(sha)
+ return {
+ releases: root + "/releases",
+ compare: valid(built) && valid(update) && built !== update ? root + "/compare/" + built + "..." + update : null,
+ }
+}