Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
Guestbook: re-shell onto the fresh shell every release (never lags again)
nyblnetb2ae68cb77bc
diff --git a/scripts/publish-site.mjs b/scripts/publish-site.mjsindex 6606261f..bf152c5e 100755--- a/scripts/publish-site.mjs+++ b/scripts/publish-site.mjs@@ -54,12 +54,12 @@ if (doGallery) {}// ---- gate: example decks MUST embed the shell being published ---------------// The gallery templates and the 404 deck EMBED the shell, so they have to be-// rebuilt whenever the shell changes (release.mjs does this). Enforce it: hash+// The gallery templates, the 404 deck AND the guestbook EMBED the shell, so+// they have to be rebuilt/re-shelled whenever the shell changes (release.mjs+// does this — the guestbook is re-shelled in place, preserving its room). Hash// the shell's app payload (the bento/deflate-b64 blocks) and refuse to publish-// if any example deck carries a different one — otherwise a stale gallery would-// ship on top of a fresh shell. (The guestbook is intentionally excluded — it's-// managed by its own daemon/epochs and may lag.)+// if any embedded-shell deck carries a different one — otherwise a stale deck+// would ship on top of a fresh shell.const shellFile = join(site, 'releases/slides/Bento_Slides.bento.html')if (existsSync(shellFile)) {const appHash = (file) => {@@ -71,6 +71,7 @@ if (existsSync(shellFile)) {const decks = [...(existsSync(galleryDir) ? readdirSync(galleryDir).filter((f) => f.endsWith('.bento.html')).map((f) => join(galleryDir, f)) : []),join(site, '404.bento.html'),+ join(site, 'guestbook.bento.html'),].filter(existsSync)const stale = decks.filter((d) => appHash(d) !== shellHash)if (stale.length) {diff --git a/scripts/release.mjs b/scripts/release.mjsindex a1304723..341d5f1c 100644--- a/scripts/release.mjs+++ b/scripts/release.mjs@@ -22,6 +22,7 @@ import { execFileSync } from 'node:child_process'import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'import { join, dirname } from 'node:path'import { fileURLToPath } from 'node:url'+import { spliceDoc } from './guestbook-deck.mjs'const root = dirname(dirname(fileURLToPath(import.meta.url)))const args = process.argv.slice(2)@@ -121,10 +122,23 @@ execFileSync('node', [join(root, 'scripts/build-qr-page.mjs'), join(site, 'q/ind// delete that file and re-release.const guestbook = join(root, 'working/guestbook-live/guestbook.bento.html')if (existsSync(guestbook)) {+ // RE-SHELL the current epoch onto the freshly-built shell (don't just copy a+ // deck that may embed an old shell). The document — room creds, docId, wall+ // seed — is shell-independent, so re-splicing it into the new shell keeps the+ // SAME live room and walls while updating the runtime. This is why the+ // guestbook never lags a release. (An epoch ROLL, with fresh creds, is a+ // separate deliberate act: scripts/build-guestbook.mjs / the daemon.)+ const freshShell = readFileSync(join(site, 'releases/slides/Bento_Slides.bento.html'), 'utf8')+ const gbHtml = readFileSync(guestbook, 'utf8')+ const m = gbHtml.match(/<script type="application\/bento\+json" id="bento-doc">\s*([\s\S]*?)\s*<\/script>/)+ if (!m) throw new Error('guestbook: no #bento-doc block in working/guestbook-live/')+ const gbDoc = JSON.parse(m[1].replace(/\\u003c/g, '<'))+ const reshelled = spliceDoc(freshShell, gbDoc)+ writeFileSync(guestbook, reshelled) // keep the working epoch file on the fresh shell toocpSync(guestbook, join(site, 'guestbook.bento.html'))mkdirSync(join(site, 'guestbook'), { recursive: true })cpSync(join(root, 'site-src/guestbook.html'), join(site, 'guestbook/index.html'))- console.log('guestbook: shipped current epoch')+ console.log(`guestbook: re-shelled current epoch onto the fresh shell (room ${gbDoc.collab?.room?.split('/').pop() ?? '?'})`)} else {console.log('guestbook: not armed (working/guestbook-live/ empty) — skipped')}