Fleet page publish: the Fleet | Workers nav and its CSS are re-inserted on every publish when a regeneration dropped them

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
igneum-labs 2026-10-06 20:25:02 +00:00
parent 93d67c4014
commit 09cf92db48

View file

@ -7,6 +7,24 @@ JSON="${1:?fleet.json path}"
DLSITE="$(cat "$HOME/.config/igneum/dlsite-dir")"; P="$(cat "$HOME/.config/igneum/fleet-path")"
python3 -c "import json,sys; json.load(open(sys.argv[1]))" "$JSON"
cp "$JSON" "$DLSITE/$P/fleet.json"
# The Fleet | Workers nav is part of the page for good (6 October 2026, the project lead: the link was missing): re-insert it and its
# four CSS lines whenever an index.html regeneration dropped them. Absolute paths: the host serves the folder without a slash.
python3 - "$DLSITE/$P/index.html" "$P" <<'PY'
import sys, re
f, p = sys.argv[1], sys.argv[2]; s = open(f).read()
nav = f'<nav aria-label="Pages"><a href="/{p}/" class="on" aria-current="page">Fleet</a><a href="/{p}/workers.html">Workers</a></nav>'
css = """ nav { display: flex; gap: 2px; border: 1px solid var(--line); }
nav a { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); text-decoration: none; padding: 7px 12px; }
nav a.on { color: var(--ink); background: var(--panel-2); }
nav a:hover { color: var(--ember-2); }
"""
changed = False
if "nav {" not in s: s = s.replace("</style>", css + "</style>", 1); changed = True
if "workers.html" not in s:
m = re.search(r"<header[^>]*>", s) or re.search(r"<body[^>]*>", s)
s = s[:m.end()] + "\n " + nav + s[m.end():]; changed = True
if changed: open(f, "w").write(s); print("fleet index.html: nav restored")
PY
(cd "$DLSITE" && npx --yes vercel@latest --global-config "$HOME/.config/igneum/vercel" deploy --prod --yes >/dev/null 2>&1) || { echo "deploy failed" >&2; exit 1; }
for i in $(seq 1 12); do
if curl -fsS --max-time 10 "https://dl.igneum.network/$P/fleet.json?t=$(date +%s)" | python3 -c "import json,sys; d=json.load(sys.stdin); sys.exit(0 if d.get('spend',{}).get('updated_at')==json.load(open('$JSON')).get('spend',{}).get('updated_at') else 1)" 2>/dev/null; then echo "live: https://dl.igneum.network/$P/"; exit 0; fi