#90 · Offer the official plugins without a server
- timeline-app
- pull request
- plugins
Closes #82: *official plugins should be distributed to offline and desktop by default. Shouldn't need a network connection to server for plugin library.* ## Before The official plugins (`BUILTIN_PLUGINS`) are already compiled into every build, but the **plugin library dialog** only listed what a server returned from `plugins/search`: - **Offline HTML:** no library at all ("the online library is unavailable"); only Custom. - **Desktop:** it asked the configured server, so with no network or no server there was nothing to add. ## Change - **Shared search:** the server's built-in search moves to `searchPluginLibrary` in `src/plugins.ts`: the newest version of each plugin, in name order, matching name, description or ID, paged. `server/plugins.mjs` uses it after its existing validation, so the server and the app give identical results. - **Offline HTML, and desktop with no server connected:** the library searches the included official plugins locally, **with no request**. The status reads "11 official plugins included with this app", and the sort control (popularity and age only exist on a server) is hidden. - **Web, and desktop connected to a server:** the server's library (official + community) is asked first. If it can't be reached or answers 5xx, it falls back to the included official plugins and says so ("The server's library is unreachable…"). This also covers static hosting with no API. A 4xx answer (an invalid search) is still shown as an error. - **Text:** the offline plugins note now says the official plugins are included. `docs/plugins.md` is updated. ## Tests - `test/plugins.test.mjs`: `searchPluginLibrary(BUILTIN_PLUGINS, …)` equals the server's built-in library for several searches and pages; it lists the newest version of each official plugin, in name order, all official. - `test/plugins-browser.mjs`: - **offline file:** the library lists all official plugins without a network, and a search finds "Geological ages · v1 · Official", ready to add (`offline-browser.mjs` also asserts zero network calls); - **web:** with the server's library unreachable, the dialog falls back to the official plugins and shows the installed one as Installed. - `test/desktop-cache-browser.mjs`: a desktop app with no server lists the official plugins, hides sorting, and makes **no** `desktop_request`. - Locally in `mcr.microsoft.com/playwright:v1.58.2-noble`: - the browser suite passes on chromium, firefox and webkit, apart from the moment-dialog step, which I skipped because it fails in that container on `main` too (CI runs it); - `offline-browser.mjs` passes on chromium and firefox; - `npm test`: 209 pass.
Sources
Open #90 · Offer the official plugins without a server in the timeline