Compare commits

..

2 Commits

Author SHA1 Message Date
Claude
6ec98bc9bb Сторінка гри: «Що нового» укр/англ з whatsnew.gd (ci/news.py → news.json на дзеркалі)
Some checks are pending
ci-image / image (push) Successful in 14s
build / build (push) Has started running
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017HrHZxa3KBighPXSxK7efY
2026-12-01 13:21:08 +00:00
Gitea Actions
024c766998 game_godot: TinMerezhi.exe v1.0.90 2026-12-01 13:14:42 +00:00
4 changed files with 40 additions and 5 deletions

View File

@@ -106,6 +106,7 @@ jobs:
TAG: ${{ github.ref_name }}
run: |
if [ -z "$KEY" ] || [ ! -s ci/mirror_known_hosts ]; then echo "mirror: no MIRROR_SSH_KEY or ci/mirror_known_hosts, skipped (the updater falls back to Gitea)"; exit 0; fi
python3 ci/news.py source_godot/whatsnew.gd /tmp/news.json
echo "$TAG" > /tmp/version.txt # before umask 077: sftp put keeps the mode, Caddy must be able to read it
umask 077; printf '%s\n' "$KEY" > /tmp/mirror_key
# before the Release: once the game sees the new tag, the mirror already has its exe (the updater checks the size)
@@ -118,6 +119,7 @@ jobs:
-rm /srv/tm/TinMerezhi.exe
symlink /srv/tm/$TAG/TinMerezhi.exe /srv/tm/TinMerezhi.exe
put /tmp/version.txt /srv/tm/version.txt
put /tmp/news.json /srv/tm/news.json
-mkdir /srv/tm/img
put itch/wide_cover_2520x1080.png /srv/tm/img/
put itch/social_1200x630.png /srv/tm/img/

18
ci/news.py Normal file
View File

@@ -0,0 +1,18 @@
# Game news for the page on the mirror: whatsnew.gd CHANGES (game-only, uk/en) -> news.json [{"v", "uk": [...], "en": [...]}], newest first.
import json, re, sys
src, out = sys.argv[1], sys.argv[2]
body = open(src, encoding="utf-8").read().split("const CHANGES := [", 1)[1].split("\n]", 1)[0]
news = []
for line in body.splitlines():
line = line.strip().rstrip(",")
if not line.startswith("["):
continue
v, uk, en = json.loads(line)
if not news or news[-1]["v"] != v:
news.append({"v": v, "uk": [], "en": []})
news[-1]["uk"].append(uk)
news[-1]["en"].append(en)
assert news and all(len(n["uk"]) == len(n["en"]) for n in news), "no CHANGES parsed"
json.dump(news, open(out, "w", encoding="utf-8"), ensure_ascii=False)
print(f"news.json: {len(news)} versions")

BIN
game_godot/TinMerezhi.exe (Stored with Git LFS)

Binary file not shown.

View File

@@ -40,6 +40,9 @@ th { color: var(--dim); font-weight: normal; font-size: 13px; }
tr.first td { color: var(--warn); }
.empty { color: var(--dim); }
.bad { color: var(--bad); }
.nv { color: var(--warn); margin: 14px 0 2px; }
#news ul { margin: 0; padding-left: 20px; }
#more { background: var(--panel); color: var(--acc); border: 1px solid var(--line); padding: 6px 12px; font: inherit; cursor: pointer; border-radius: 6px; margin-top: 10px; }
footer { color: var(--dim); font-size: 13px; margin-top: 36px; }
</style>
</head>
@@ -59,6 +62,9 @@ footer { color: var(--dim); font-size: 13px; margin-top: 36px; }
</div>
<p data-t="story"></p>
<ul class="feat" id="feat"></ul>
<h2 id="news-h" data-t="news"></h2>
<div id="news"></div>
<button id="more" class="lang" style="display:none"></button>
<h2 data-t="shots"></h2>
<div class="shots">
<img src="img/1_start.png" alt="" loading="lazy">
@@ -85,7 +91,7 @@ const T = {
"Після фіналу: Нескінченна мережа з рекордами, щоденний виклик і New Game+",
"Три складності: Новачок, Звичайний і Параноя (без збережень)",
"Адаптивна синтвейв-музика, українська та англійська мови, автооновлення"],
shots: "📸 Скриншоти",
shots: "📸 Скриншоти", news: "📰 Що нового", more: "Показати старіші",
recnote: "Онлайн-рекорди надсилаються з гри лише за згодою (налаштування → онлайн-рекорди). Таблиці оновлюються щохвилини.",
foot: "Розробник: JunioR. Гра і код — під ліцензією MIT. Рушій Godot.",
boards: ["♾ Нескінченна мережа", "📅 Виклик дня", "🤖 1 · Кур'єр", "🤖 2 · Прибиральник", "🤖 3 · Збирач", "🤖 4 · Нічний рейс"],
@@ -104,7 +110,7 @@ const T = {
"After the finale: the Endless Network with leaderboards, a daily challenge and New Game+",
"Three difficulties: Novice, Normal and Paranoid (no saves)",
"Adaptive synthwave music, English and Ukrainian, auto-update"],
shots: "📸 Screenshots",
shots: "📸 Screenshots", news: "📰 What's new", more: "Show older",
recnote: "Scores are sent from the game only if you opt in (settings → online leaderboards). Tables refresh every minute.",
foot: "Developer: JunioR. The game and its code are MIT-licensed. Godot engine.",
boards: ["♾ Endless Network", "📅 Daily", "🤖 1 · Courier", "🤖 2 · Janitor", "🤖 3 · Collector", "🤖 4 · Night Flight"],
@@ -117,7 +123,8 @@ const IDS = ["endless", DAY, "agent0", "agent1", "agent2", "agent3"];
let lang = "uk";
try { lang = localStorage.getItem("lang") || (navigator.language.startsWith("uk") ? "uk" : "en"); } catch (e) {}
if (new URLSearchParams(location.search).get("lang") in T) lang = new URLSearchParams(location.search).get("lang");
let tops = {}; // кеш таблиць, щоб перемикання мови не ходило в мережу
let tops = {};
let news = [], newsAll = false; // news.json: ігрові зміни з whatsnew.gd (CI, ci/news.py) // кеш таблиць, щоб перемикання мови не ходило в мережу
function el(tag, text, cls) { const e = document.createElement(tag); if (text !== undefined) e.textContent = text; if (cls) e.className = cls; return e; }
@@ -127,6 +134,12 @@ function render() {
for (const e of document.querySelectorAll("[data-t]")) e.textContent = t[e.dataset.t];
for (const b of document.querySelectorAll("[data-l]")) b.classList.toggle("on", b.dataset.l === lang);
document.getElementById("feat").replaceChildren(...t.feat.map(f => el("li", f)));
const shown = newsAll ? news : news.slice(0, 5);
document.getElementById("news").replaceChildren(...shown.flatMap(n => [el("div", "v" + n.v, "nv"), (() => { const u = el("ul"); u.append(...n[lang].map(x => el("li", x))); return u; })()]));
const more = document.getElementById("more");
more.style.display = !newsAll && news.length > 5 ? "" : "none";
more.textContent = t.more;
document.getElementById("news-h").style.display = news.length ? "" : "none";
document.getElementById("boards").replaceChildren(...IDS.map((id, k) => {
const s = el("section", undefined, "b"), tb = el("table"), head = el("tr");
s.append(el("h3", t.boards[k]));
@@ -161,6 +174,8 @@ for (const b of document.querySelectorAll("[data-l]")) b.onclick = () => {
try { localStorage.setItem("lang", lang); } catch (e) {}
render();
};
document.getElementById("more").onclick = () => { newsAll = true; render(); };
fetch("news.json", {cache: "no-store"}).then(r => r.ok ? r.json() : []).then(d => { news = d; render(); }).catch(() => {});
fetch("version.txt", {cache: "no-store"}).then(r => r.ok ? r.text() : "–").then(v => document.getElementById("ver").textContent = v.trim()).catch(() => {});
render();
load();