Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
v0.9.0: live by default, read-only player files, password encryption
nyblnet6ab51446772a
diff --git a/CLAUDE.md b/CLAUDE.mdindex 04367f37..1691e282 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -40,6 +40,16 @@ One HTML file = the document + viewer + editor. See `README.md` for the vision.visually on canvas (`editor/patheditor.ts`): draggable anchors auto-smoothedCatmull-Rom→cubic bezier; the stored path is RELATIVE to the element's restposition (first anchor = rest position; committing moves the element there).+- **File modes (v0.9.0)**: `doc.readonly` = PLAYER file (boots straight into+ the show; exit lands on a minimal card, never the editor; "Save read-only+ copy…" strips collab). Password encryption: the #bento-doc block can hold a+ `bento/enc` envelope (PBKDF2-SHA-256 300k + AES-GCM-256 over the doc JSON) —+ boot shows a password gate; the password is held in memory so ⌘S and+ self-update keep writing encrypted (save.ts serializeAuto/serializeDocInto+ are 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).- `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/docs/agents.md b/docs/agents.mdindex c3324998..9fbc07ce 100644--- a/docs/agents.md+++ b/docs/agents.md@@ -105,6 +105,8 @@ Two ways to work with it:- Don't invent property names — unknown keys are ignored, so a typo meansyour styling silently doesn't apply.- `docId` is the document's identity — never regenerate it when editing.+- `readonly: true` makes a PLAYER file — it boots straight into the+ presentation with no editor. Set it only on hand-out copies.- If `template: true` is set, every open mints a fresh document (that's fordistributable templates; remove it for a personal deck).- Charts degrade gracefully but exotic ECharts config is ignored — keepdiff --git a/slides/package.json b/slides/package.jsonindex c84abd57..274655da 100644--- a/slides/package.json+++ b/slides/package.json@@ -1,7 +1,7 @@{"name": "bento-slides","private": true,- "version": "0.8.12",+ "version": "0.9.0","type": "module","scripts": {"dev": "vite",diff --git a/slides/src/editor/editor.ts b/slides/src/editor/editor.tsindex d3d46316..aa2c1888 100644--- a/slides/src/editor/editor.ts+++ b/slides/src/editor/editor.ts@@ -14,7 +14,7 @@ import { renderSlide, renderThumbnail } from '../render'import { SlideCanvas } from './canvas'import { PropsPanel } from './panels'import { startPresentation } from '../present'-import { saveFile, serializeFile, writeUpdatedFileAs } from '../save'+import { isEncryptionActive, saveFile, serializeAuto, serializeFile, setEncryptionPassword, writeUpdatedFileAs } from '../save'import { ICONS } from '../icons'import { t, setLocale, locale, LOCALE_CHOICES } from '../i18n'import { disconnectOnline, joinFromDoc, mintCollab, onlineTransport, rotateKeys, sharingOn, startSharing, stopSharing } from '../sync/online'@@ -352,9 +352,11 @@ export class Editor {private saveDropdown(): HTMLElement {const wrap = div('ed-dropdown')- const trigger = btn(ICONS.download, '', () => wrap.classList.toggle('open'),- t('More ways to save — copy, new deck, template'))const menu = div('ed-menu ed-save-menu')+ const trigger = btn(ICONS.download, '', () => {+ wrap.classList.toggle('open')+ if (wrap.classList.contains('open')) rebuild()+ }, t('More ways to save — copy, new deck, template, read-only, encrypted'))const item = (label: string, title: string, onClick: () => void) => {const b = document.createElement('button')b.className = 'ed-btn'@@ -366,15 +368,37 @@ export class Editor {})menu.appendChild(b)}- item(t('Save a copy'),- t('Pick a new file, leave this one untouched — a copy of a shared deck joins the same live session.'),- () => void this.save(true))- item(t('Save as new deck…'),- t('Same content, brand-new document — its own identity and keys; it will never sync with this one.'),- () => this.saveAsNewDeck())- item(t('Save as template…'),- t('Saves a template copy: everyone who opens it gets a fresh, independent deck with its own identity and keys.'),- () => void this.saveAsTemplate())+ const rebuild = () => {+ menu.textContent = ''+ item(t('Save a copy'),+ t('Pick a new file, leave this one untouched — a copy of a shared deck joins the same live session.'),+ () => void this.save(true))+ item(t('Save as new deck…'),+ t('Same content, brand-new document — its own identity and keys; it will never sync with this one.'),+ () => this.saveAsNewDeck())+ item(t('Save as template…'),+ t('Saves a template copy: everyone who opens it gets a fresh, independent deck with its own identity and keys.'),+ () => void this.saveAsTemplate())+ item(t('Save read-only copy…'),+ t('A locked hand-out: it opens straight into the show — viewing and presenting only, no editor, no live session.'),+ () => void this.saveReadonlyCopy())+ if (isEncryptionActive()) {+ item(t('Change password…'),+ t('Pick a new password for this file — takes effect on the next save.'),+ () => void this.setFilePassword())+ item(t('Remove password'),+ t('Stop encrypting this file — the next save writes it as plain, readable JSON again.'),+ () => {+ setEncryptionPassword(null)+ this.toast(t('Password removed — the next save writes an unencrypted file'))+ void this.save(false)+ })+ } else {+ item(t('Encrypt with password…'),+ t('Protect this file with a password: the document (collaboration keys included) is encrypted at rest with AES-256. The password cannot be recovered.'),+ () => void this.setFilePassword())+ }+ }wrap.append(trigger, menu)document.addEventListener('pointerdown', (ev) => {if (!wrap.contains(ev.target as Node)) wrap.classList.remove('open')@@ -382,6 +406,67 @@ export class Editor {return wrap}+ /** Save a locked hand-out copy: player file, no editor, no live session. */+ private async saveReadonlyCopy() {+ const clone = JSON.parse(JSON.stringify(this.store.doc)) as import('../model').BentoDoc+ clone.readonly = true+ delete clone.collab // a hand-out must not join (or leak) the live room+ try {+ const ok = await writeUpdatedFileAs(await serializeAuto(clone), clone)+ if (ok) this.toast(t('Read-only copy saved — it opens straight into the show'))+ } catch {+ this.toast(t('Saving failed'))+ }+ }++ /** Set or change the encryption password (double-entry dialog). */+ private async setFilePassword() {+ const pass = await this.promptPassword()+ if (pass === null) return+ setEncryptionPassword(pass)+ this.toast(t('Encrypted — remember this password; it cannot be recovered'))+ void this.save(true)+ }++ private promptPassword(): Promise<string | null> {+ return new Promise((resolve) => {+ const dlg = document.createElement('dialog')+ dlg.className = 'ed-dialog ed-pwdialog'+ dlg.innerHTML =+ `<h2>${t('Encrypt with password…').replace(/…$/, '')}</h2>` ++ `<p>${t('The password cannot be recovered — if it is lost, the file is lost.')}</p>` ++ `<label>${t('Password')}<input type="password" class="pw1" autocomplete="new-password"></label>` ++ `<label>${t('Confirm password')}<input type="password" class="pw2" autocomplete="new-password"></label>` ++ `<div class="ed-pwerr"></div>` ++ `<div class="ed-dialog-actions"><button class="cancel">${t('Cancel')}</button>` ++ `<button class="ok ed-primary">${t('Set password')}</button></div>`+ document.body.appendChild(dlg)+ const pw1 = dlg.querySelector<HTMLInputElement>('.pw1')!+ const pw2 = dlg.querySelector<HTMLInputElement>('.pw2')!+ const err = dlg.querySelector<HTMLElement>('.ed-pwerr')!+ const done = (v: string | null) => {+ dlg.close()+ dlg.remove()+ resolve(v)+ }+ dlg.querySelector('.cancel')!.addEventListener('click', () => done(null))+ dlg.querySelector('.ok')!.addEventListener('click', () => {+ if (!pw1.value) {+ err.textContent = t('Password')+ return+ }+ if (pw1.value !== pw2.value) {+ err.textContent = t('Passwords do not match')+ return+ }+ done(pw1.value)+ })+ dlg.addEventListener('cancel', () => done(null))+ dlg.showModal()+ pw1.focus()+ })+ }+private saveAsNewDeck() {const clone = JSON.parse(JSON.stringify(this.store.doc)) as import('../model').BentoDocclone.docId = newDocId()diff --git a/slides/src/i18n/de.ts b/slides/src/i18n/de.tsindex 75bceb01..abbbe489 100644--- a/slides/src/i18n/de.ts+++ b/slides/src/i18n/de.ts@@ -275,7 +275,6 @@ export const de: Catalog = {"Hide slide list ([)": "Folienliste ausblenden ([)","Show properties (])": "Eigenschaften einblenden (])","Hide properties (])": "Eigenschaften ausblenden (])",- "More ways to save — copy, new deck, template": "Weitere Speicheroptionen — Kopie, neues Deck, Vorlage","Save a copy": "Kopie speichern","Pick a new file, leave this one untouched — a copy of a shared deck joins the same live session.": "Neue Datei wählen, diese bleibt unberührt — die Kopie eines geteilten Decks tritt derselben Live-Sitzung bei.","Save as new deck…": "Als neues Deck speichern…",@@ -295,4 +294,28 @@ export const de: Catalog = {"A4 landscape": "A4 quer","A4 portrait": "A4 hoch","Custom…": "Benutzerdefiniert…",+ "This file is encrypted.": "Diese Datei ist verschlüsselt.",+ "Enter password to open this deck": "Passwort eingeben, um diese Präsentation zu öffnen",+ "Unlock": "Entsperren",+ "Wrong password — try again": "Falsches Passwort — bitte erneut versuchen",+ "This deck is read-only.": "Diese Präsentation ist schreibgeschützt.",+ "More ways to save — copy, new deck, template, read-only, encrypted": "Weitere Speicheroptionen — Kopie, neue Präsentation, Vorlage, schreibgeschützt, verschlüsselt",+ "Save read-only copy…": "Schreibgeschützte Kopie speichern…",+ "A locked hand-out: it opens straight into the show — viewing and presenting only, no editor, no live session.": "Eine gesperrte Weitergabe-Kopie: öffnet direkt in der Vorführung — nur ansehen und präsentieren, kein Editor, keine Live-Sitzung.",+ "Read-only copy saved — it opens straight into the show": "Schreibgeschützte Kopie gespeichert — sie öffnet direkt in der Vorführung",+ "Saving failed": "Speichern fehlgeschlagen",+ "Encrypt with password…": "Mit Passwort verschlüsseln…",+ "Protect this file with a password: the document (collaboration keys included) is encrypted at rest with AES-256. The password cannot be recovered.": "Diese Datei mit einem Passwort schützen: das Dokument (inklusive Kollaborations-Schlüssel) wird mit AES-256 verschlüsselt gespeichert. Das Passwort kann nicht wiederhergestellt werden.",+ "Change password…": "Passwort ändern…",+ "Pick a new password for this file — takes effect on the next save.": "Neues Passwort für diese Datei wählen — gilt ab dem nächsten Speichern.",+ "Remove password": "Passwort entfernen",+ "Stop encrypting this file — the next save writes it as plain, readable JSON again.": "Diese Datei nicht mehr verschlüsseln — beim nächsten Speichern wird wieder lesbares JSON geschrieben.",+ "Password removed — the next save writes an unencrypted file": "Passwort entfernt — beim nächsten Speichern wird unverschlüsselt geschrieben",+ "Encrypted — remember this password; it cannot be recovered": "Verschlüsselt — merken Sie sich dieses Passwort; es kann nicht wiederhergestellt werden",+ "The password cannot be recovered — if it is lost, the file is lost.": "Das Passwort kann nicht wiederhergestellt werden — geht es verloren, ist die Datei verloren.",+ "Password": "Passwort",+ "Confirm password": "Passwort bestätigen",+ "Passwords do not match": "Passwörter stimmen nicht überein",+ "Cancel": "Abbrechen",+ "Set password": "Passwort festlegen",}diff --git a/slides/src/i18n/es.ts b/slides/src/i18n/es.tsindex 6408e8ca..56a82da7 100644--- a/slides/src/i18n/es.ts+++ b/slides/src/i18n/es.ts@@ -275,7 +275,6 @@ export const es: Catalog = {"Hide slide list ([)": "Ocultar lista de diapositivas ([)","Show properties (])": "Mostrar propiedades (])","Hide properties (])": "Ocultar propiedades (])",- "More ways to save — copy, new deck, template": "Más formas de guardar: copia, presentación nueva, plantilla","Save a copy": "Guardar una copia","Pick a new file, leave this one untouched — a copy of a shared deck joins the same live session.": "Elige un archivo nuevo sin tocar este: una copia de una presentación compartida se une a la misma sesión en vivo.","Save as new deck…": "Guardar como presentación nueva…",@@ -295,4 +294,28 @@ export const es: Catalog = {"A4 landscape": "A4 horizontal","A4 portrait": "A4 vertical","Custom…": "Personalizado…",+ "This file is encrypted.": "Este archivo está cifrado.",+ "Enter password to open this deck": "Introduce la contraseña para abrir esta presentación",+ "Unlock": "Desbloquear",+ "Wrong password — try again": "Contraseña incorrecta: inténtalo de nuevo",+ "This deck is read-only.": "Esta presentación es de solo lectura.",+ "More ways to save — copy, new deck, template, read-only, encrypted": "Más formas de guardar: copia, nueva presentación, plantilla, solo lectura, cifrado",+ "Save read-only copy…": "Guardar copia de solo lectura…",+ "A locked hand-out: it opens straight into the show — viewing and presenting only, no editor, no live session.": "Una copia bloqueada para repartir: se abre directamente en la presentación — solo ver y presentar, sin editor ni sesión en vivo.",+ "Read-only copy saved — it opens straight into the show": "Copia de solo lectura guardada: se abre directamente en la presentación",+ "Saving failed": "Error al guardar",+ "Encrypt with password…": "Cifrar con contraseña…",+ "Protect this file with a password: the document (collaboration keys included) is encrypted at rest with AES-256. The password cannot be recovered.": "Protege este archivo con una contraseña: el documento (claves de colaboración incluidas) se cifra en reposo con AES-256. La contraseña no se puede recuperar.",+ "Change password…": "Cambiar contraseña…",+ "Pick a new password for this file — takes effect on the next save.": "Elige una nueva contraseña para este archivo: se aplica en el próximo guardado.",+ "Remove password": "Quitar contraseña",+ "Stop encrypting this file — the next save writes it as plain, readable JSON again.": "Dejar de cifrar este archivo: el próximo guardado lo escribe de nuevo como JSON legible.",+ "Password removed — the next save writes an unencrypted file": "Contraseña eliminada: el próximo guardado escribe un archivo sin cifrar",+ "Encrypted — remember this password; it cannot be recovered": "Cifrado: recuerda esta contraseña; no se puede recuperar",+ "The password cannot be recovered — if it is lost, the file is lost.": "La contraseña no se puede recuperar: si se pierde, el archivo se pierde.",+ "Password": "Contraseña",+ "Confirm password": "Confirmar contraseña",+ "Passwords do not match": "Las contraseñas no coinciden",+ "Cancel": "Cancelar",+ "Set password": "Establecer contraseña",}diff --git a/slides/src/i18n/fr.ts b/slides/src/i18n/fr.tsindex 50ef7407..283bb2fb 100644--- a/slides/src/i18n/fr.ts+++ b/slides/src/i18n/fr.ts@@ -275,7 +275,6 @@ export const fr: Catalog = {"Hide slide list ([)": "Masquer la liste des diapositives ([)","Show properties (])": "Afficher les propriétés (])","Hide properties (])": "Masquer les propriétés (])",- "More ways to save — copy, new deck, template": "Autres façons d'enregistrer — copie, nouveau diaporama, modèle","Save a copy": "Enregistrer une copie","Pick a new file, leave this one untouched — a copy of a shared deck joins the same live session.": "Choisissez un nouveau fichier sans toucher celui-ci — la copie d'un diaporama partagé rejoint la même session en direct.","Save as new deck…": "Enregistrer comme nouveau diaporama…",@@ -295,4 +294,28 @@ export const fr: Catalog = {"A4 landscape": "A4 paysage","A4 portrait": "A4 portrait","Custom…": "Personnalisé…",+ "This file is encrypted.": "Ce fichier est chiffré.",+ "Enter password to open this deck": "Saisissez le mot de passe pour ouvrir cette présentation",+ "Unlock": "Déverrouiller",+ "Wrong password — try again": "Mot de passe incorrect — réessayez",+ "This deck is read-only.": "Cette présentation est en lecture seule.",+ "More ways to save — copy, new deck, template, read-only, encrypted": "Plus de façons d'enregistrer — copie, nouvelle présentation, modèle, lecture seule, chiffré",+ "Save read-only copy…": "Enregistrer une copie en lecture seule…",+ "A locked hand-out: it opens straight into the show — viewing and presenting only, no editor, no live session.": "Une copie verrouillée à distribuer : elle s'ouvre directement sur la présentation — visionnage et présentation uniquement, sans éditeur ni session en direct.",+ "Read-only copy saved — it opens straight into the show": "Copie en lecture seule enregistrée — elle s'ouvre directement sur la présentation",+ "Saving failed": "Échec de l'enregistrement",+ "Encrypt with password…": "Chiffrer avec un mot de passe…",+ "Protect this file with a password: the document (collaboration keys included) is encrypted at rest with AES-256. The password cannot be recovered.": "Protégez ce fichier par un mot de passe : le document (clés de collaboration comprises) est chiffré au repos en AES-256. Le mot de passe ne peut pas être récupéré.",+ "Change password…": "Changer le mot de passe…",+ "Pick a new password for this file — takes effect on the next save.": "Choisissez un nouveau mot de passe pour ce fichier — effectif au prochain enregistrement.",+ "Remove password": "Supprimer le mot de passe",+ "Stop encrypting this file — the next save writes it as plain, readable JSON again.": "Ne plus chiffrer ce fichier — le prochain enregistrement l'écrira de nouveau en JSON lisible.",+ "Password removed — the next save writes an unencrypted file": "Mot de passe supprimé — le prochain enregistrement écrira un fichier non chiffré",+ "Encrypted — remember this password; it cannot be recovered": "Chiffré — retenez ce mot de passe ; il ne peut pas être récupéré",+ "The password cannot be recovered — if it is lost, the file is lost.": "Le mot de passe ne peut pas être récupéré — s'il est perdu, le fichier l'est aussi.",+ "Password": "Mot de passe",+ "Confirm password": "Confirmer le mot de passe",+ "Passwords do not match": "Les mots de passe ne correspondent pas",+ "Cancel": "Annuler",+ "Set password": "Définir le mot de passe",}diff --git a/slides/src/i18n/it.ts b/slides/src/i18n/it.tsindex b8dfd45a..d8ba3f6c 100644--- a/slides/src/i18n/it.ts+++ b/slides/src/i18n/it.ts@@ -275,7 +275,6 @@ export const it: Catalog = {"Hide slide list ([)": "Nascondi elenco diapositive ([)","Show properties (])": "Mostra proprietà (])","Hide properties (])": "Nascondi proprietà (])",- "More ways to save — copy, new deck, template": "Altri modi per salvare: copia, nuova presentazione, modello","Save a copy": "Salva una copia","Pick a new file, leave this one untouched — a copy of a shared deck joins the same live session.": "Scegli un nuovo file lasciando intatto questo: la copia di una presentazione condivisa si unisce alla stessa sessione dal vivo.","Save as new deck…": "Salva come nuova presentazione…",@@ -295,4 +294,28 @@ export const it: Catalog = {"A4 landscape": "A4 orizzontale","A4 portrait": "A4 verticale","Custom…": "Personalizzato…",+ "This file is encrypted.": "Questo file è cifrato.",+ "Enter password to open this deck": "Inserisci la password per aprire questa presentazione",+ "Unlock": "Sblocca",+ "Wrong password — try again": "Password errata — riprova",+ "This deck is read-only.": "Questa presentazione è di sola lettura.",+ "More ways to save — copy, new deck, template, read-only, encrypted": "Altri modi per salvare — copia, nuova presentazione, modello, sola lettura, cifrato",+ "Save read-only copy…": "Salva copia di sola lettura…",+ "A locked hand-out: it opens straight into the show — viewing and presenting only, no editor, no live session.": "Una copia bloccata da distribuire: si apre direttamente nella presentazione — solo visione e presentazione, senza editor né sessione live.",+ "Read-only copy saved — it opens straight into the show": "Copia di sola lettura salvata — si apre direttamente nella presentazione",+ "Saving failed": "Salvataggio non riuscito",+ "Encrypt with password…": "Cifra con password…",+ "Protect this file with a password: the document (collaboration keys included) is encrypted at rest with AES-256. The password cannot be recovered.": "Proteggi questo file con una password: il documento (chiavi di collaborazione incluse) è cifrato a riposo con AES-256. La password non può essere recuperata.",+ "Change password…": "Cambia password…",+ "Pick a new password for this file — takes effect on the next save.": "Scegli una nuova password per questo file — attiva dal prossimo salvataggio.",+ "Remove password": "Rimuovi password",+ "Stop encrypting this file — the next save writes it as plain, readable JSON again.": "Smetti di cifrare questo file — il prossimo salvataggio lo scriverà di nuovo come JSON leggibile.",+ "Password removed — the next save writes an unencrypted file": "Password rimossa — il prossimo salvataggio scriverà un file non cifrato",+ "Encrypted — remember this password; it cannot be recovered": "Cifrato — ricorda questa password; non può essere recuperata",+ "The password cannot be recovered — if it is lost, the file is lost.": "La password non può essere recuperata — se la perdi, perdi il file.",+ "Password": "Password",+ "Confirm password": "Conferma password",+ "Passwords do not match": "Le password non coincidono",+ "Cancel": "Annulla",+ "Set password": "Imposta password",}diff --git a/slides/src/i18n/ja.ts b/slides/src/i18n/ja.tsindex b8c9a039..b787d928 100644--- a/slides/src/i18n/ja.ts+++ b/slides/src/i18n/ja.ts@@ -275,7 +275,6 @@ export const ja: Catalog = {"Hide slide list ([)": "スライド一覧を隠す([)","Show properties (])": "プロパティを表示(])","Hide properties (])": "プロパティを隠す(])",- "More ways to save — copy, new deck, template": "その他の保存方法 — コピー・新しいデッキ・テンプレート","Save a copy": "コピーを保存","Pick a new file, leave this one untouched — a copy of a shared deck joins the same live session.": "新しいファイルに保存し、元のファイルは変更しません — 共有中のデッキのコピーは同じライブセッションに参加します。","Save as new deck…": "新しいデッキとして保存…",@@ -295,4 +294,28 @@ export const ja: Catalog = {"A4 landscape": "A4 横","A4 portrait": "A4 縦","Custom…": "カスタム…",+ "This file is encrypted.": "このファイルは暗号化されています。",+ "Enter password to open this deck": "パスワードを入力してこのデッキを開く",+ "Unlock": "ロック解除",+ "Wrong password — try again": "パスワードが違います — もう一度お試しください",+ "This deck is read-only.": "このデッキは読み取り専用です。",+ "More ways to save — copy, new deck, template, read-only, encrypted": "その他の保存方法 — コピー・新規デッキ・テンプレート・読み取り専用・暗号化",+ "Save read-only copy…": "読み取り専用コピーを保存…",+ "A locked hand-out: it opens straight into the show — viewing and presenting only, no editor, no live session.": "配布用のロック済みコピー:開くとそのまま上映されます — 閲覧と発表のみ、エディタなし、ライブセッションなし。",+ "Read-only copy saved — it opens straight into the show": "読み取り専用コピーを保存しました — 開くとそのまま上映されます",+ "Saving failed": "保存に失敗しました",+ "Encrypt with password…": "パスワードで暗号化…",+ "Protect this file with a password: the document (collaboration keys included) is encrypted at rest with AES-256. The password cannot be recovered.": "このファイルをパスワードで保護します:ドキュメント(コラボレーション鍵を含む)は AES-256 で暗号化されて保存されます。パスワードは復元できません。",+ "Change password…": "パスワードを変更…",+ "Pick a new password for this file — takes effect on the next save.": "このファイルの新しいパスワードを設定します — 次回の保存から有効になります。",+ "Remove password": "パスワードを削除",+ "Stop encrypting this file — the next save writes it as plain, readable JSON again.": "このファイルの暗号化を解除します — 次回の保存から再び読み取り可能な JSON になります。",+ "Password removed — the next save writes an unencrypted file": "パスワードを削除しました — 次回の保存から暗号化されないファイルになります",+ "Encrypted — remember this password; it cannot be recovered": "暗号化しました — このパスワードは復元できません。忘れないでください",+ "The password cannot be recovered — if it is lost, the file is lost.": "パスワードは復元できません — 紛失するとファイルも失われます。",+ "Password": "パスワード",+ "Confirm password": "パスワードを確認",+ "Passwords do not match": "パスワードが一致しません",+ "Cancel": "キャンセル",+ "Set password": "パスワードを設定",}diff --git a/slides/src/i18n/zh-Hans.ts b/slides/src/i18n/zh-Hans.tsindex 5e7657c1..d57057b9 100644--- a/slides/src/i18n/zh-Hans.ts+++ b/slides/src/i18n/zh-Hans.ts@@ -275,7 +275,6 @@ export const zhHans: Catalog = {"Hide slide list ([)": "隐藏幻灯片列表([)","Show properties (])": "显示属性面板(])","Hide properties (])": "隐藏属性面板(])",- "More ways to save — copy, new deck, template": "更多保存方式 — 副本、新演示文稿、模板","Save a copy": "保存副本","Pick a new file, leave this one untouched — a copy of a shared deck joins the same live session.": "保存为新文件,原文件保持不变 — 共享演示文稿的副本会加入同一实时会话。","Save as new deck…": "另存为新演示文稿…",@@ -295,4 +294,28 @@ export const zhHans: Catalog = {"A4 landscape": "A4 横向","A4 portrait": "A4 纵向","Custom…": "自定义…",+ "This file is encrypted.": "此文件已加密。",+ "Enter password to open this deck": "输入密码以打开此演示文稿",+ "Unlock": "解锁",+ "Wrong password — try again": "密码错误 — 请重试",+ "This deck is read-only.": "此演示文稿为只读。",+ "More ways to save — copy, new deck, template, read-only, encrypted": "更多保存方式 — 副本、新演示文稿、模板、只读、加密",+ "Save read-only copy…": "保存只读副本…",+ "A locked hand-out: it opens straight into the show — viewing and presenting only, no editor, no live session.": "锁定的分发副本:打开即直接放映 — 仅供查看和演示,无编辑器,无实时会话。",+ "Read-only copy saved — it opens straight into the show": "已保存只读副本 — 打开即直接放映",+ "Saving failed": "保存失败",+ "Encrypt with password…": "使用密码加密…",+ "Protect this file with a password: the document (collaboration keys included) is encrypted at rest with AES-256. The password cannot be recovered.": "使用密码保护此文件:文档(包括协作密钥)以 AES-256 加密存储。密码无法找回。",+ "Change password…": "更改密码…",+ "Pick a new password for this file — takes effect on the next save.": "为此文件选择新密码 — 下次保存时生效。",+ "Remove password": "移除密码",+ "Stop encrypting this file — the next save writes it as plain, readable JSON again.": "停止加密此文件 — 下次保存将再次写入可读的 JSON。",+ "Password removed — the next save writes an unencrypted file": "已移除密码 — 下次保存将写入未加密文件",+ "Encrypted — remember this password; it cannot be recovered": "已加密 — 请牢记此密码;密码无法找回",+ "The password cannot be recovered — if it is lost, the file is lost.": "密码无法找回 — 密码丢失即文件丢失。",+ "Password": "密码",+ "Confirm password": "确认密码",+ "Passwords do not match": "两次输入的密码不一致",+ "Cancel": "取消",+ "Set password": "设置密码",}diff --git a/slides/src/i18n/zh-Hant.ts b/slides/src/i18n/zh-Hant.tsindex 654314dd..38485a4a 100644--- a/slides/src/i18n/zh-Hant.ts+++ b/slides/src/i18n/zh-Hant.ts@@ -275,7 +275,6 @@ export const zhHant: Catalog = {"Hide slide list ([)": "隱藏投影片清單([)","Show properties (])": "顯示屬性面板(])","Hide properties (])": "隱藏屬性面板(])",- "More ways to save — copy, new deck, template": "更多儲存方式 — 副本、新簡報、範本","Save a copy": "儲存副本","Pick a new file, leave this one untouched — a copy of a shared deck joins the same live session.": "儲存為新檔案,原檔案保持不變 — 共用簡報的副本會加入同一即時工作階段。","Save as new deck…": "另存為新簡報…",@@ -295,4 +294,28 @@ export const zhHant: Catalog = {"A4 landscape": "A4 橫向","A4 portrait": "A4 直向","Custom…": "自訂…",+ "This file is encrypted.": "此檔案已加密。",+ "Enter password to open this deck": "輸入密碼以開啟此簡報",+ "Unlock": "解鎖",+ "Wrong password — try again": "密碼錯誤 — 請重試",+ "This deck is read-only.": "此簡報為唯讀。",+ "More ways to save — copy, new deck, template, read-only, encrypted": "更多儲存方式 — 副本、新簡報、範本、唯讀、加密",+ "Save read-only copy…": "儲存唯讀副本…",+ "A locked hand-out: it opens straight into the show — viewing and presenting only, no editor, no live session.": "鎖定的發送副本:開啟即直接放映 — 僅供檢視與簡報,無編輯器、無即時協作。",+ "Read-only copy saved — it opens straight into the show": "已儲存唯讀副本 — 開啟即直接放映",+ "Saving failed": "儲存失敗",+ "Encrypt with password…": "以密碼加密…",+ "Protect this file with a password: the document (collaboration keys included) is encrypted at rest with AES-256. The password cannot be recovered.": "以密碼保護此檔案:文件(包含協作金鑰)以 AES-256 加密儲存。密碼無法復原。",+ "Change password…": "變更密碼…",+ "Pick a new password for this file — takes effect on the next save.": "為此檔案選擇新密碼 — 下次儲存時生效。",+ "Remove password": "移除密碼",+ "Stop encrypting this file — the next save writes it as plain, readable JSON again.": "停止加密此檔案 — 下次儲存將再次寫入可讀的 JSON。",+ "Password removed — the next save writes an unencrypted file": "已移除密碼 — 下次儲存將寫入未加密檔案",+ "Encrypted — remember this password; it cannot be recovered": "已加密 — 請牢記此密碼;密碼無法復原",+ "The password cannot be recovered — if it is lost, the file is lost.": "密碼無法復原 — 密碼遺失即檔案遺失。",+ "Password": "密碼",+ "Confirm password": "確認密碼",+ "Passwords do not match": "兩次輸入的密碼不一致",+ "Cancel": "取消",+ "Set password": "設定密碼",}diff --git a/slides/src/main.ts b/slides/src/main.tsindex 95c816cb..6cbae64d 100644--- a/slides/src/main.ts+++ b/slides/src/main.ts@@ -3,21 +3,111 @@import './styles.css'import { anim } from './anim'-import { capturePristine, readEmbeddedDoc, serializeFile } from './save'+import {+ capturePristine, readEmbeddedDoc, serializeFile, serializeAuto, downloadFile,+ suggestedFileName, parseEnvelope, decryptEnvelope, setEncryptionPassword,+} from './save'import { APP_VERSION, checkForUpdates, buildUpdatedFile, applyUpdate } from './update'-import { i18nApi } from './i18n'-import { parseDoc } from './model'+import { i18nApi, t } from './i18n'+import { parseDoc, type BentoDoc } from './model'import { starterDoc } from './starterdeck'import { injectFonts } from './fonts'import { Store } from './store'import { Editor } from './editor/editor'+import { startPresentation } from './present'import { SyncSession } from './sync/session'import { onlineTransport, startSharing, stopSharing } from './sync/online'capturePristine()+// --- boot gates: password-encrypted files, read-only player files -----------+const embedded = readEmbeddedDoc()-const doc = (embedded && parseDoc(embedded)) || starterDoc()+const envelope = embedded ? parseEnvelope(embedded) : null+if (envelope) {+ void passwordGate()+} else {+ bootWith((embedded && parseDoc(embedded)) || starterDoc())+}++/** Encrypted file: ask for the password (looping on failure), then boot. */+async function passwordGate() {+ const gate = document.createElement('div')+ gate.className = 'ed-pwgate'+ gate.innerHTML =+ `<div class="ed-pwcard"><div class="ed-pwmark">🔒</div>` ++ `<h1>${t('This file is encrypted.')}</h1>` ++ `<p>${t('Enter password to open this deck')}</p>` ++ `<input type="password" autocomplete="current-password">` ++ `<button>${t('Unlock')}</button><div class="ed-pwerr"></div></div>`+ document.body.appendChild(gate)+ document.getElementById('bento-splash')?.remove()+ const input = gate.querySelector('input')!+ const button = gate.querySelector('button')!+ const err = gate.querySelector<HTMLElement>('.ed-pwerr')!+ const tryUnlock = async () => {+ const pass = input.value+ if (!pass) return+ button.setAttribute('disabled', '')+ const json = await decryptEnvelope(envelope!, pass)+ button.removeAttribute('disabled')+ if (json === null) {+ err.textContent = t('Wrong password — try again')+ input.select()+ return+ }+ const doc = parseDoc(json)+ if (!doc) {+ err.textContent = t('Wrong password — try again')+ return+ }+ setEncryptionPassword(pass) // saves + updates keep writing encrypted+ gate.remove()+ bootWith(doc)+ }+ button.addEventListener('click', () => void tryUnlock())+ input.addEventListener('keydown', (e) => {+ if (e.key === 'Enter') void tryUnlock()+ })+ input.focus()+}++function bootWith(doc: BentoDoc) {+ if (doc.readonly) playerMode(doc)+ else editorMode(doc)+}++/**+ * Read-only files are PLAYER files: they open straight into the show and+ * never expose the editor. Leaving the presentation lands on a minimal card.+ */+function playerMode(doc: BentoDoc) {+ document.title = `${doc.title} — Bento Slides`+ if (doc.fonts?.length) injectFonts(doc)+ document.getElementById('bento-splash')?.remove()+ const card = document.createElement('div')+ card.className = 'ed-player'+ card.innerHTML =+ `<div class="ed-playercard"><h1>${doc.title.replace(/</g, '<')}</h1>` ++ `<p>${t('This deck is read-only.')}</p>` ++ `<button class="ed-playgo">▶ ${t('Present')}</button>` ++ `<button class="ed-playcopy">⤓ ${t('Save a copy')}</button></div>`+ document.body.appendChild(card)+ const start = () => {+ card.style.display = 'none'+ startPresentation(doc, 0, () => {+ card.style.display = ''+ })+ }+ card.querySelector('.ed-playgo')!.addEventListener('click', start)+ card.querySelector('.ed-playcopy')!.addEventListener('click', () => {+ void serializeAuto(doc).then((html) => downloadFile(html, suggestedFileName(doc)))+ })+ ;(window as any).bento = { format: doc.format, doc, readonly: true }+ start()+}++function editorMode(doc: BentoDoc) {document.title = `${doc.title} — Bento Slides`@@ -144,3 +234,5 @@ if (location.hash === '#present') {)},}++} // editorModediff --git a/slides/src/model.ts b/slides/src/model.tsindex a5cda9b4..fc665d3a 100644--- a/slides/src/model.ts+++ b/slides/src/model.ts@@ -282,6 +282,12 @@ export interface BentoDoc {* is no file handle until the user's first save-as).*/template?: boolean+ /**+ * A read-only PLAYER file: boots straight into the presentation and never+ * shows the editor. Honor-system (the JSON is right there), but it makes a+ * hand-out copy present-only for everyone who doesn't go digging.+ */+ readonly?: booleanslides: Slide[]modified: string}diff --git a/slides/src/save.ts b/slides/src/save.tsindex 2a1cd3d3..33885a47 100644--- a/slides/src/save.ts+++ b/slides/src/save.ts@@ -25,12 +25,8 @@ export function readEmbeddedDoc(): string | null {return text || null}-/**- * Serialize `doc` into an arbitrary app shell (a parsed Bento HTML document).- * Used with the boot-time pristine copy on every save, and by the self-update- * flow with a freshly fetched NEWER shell — same document, new app around it.- */-export function serializeWith(shell: Document, doc: BentoDoc): string {+/** Serialize a raw data-block body into an app shell. */+function serializeBody(shell: Document, body: string, title: string): string {const clone = shell.cloneNode(true) as Documentlet block = clone.getElementById(DATA_BLOCK_ID)@@ -41,10 +37,10 @@ export function serializeWith(shell: Document, doc: BentoDoc): string {clone.head.appendChild(block)}// <-escape so the JSON can never contain "</script>" and break the file.- block.textContent = '\n' + JSON.stringify(doc).replace(/</g, '\\u003c') + '\n'+ block.textContent = '\n' + body.replace(/</g, '\\u003c') + '\n'- const title = clone.querySelector('title')- if (title) title.textContent = doc.title + ' — Bento Slides'+ const titleEl = clone.querySelector('title')+ if (titleEl) titleEl.textContent = title + ' — Bento Slides'const html = '<!DOCTYPE html>\n' + clone.documentElement.outerHTML// Belt-and-braces: an unescaped close tag anywhere in generated output would@@ -55,12 +51,129 @@ export function serializeWith(shell: Document, doc: BentoDoc): string {return html}-/** The full .bento.html file content with `doc` embedded. */+/**+ * Serialize `doc` into an arbitrary app shell (a parsed Bento HTML document).+ * Used with the boot-time pristine copy on every save, and by the self-update+ * flow with a freshly fetched NEWER shell — same document, new app around it.+ * PLAIN output — encryption-aware callers use serializeDocInto/serializeAuto.+ */+export function serializeWith(shell: Document, doc: BentoDoc): string {+ return serializeBody(shell, JSON.stringify(doc), doc.title)+}++/** The full .bento.html file content with `doc` embedded (plain). */export function serializeFile(doc: BentoDoc): string {if (!pristine) throw new Error('capturePristine() was not called at boot')return serializeWith(pristine, doc)}+// --- password encryption ----------------------------------------------------+//+// An encrypted file keeps the SAME plaintext #bento-doc block (the splice+// contract old updaters rely on) — but the block holds a bento/enc envelope+// instead of the document: AES-GCM-256 over the doc JSON, key derived from+// the password with PBKDF2-SHA-256. The password is held in memory for the+// session so ⌘S and self-update keep writing encrypted output.++export interface EncEnvelope {+ format: 'bento/enc'+ v: 1+ it: number+ salt: string+ iv: string+ data: string+}++const ENC_ITERATIONS = 300_000++const eb64 = {+ enc(bytes: Uint8Array): string {+ let s = ''+ for (const b of bytes) s += String.fromCharCode(b)+ return btoa(s)+ },+ dec(s: string): Uint8Array {+ const b = atob(s)+ const out = new Uint8Array(b.length)+ for (let i = 0; i < b.length; i++) out[i] = b.charCodeAt(i)+ return out+ },+}++let encPassword: string | null = null++/** Set (or clear with null) the password used for every subsequent save. */+export function setEncryptionPassword(p: string | null) {+ encPassword = p+}++export const isEncryptionActive = () => encPassword !== null++/** Parse a data-block body as an encryption envelope; null if it is not one. */+export function parseEnvelope(text: string): EncEnvelope | null {+ try {+ const env = JSON.parse(text)+ if (env && env.format === 'bento/enc' && env.v === 1 && env.data && env.salt && env.iv) {+ return env as EncEnvelope+ }+ } catch {+ /* not an envelope */+ }+ return null+}++async function deriveKey(password: string, salt: Uint8Array, iterations: number): Promise<CryptoKey> {+ const material = await crypto.subtle.importKey(+ 'raw', new TextEncoder().encode(password), 'PBKDF2', false, ['deriveKey'])+ return crypto.subtle.deriveKey(+ { name: 'PBKDF2', hash: 'SHA-256', salt: salt as BufferSource, iterations },+ material, { name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt'])+}++async function encryptBody(json: string, password: string): Promise<string> {+ const salt = new Uint8Array(16)+ const iv = new Uint8Array(12)+ crypto.getRandomValues(salt)+ crypto.getRandomValues(iv)+ const key = await deriveKey(password, salt, ENC_ITERATIONS)+ const ct = await crypto.subtle.encrypt(+ { name: 'AES-GCM', iv: iv as BufferSource }, key, new TextEncoder().encode(json))+ const env: EncEnvelope = {+ format: 'bento/enc', v: 1, it: ENC_ITERATIONS,+ salt: eb64.enc(salt), iv: eb64.enc(iv), data: eb64.enc(new Uint8Array(ct)),+ }+ return JSON.stringify(env)+}++/** Decrypt an envelope with a candidate password; null on wrong password. */+export async function decryptEnvelope(env: EncEnvelope, password: string): Promise<string | null> {+ try {+ const key = await deriveKey(password, eb64.dec(env.salt), env.it || ENC_ITERATIONS)+ const pt = await crypto.subtle.decrypt(+ { name: 'AES-GCM', iv: eb64.dec(env.iv) as BufferSource }, key, eb64.dec(env.data) as BufferSource)+ return new TextDecoder().decode(pt)+ } catch {+ return null+ }+}++/**+ * Encryption-aware serialization into an arbitrary shell — THE path for+ * saves and self-updates. Plain when no password is active.+ */+export async function serializeDocInto(shell: Document, doc: BentoDoc): Promise<string> {+ const body = encPassword+ ? await encryptBody(JSON.stringify(doc), encPassword)+ : JSON.stringify(doc)+ return serializeBody(shell, body, doc.title)+}++/** Encryption-aware serializeFile. */+export async function serializeAuto(doc: BentoDoc): Promise<string> {+ if (!pristine) throw new Error('capturePristine() was not called at boot')+ return serializeDocInto(pristine, doc)+}+export function suggestedFileName(doc: BentoDoc): string {const base = doc.title.replace(/[^\w\d-]+/g, '_').replace(/^_+|_+$/g, '') || 'Untitled'return `${base}.bento.html`@@ -111,7 +224,7 @@ export function downloadFile(html: string, name: string) {* save, silent rewrite after). Firefox/Safari: download a copy.*/export async function saveFile(doc: BentoDoc, forcePicker = false): Promise<SaveResult> {- const html = serializeFile(doc)+ const html = await serializeAuto(doc)if (hasFsAccess()) {if (forcePicker || !fileHandle) {const handle = await pickHandle(doc)diff --git a/slides/src/styles.css b/slides/src/styles.cssindex b68e4aed..ec67a37f 100644--- a/slides/src/styles.css+++ b/slides/src/styles.css@@ -1277,3 +1277,109 @@ body.ed-col-resizing { cursor: col-resize; user-select: none; }.ed-props input[type='number'] { min-width: 0; }.ed-props select { max-width: 100%; min-width: 0; }.ed-props input[type='text'] { min-width: 0; max-width: 100%; }++/* ————— password gate (encrypted files) + read-only player ————— */++.ed-pwgate, .ed-player {+ position: fixed;+ inset: 0;+ z-index: 2000;+ background: #0D1B2E;+ display: flex;+ align-items: center;+ justify-content: center;+ color: rgb(182 193 210 / 0.92);+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;+ text-align: center;+}+.ed-pwcard, .ed-playercard {+ max-width: 380px;+ padding: 28px;+ display: flex;+ flex-direction: column;+ gap: 14px;+ align-items: center;+}+.ed-pwmark { font-size: 40px; }+.ed-pwcard h1, .ed-playercard h1 {+ color: #fff;+ font-size: 24px;+ font-weight: 800;+ line-height: 1.2;+}+.ed-pwcard p, .ed-playercard p { font-size: 14px; line-height: 1.5; }+.ed-pwcard input {+ width: 100%;+ padding: 12px 14px;+ border-radius: 10px;+ border: 1px solid rgb(255 255 255 / 0.25);+ background: rgb(255 255 255 / 0.06);+ color: #fff;+ font-size: 15px;+ text-align: center;+}+.ed-pwcard button, .ed-playercard button {+ padding: 12px 26px;+ border: 0;+ border-radius: 999px;+ font-weight: 700;+ font-size: 14px;+ cursor: pointer;+ color: #0D1B2E;+ background: linear-gradient(180deg, #FFB29B, #ED8266);+}+.ed-playercard button.ed-playcopy {+ background: none;+ color: #fff;+ border: 1px solid rgb(255 255 255 / 0.3);+}+.ed-pwerr { color: #FF8A7A; font-size: 13px; min-height: 18px; }++/* password dialog (set/change) */+dialog.ed-pwdialog {+ border: 0;+ border-radius: 14px;+ box-shadow: 0 18px 50px rgb(15 23 36 / 0.3);+ padding: 20px;+ width: 340px;+ font-size: 13px;+ font-family: inherit;+}+dialog.ed-pwdialog::backdrop { background: rgb(15 23 36 / 0.38); }+dialog.ed-pwdialog h2 { font-size: 15px; margin-bottom: 8px; }+dialog.ed-pwdialog p { color: #667; line-height: 1.5; margin-bottom: 10px; }+dialog.ed-pwdialog label {+ display: block;+ margin: 8px 0 2px;+ font-weight: 600;+ color: #334;+}+dialog.ed-pwdialog input {+ display: block;+ width: 100%;+ margin-top: 4px;+ padding: 8px 10px;+ border: 1px solid #ccd;+ border-radius: 8px;+ font-size: 14px;+}+dialog.ed-pwdialog .ed-pwerr { color: #C33; }+.ed-dialog-actions {+ display: flex;+ justify-content: flex-end;+ gap: 8px;+ margin-top: 14px;+}+.ed-dialog-actions button {+ padding: 8px 16px;+ border-radius: 999px;+ border: 1px solid #ccd;+ background: #fff;+ font-weight: 600;+ cursor: pointer;+}+.ed-dialog-actions button.ed-primary {+ border: 0;+ color: #0D1B2E;+ background: linear-gradient(180deg, #FFB29B, #ED8266);+}diff --git a/slides/src/sync/online.ts b/slides/src/sync/online.tsindex cf496b98..0490c487 100644--- a/slides/src/sync/online.ts+++ b/slides/src/sync/online.ts@@ -38,16 +38,19 @@ export function mintRoomKey(): string {}/**- * Fresh collaboration credentials, minted at DOCUMENT CREATION and dormant- * (on:false) until sharing starts. The room id is random — never derived- * from docId — so distinct sharing lineages can never collide on a room- * (and the relay learns nothing about document identity). Everyone else- * READS the room from the file; only minting is random.+ * Fresh collaboration credentials, minted at DOCUMENT CREATION and LIVE by+ * default (on:true): the moment identity and keys exist, any copy of the+ * file joins the same room — "send first" needs no ceremony. "Stop sharing"+ * in the Live popover turns it off; Offline mode hard-blocks regardless.+ * The room id is random — never derived from docId — so distinct sharing+ * lineages can never collide on a room (and the relay learns nothing about+ * document identity). Everyone else READS the room from the file; only+ * minting is random.*/export function mintCollab(): { room: string; key: string; on: boolean } {const id = new Uint8Array(12)crypto.getRandomValues(id)- return { room: `${syncHost()}/d/r${b64u.enc(id)}`, key: mintRoomKey(), on: false }+ return { room: `${syncHost()}/d/r${b64u.enc(id)}`, key: mintRoomKey(), on: true }}/** dev override for the relay host (e.g. ws://localhost:8787) */diff --git a/slides/src/update.ts b/slides/src/update.tsindex 24642c29..f9e09788 100644--- a/slides/src/update.ts+++ b/slides/src/update.ts@@ -19,7 +19,7 @@import type { BentoDoc } from './model'import {- serializeWith, serializeFile, suggestedFileName, downloadFile,+ serializeDocInto, serializeAuto, suggestedFileName, downloadFile,hasFileHandle, writeUpdatedFile, writeUpdatedFileAs,} from './save'@@ -167,7 +167,7 @@ export async function buildUpdatedFile(release: ReleaseInfo, doc: BentoDoc): Proconst shell = new DOMParser().parseFromString(new TextDecoder().decode(bytes), 'text/html')if (!shell.getElementById('bento-doc'))throw new Error('the downloaded update is not a Bento shell')- return serializeWith(shell, doc)+ return serializeDocInto(shell, doc)}/** Build the updated file and hand it to the user as a fresh download. */@@ -188,7 +188,7 @@ export async function applyUpdateInPlace(release: ReleaseInfo, doc: BentoDoc): Pconst html = await buildUpdatedFile(release, doc)if (hasFileHandle()) {const base = suggestedFileName(doc).replace(/\.bento\.html$/, '')- downloadFile(serializeFile(doc), `${base}.v${APP_VERSION}-backup.bento.html`)+ downloadFile(await serializeAuto(doc), `${base}.v${APP_VERSION}-backup.bento.html`)await writeUpdatedFile(html)return true}