ZDDC/website/bootstrap/level1/archive.html
ZDDC 916e53d873 feat(install): replace .zip downloads with copy-paste shell snippets
The "Install on your server" section of the home page now prints four
short shell snippets — copy-paste into a terminal, files land in CWD.
Each uses curl to fetch the relevant bootstrap files; nothing else to
install:

  1. Self-contained:    fetches the 5 current-stable tool HTMLs into CWD
                        plus a _template/ directory of level-1 stubs.
                        ~1.8 MB on disk; no runtime dependency on the
                        site after install.
  2. Track stable:      fetches 5 tiny level-2 stubs (~10 KB total)
                        that fetch zddc.varasys.io's stable channel
                        on every page load.
  3. Track beta:        same, for beta.
  4. Track alpha:       same, for alpha.

Each snippet card explains when/why to use that option directly inline.

Implementation:
  - build.sh now produces website/bootstrap/level1/<tool>.html and
    website/bootstrap/track-{alpha,beta,stable}/<tool>.html as
    standalone files (rather than packaging them into zips).
  - install.zip and track-{alpha,beta,stable}.zip are removed; the
    snippets curl the per-channel stubs directly.
  - Docs updated: README, ARCHITECTURE, CLAUDE, AGENTS, bootstrap/README,
    zddc/README, landing/build.sh comment.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 13:30:32 -05:00

74 lines
3.2 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Loading Archive…</title>
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCI+CiAgPHJlY3Qgd2lkdGg9IjY0IiBoZWlnaHQ9IjY0IiByeD0iMTIiIGZpbGw9IiMxZTNhNWYiLz4KICA8ZyBmaWxsPSIjZmZmIj4KICAgIDxyZWN0IHg9IjE0IiB5PSIxOCIgd2lkdGg9IjM2IiBoZWlnaHQ9IjciLz4KICAgIDxwb2x5Z29uIHBvaW50cz0iNDMsMjUgNTAsMjUgMjEsNDMgMTQsNDMiLz4KICAgIDxyZWN0IHg9IjE0IiB5PSI0MyIgd2lkdGg9IjM2IiBoZWlnaHQ9IjciLz4KICA8L2c+Cjwvc3ZnPgo=">
<style>html,body{margin:0;font:14px system-ui,sans-serif;color:#666;padding:1rem}</style>
</head>
<body>
Loading…
<script>
// Level-1 bootstrap. Fetches the tool from the deployment root (same
// origin) and document.write()s it in place. The target may be the real
// built tool HTML or a level-2 bootstrap that fetches from upstream.
//
// URL parameter ?v= selects a specific version or channel:
// ?v=0.0.4 (or v0.0.4) tries ../archive_v0.0.4.html locally
// ?v=alpha|beta|stable tries ../archive_<channel>.html locally
// (none) fetches ../archive.html (default)
//
// If the requested version is not staged locally, falls back to the
// root entry (../archive.html) — which, if it is a level-2 stub,
// forwards the param upstream to zddc.varasys.io. So ?v=0.0.4 works
// whether admins staged it locally OR a level-2 stub is at root.
//
// To pin this single tool to a fixed version permanently, replace the
// `fallback` constant below with an absolute URL like
// https://zddc.varasys.io/releases/archive_v0.0.4.html.
(async function () {
const params = new URLSearchParams(location.search);
const v = params.get('v');
const tool = 'archive';
const channels = { alpha: '_alpha', beta: '_beta', stable: '_stable' };
function suffixFor(value) {
if (!value) return '';
if (value in channels) return channels[value];
const ver = value.startsWith('v') ? value.slice(1) : value;
return '_v' + ver;
}
const versioned = '../' + tool + suffixFor(v) + '.html';
const fallback = '../' + tool + '.html';
async function fetchHTML(url) {
const resp = await fetch(url, { cache: 'no-cache', credentials: 'omit' });
if (!resp.ok) throw new Error(resp.status + ' ' + resp.statusText);
return resp.text();
}
try {
let html;
if (v && versioned !== fallback) {
try {
html = await fetchHTML(versioned);
} catch (_) {
// Versioned copy not staged locally — let the root entry forward
// the request (level-2 stub will see ?v= and fetch upstream).
html = await fetchHTML(fallback);
}
} else {
html = await fetchHTML(fallback);
}
document.open();
document.write(html);
document.close();
} catch (err) {
document.body.textContent = 'Failed to load Archive: ' + err.message;
}
})();
</script>
</body>
</html>