A host from the web site; the same page kept once; deleting from the Notebooks chooser

From the development repository at 299f73d, 2026-10-11:
hosting from the site documented; a page loaded from a notebook and left
unchanged is not kept again; notebooks and pages are deleted from the
chooser, to the system's Trash (--trash); the Notebooks button.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
ackandClaude Fable 5.1 committed 2026-10-11 16:59:03 +02:00
1 parent 4e3a281d65
commit 0d01e23d7c
15 files changed
+711 -63

No files matched your search

+34 -3
View File
@@ -34,12 +34,15 @@ const RETRY_MS = 3000;
* @typedef {object} Backend
* @property {() => Promise<string | null>} readIdentity
* @property {(text: string) => Promise<boolean>} keepIdentity
* @property {() => Promise<{directory: string, notebooks: string[]}>} listNotebooks
* The directory is '' when the notebooks are in the browser.
* @property {() => Promise<{directory: string, notebooks: string[], trash: boolean}>} listNotebooks
* The directory is '' when the notebooks are in the browser; trash
* says whether a deleted notebook or page goes to one, or is gone for good.
* @property {(notebook: string) => Promise<string[]>} listPages Every page file, Current.svg too.
* @property {(notebook: string, pageName: string) => Promise<string | null>} readPage
* @property {(notebook: string, pageName: string, text: string) => Promise<void>} writePage
* @property {(notebook: string) => Promise<{kept: string | null, new: boolean}>} keepPage
* @property {(notebook: string) => Promise<void>} discardNotebook Delete a notebook, pages and all.
* @property {(notebook: string, pageName: string) => Promise<void>} discardPage Delete a kept page.
*/
/**
@@ -113,6 +116,14 @@ const inFiles = /** @type {Backend} */ ({
if (!response.ok) throw new Error(`The page could not be kept (${response.status}).`);
return response.json();
},
async discardNotebook(notebook) {
const response = await request('DELETE', [notebook]);
if (!response.ok) throw new Error(`The notebook “${notebook}” could not be deleted (${response.status}).`);
},
async discardPage(notebook, pageName) {
const response = await request('DELETE', [notebook, pageName]);
if (!response.ok) throw new Error(`The page ${pageName} could not be deleted (${response.status}).`);
},
});
let backend = inFiles;
@@ -146,12 +157,32 @@ export function keepIdentity(text) {
}
/**
* @returns {Promise<{directory: string, notebooks: string[]}>}
* @returns {Promise<{directory: string, notebooks: string[], trash: boolean}>}
*/
export function listNotebooks() {
return backend.listNotebooks();
}
/**
* Delete a notebook with every page in it: to the Trash where the
* local program has one, for good otherwise (listNotebooks says which).
* @param {string} notebook
* @returns {Promise<void>}
*/
export function discardNotebook(notebook) {
return backend.discardNotebook(notebook);
}
/**
* Delete a kept page, likewise.
* @param {string} notebook
* @param {string} pageName
* @returns {Promise<void>}
*/
export function discardPage(notebook, pageName) {
return backend.discardPage(notebook, pageName);
}
/**
* @param {string} notebook
* @returns {Promise<string[]>} The names of the pages kept in the