Refresh live release cards and pin downloads to displayed ISO versions
This commit is contained in:
parent
8e1c1de89a
commit
66134b60b4
3 changed files with 61 additions and 13 deletions
|
|
@ -2,6 +2,20 @@
|
|||
|
||||
## English public status and portal (2026-11-07)
|
||||
|
||||
### Live release-card refresh correction
|
||||
|
||||
Run `20261107T101235Z` published automatically and completed at 13:20:47 UTC.
|
||||
An already-open portal tab still showed `20261107T055158Z`: pipeline status polled,
|
||||
but the release cards fetched only once. This was reproduced against the live
|
||||
browser DOM while both catalogs and all six versioned/current ISO URLs already
|
||||
served the new release. Publication itself did not require replay.
|
||||
|
||||
Cards now read current entries from the existing `v1/releases.json`, refresh every
|
||||
30 seconds while visible and immediately on return/focus. Each button uses the
|
||||
versioned URL paired with its checksum from the same catalog response. Failed
|
||||
refresh retains that exact pair and displays a stale notice; requests are bounded
|
||||
and cannot overlap. Existing catalog schemas and permanent ISO aliases remain.
|
||||
|
||||
The portal uses an English-only dark terminal design. Public URLs and JSON field
|
||||
names/state tokens remain unchanged. `/archipelago/pipeline.json` now serves
|
||||
`data/public/pipeline-public.json`, an English projection of private `latest.json`.
|
||||
|
|
@ -18,9 +32,9 @@ The new driver's normal writer also invokes the exporter, so standalone driver
|
|||
use does not rely solely on the watcher. Keep `pipeline.json` on disk for legacy
|
||||
internal consumers; the HTTPS endpoint is the normalized projection.
|
||||
|
||||
The page reads the existing `releases.json` catalog and polls `pipeline.json` every
|
||||
30 seconds while visible, with one request at a time. Download links remain
|
||||
same-origin `/archipelago/iso/` URLs and checksums come directly from the catalog.
|
||||
The page polls the existing `v1/releases.json` catalog and `pipeline.json` every
|
||||
30 seconds while visible. Download links remain same-origin `/archipelago/iso/`
|
||||
URLs and checksums come directly from the catalog.
|
||||
|
||||
## D-088 restart
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
};
|
||||
async function refresh() {
|
||||
try {
|
||||
const response = await fetch('./pipeline.json', {cache: 'no-store'});
|
||||
const response = await fetch('./pipeline.json', {cache: 'no-store', signal: AbortSignal.timeout(15000)});
|
||||
if (!response.ok) throw new Error('status unavailable');
|
||||
const status = await response.json();
|
||||
if (typeof status.state !== 'string' || typeof status.run !== 'string') throw new Error('invalid status');
|
||||
|
|
@ -47,22 +47,39 @@
|
|||
})();
|
||||
(async () => {
|
||||
const list = document.querySelector('#release-list');
|
||||
const notice = document.createElement('p');
|
||||
notice.className = 'registry-notice'; notice.hidden = true; notice.setAttribute('role', 'status');
|
||||
list.after(notice);
|
||||
let inFlight = false;
|
||||
let lastCatalog;
|
||||
const message = text => { const p = document.createElement('p'); p.className = 'empty'; p.textContent = text; list.replaceChildren(p); };
|
||||
const profiles = {
|
||||
'Arch Core': ['Core', 'A minimal foundation. Build your own environment.'],
|
||||
'GNOME Desktop': ['GNOME Desktop', 'A focused workspace powered by GNOME.'],
|
||||
'KDE Desktop': ['KDE Desktop', 'A configurable desktop powered by KDE Plasma.']
|
||||
'core': ['Core', 'A minimal foundation. Build your own environment.'],
|
||||
'gnome': ['GNOME Desktop', 'A focused workspace powered by GNOME.'],
|
||||
'kde': ['KDE Desktop', 'A configurable desktop powered by KDE Plasma.']
|
||||
};
|
||||
async function refresh() {
|
||||
if (inFlight) return;
|
||||
inFlight = true;
|
||||
try {
|
||||
const response = await fetch('./releases.json', {cache: 'no-store'});
|
||||
// The versioned URL and checksum come from one atomic catalog snapshot.
|
||||
// An old tab can safely retain this pair while a new release is published.
|
||||
const response = await fetch('./v1/releases.json', {cache: 'no-store', signal: AbortSignal.timeout(15000)});
|
||||
if (!response.ok) throw new Error('catalog unavailable');
|
||||
const catalog = await response.json();
|
||||
if (catalog.version !== 1 || !Array.isArray(catalog.releases)) throw new Error('unknown catalog');
|
||||
if (!catalog.releases.length) { message('No public images yet. Check back after the next verified release.'); return; }
|
||||
const cards = catalog.releases.map((release, index) => {
|
||||
if (catalog.apiVersion !== 'archipelago.releases/v1' || !Array.isArray(catalog.releases)) throw new Error('unknown catalog');
|
||||
const current = catalog.releases.filter(release => release.current === true);
|
||||
if (new Set(current.map(r => r.variant)).size !== current.length) throw new Error('duplicate current variant');
|
||||
const identity = JSON.stringify(current);
|
||||
notice.hidden = true;
|
||||
if (identity === lastCatalog) return;
|
||||
if (!current.length) { message('No public images yet. Check back after the next verified release.'); lastCatalog = identity; return; }
|
||||
const cards = current.map((release, index) => {
|
||||
if (!['hardware-test', 'testing', 'stable'].includes(release.channel) || !/^[0-9a-f]{64}$/.test(release.sha256)) throw new Error('invalid release');
|
||||
if (!/^[a-z0-9-]+$/.test(release.variant) || !/^[0-9]{8}T[0-9]{6}Z$/.test(release.version)) throw new Error('invalid release identity');
|
||||
const url = new URL(release.url, location.href);
|
||||
if (url.origin !== location.origin || !url.pathname.startsWith('/archipelago/iso/')) throw new Error('invalid artifact URL');
|
||||
const expected = `/archipelago/iso/${release.variant}/${release.version}/archipelago-${release.variant}.iso`;
|
||||
if (url.origin !== location.origin || url.pathname !== expected || url.search || url.hash) throw new Error('invalid versioned artifact URL');
|
||||
const [name, description] = profiles[release.variant] || ['OS image', 'An Archipelago system image.'];
|
||||
const card = document.createElement('article'); card.className = 'release';
|
||||
const top = document.createElement('div'); top.className = 'release-top';
|
||||
|
|
@ -86,5 +103,21 @@
|
|||
return card;
|
||||
});
|
||||
list.replaceChildren(...cards);
|
||||
} catch { message('Release registry temporarily unavailable. Download links will return when the catalog can be verified.'); }
|
||||
lastCatalog = identity;
|
||||
} catch {
|
||||
if (lastCatalog === undefined) message('Release registry temporarily unavailable. Download links will return when the catalog can be verified.');
|
||||
else {
|
||||
notice.textContent = 'Registry refresh unavailable. Showing the last verified versions; download links remain pinned to those builds.';
|
||||
notice.hidden = false;
|
||||
}
|
||||
} finally { inFlight = false; }
|
||||
}
|
||||
await refresh();
|
||||
async function tick() {
|
||||
if (!document.hidden) await refresh();
|
||||
window.setTimeout(tick, 30000);
|
||||
}
|
||||
window.setTimeout(tick, 30000);
|
||||
document.addEventListener('visibilitychange', () => { if (!document.hidden) refresh(); });
|
||||
window.addEventListener('focus', refresh);
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ h2 { font-size: 24px; line-height: 1.4; letter-spacing: -1px; margin: 12px 0; }
|
|||
.hash span { display: block; color: var(--accent); letter-spacing: 1px; margin-bottom: 5px; }
|
||||
.hash code { font: inherit; }
|
||||
.empty { grid-column: 1 / -1; color: var(--muted); border: 1px dashed var(--line); padding: 25px; }
|
||||
.registry-notice { color: var(--muted); font-size: 11px; border-left: 2px solid var(--accent); padding-left: 12px; }
|
||||
.release-notes { display: grid; grid-template-columns: 1.5fr 1fr; gap: 35px; margin-top: 20px; color: var(--muted); font-size: 10px; }
|
||||
.note-label { display: block; color: var(--ink); letter-spacing: 1px; margin-bottom: 7px; }
|
||||
.about { border-top: 1px solid var(--line); padding: 45px 0 60px; display: grid; grid-template-columns: 1fr 1fr; gap: 50px; }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue