Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
v0.9.1: gate live-by-default so the demo does not phone home
nyblnet7a378660e39e
diff --git a/CLAUDE.md b/CLAUDE.mdindex 1691e282..14d7d18a 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -48,8 +48,14 @@ One HTML file = the document + viewer + editor. See `README.md` for the vision.self-update keep writing encrypted (save.ts serializeAuto/serializeDocIntoare THE encryption-aware paths; serializeFile stays plain for tooling).Splice contract intact: the envelope is still plaintext JSON in the block.- mintCollab now defaults on:true — decks are LIVE from creation ("Stop- sharing" opts out; Offline mode hard-blocks regardless).+ mintCollab now mints on:true (decks are eligible to be live from creation)+ — BUT auto-connect-on-open is gated by SyncSession.shareEligible():+ connect only if the doc ARRIVED carrying collab (a saved/shared file) OR+ the user opted in this session (saved, or "Start live session" →+ enableSharing()). A never-saved starter/template stays dormant so the+ anonymous bento.page/slides demo and template tire-kickers never phone+ home (v0.9.1 fix — v0.9.0 connected every visitor). "Stop sharing" opts+ out; Offline mode hard-blocks regardless.- `src/update.ts` — signed self-update: checks a release manifest at LAUNCHby default (localStorage 'bento-auto-check'='off' disables; toggle in theAbout dialog; found updates badge the topbar sync button) and on demand viadiff --git a/slides/package.json b/slides/package.jsonindex 274655da..0aa2ea17 100644--- a/slides/package.json+++ b/slides/package.json@@ -1,7 +1,7 @@{"name": "bento-slides","private": true,- "version": "0.9.0",+ "version": "0.9.1","type": "module","scripts": {"dev": "vite",diff --git a/slides/src/editor/editor.ts b/slides/src/editor/editor.tsindex aa2c1888..fa1f68ec 100644--- a/slides/src/editor/editor.ts+++ b/slides/src/editor/editor.ts@@ -90,15 +90,20 @@ export class Editor {this.canvas.onTextEditChange = (elId) => session.setEditing(elId)this.store.on('current', () => this.canvas.setRemotePeers(session.peers()))// a document that carries collab config joins its relay session — at- // boot AND whenever one is loaded (Replace-from-JSON, update splice…)- const joinIfShared = () => {- if (sharingOn(this.store) && !onlineTransport()) {- joinFromDoc(session, this.store)- this.wireOnlineStatus()- }+ // boot AND whenever one is loaded (Replace-from-JSON, update splice…),+ // but only when it is share-eligible (arrived with creds, or the user+ // opted in). A never-saved demo/template stays off the relay.+ this.tryJoin()+ this.store.on('doc', () => this.tryJoin())+ }++ /** Connect to the relay if the current doc is live AND share-eligible. */+ private tryJoin() {+ if (!this.session) return+ if (sharingOn(this.store) && this.session.shareEligible() && !onlineTransport()) {+ joinFromDoc(this.session, this.store)+ this.wireOnlineStatus()}- joinIfShared()- this.store.on('doc', joinIfShared)}private wireOnlineStatus() {@@ -588,6 +593,7 @@ export class Editor {note(t('Everything is end-to-end encrypted — the relay only ever sees ciphertext.'))action(t('Start live session'), true, () => {if (!this.session) return+ this.session.enableSharing()startSharing(this.session, this.store)this.wireOnlineStatus()this.renderSharePanel()@@ -985,6 +991,11 @@ export class Editor {const result = await saveFile(this.store.doc, forcePicker)if (result === 'cancelled') returnthis.store.setDirty(false)+ // Saving is the opt-in: a named, saved deck is "live by default" from+ // now on (the recipient of a copy already joins on open). Connect this+ // session too so author and recipient meet without another click.+ this.session?.enableSharing()+ this.tryJoin()this.toast(result === 'downloaded'? t('This browser can’t rewrite files in place — a fresh copy went to Downloads'): t('Saved'))@@ -1263,8 +1274,8 @@ export class Editor {setOffline(offCb.checked)if (offCb.checked) {if (this.session) disconnectOnline(this.session)- } else if (this.session && sharingOn(this.store)) {- joinFromDoc(this.session, this.store)+ } else {+ this.tryJoin() // re-enabling network re-connects only if share-eligible}this.wireOnlineStatus()this.toast(diff --git a/slides/src/sync/session.ts b/slides/src/sync/session.tsindex 6bc0b984..0b2c3f58 100644--- a/slides/src/sync/session.ts+++ b/slides/src/sync/session.ts@@ -130,12 +130,34 @@ export class SyncSession {/** a restored offline fork still owes the room its snapshot */private forkPending = false+ /** the loaded doc arrived carrying collab creds (was saved/shared) */+ private bornWithCollab = false+ /** the user opted in this session (saved, or hit "Start live session") */+ private explicitShare = false++ /** Should this doc auto-connect to the relay on open? See attach(). */+ shareEligible(): boolean {+ return this.bornWithCollab || this.explicitShare+ }++ /** Mark that the user opted into sharing (save / explicit Start live). */+ enableSharing() {+ this.explicitShare = true+ }+private attach() {this.docId = this.store.doc.docIdconst doc = this.store.doc- // credentials are minted AT CREATION (Andy's call): any copy of the- // file can join once sharing is turned on — "send first, share later"- // just works. Dormant (on:false) until the Share button flips it.+ // Auto-connect eligibility: a doc that ARRIVED carrying collab creds was+ // saved/shared by someone — it should go live on open. A doc we mint creds+ // for right now (the anonymous starter demo, a fresh template instance) is+ // NOT auto-connected — it phones home only after the user saves or clicks+ // "Start live session" (enableSharing). This keeps casual visitors off the+ // relay and honours "nothing phones home unless you ask".+ this.bornWithCollab = !!doc.collab+ this.explicitShare = false+ // credentials are minted AT CREATION: any copy of the file can join once+ // it is live (on:true by default). See eligibility gate above.if (!doc.collab) doc.collab = mintCollab()const saved = doc.collab?.syncif (saved && saved.v === SYNC_V) {