Setup bb9d8dec124b8e2a976642ed77051b04edd1d03185581f99db845ef168919836 Portable 1e2d02aea13656574c374440b0c41374290f1bbf85ac6313cec075292cfc34f8 Home cards decoupled from the installer. Theseus now fetches https://dl.silentmode.st/home-cards.json at boot and every 6h, caches into <userData>/home-cards-remote.json, and applies it as the default tier. Priority in loadHomeCards() is: 1. <userData>/home-cards.json (user edits — unchanged, always win) 2. <userData>/home-cards-remote.json (last successful fetch) 3. DEFAULT_HOME_CARDS (code fallback for offline first-boot) On a successful refresh, main pushes the new list to every home tab via the home-cards IPC — but only when the user has NO local edits. The user's edit mode remains authoritative. Content updates now happen by editing site/home-cards.json and running scp + sia-upload. No browser build required. Prometheus.X copy fix: "Decentralized App Marketplace" (was "marketplace for BCDN-hosted apps" — the marketplace isn't BCDN- specific). Applied to both DEFAULT_HOME_CARDS (fallback) and site/home-cards.json (canonical live copy). Deployed: - scp installers + manifest + tools/ + releases/ + home-cards.json to /opt/silent-mode/dl/ and /opt/silent-mode/site/ - sia-upload of both site trees - verified home-cards.json served 200, manifest 0.3.0 live Existing installs of 0.2.5 will surface 0.3.0 in the update chip and also pull the new home-cards.json — so the "Decentralized App Marketplace" wording lands on ANY current install (0.3.0+) the moment this commit deploys, without waiting for anyone to install 0.3.0. Wait — 0.3.0 is what CARRIES the fetch logic. So the auto-pull benefit only kicks in from 0.3.0 onward. Users on 0.2.5 or earlier need to install 0.3.0 once; from then on every home-card edit reaches them without a new browser release.
26 lines
1.5 KiB
JavaScript
26 lines
1.5 KiB
JavaScript
// Preload for tab webContents that host the built-in home page. All non-
|
|
// settings tabs get this preload since we don't know in advance whether a
|
|
// tab will land on home.html; the corresponding IPC handlers in main.js
|
|
// validate the sender's URL is our own home.html file:// and reject any
|
|
// origin-mismatched call, so a third-party page can inspect the API's
|
|
// SHAPE but can't invoke it against local user data.
|
|
const { contextBridge, ipcRenderer } = require("electron");
|
|
contextBridge.exposeInMainWorld("home", {
|
|
getCards: () => ipcRenderer.invoke("home-cards-get"),
|
|
setCards: (cards) => ipcRenderer.invoke("home-cards-set", cards),
|
|
resetCards: () => ipcRenderer.invoke("home-cards-reset"),
|
|
navigate: (url) => ipcRenderer.invoke("navigate", url),
|
|
// Main pushes an updated list here after a successful remote refresh
|
|
// (only when the user has not customised locally). home.html re-renders.
|
|
onCards: (cb) => ipcRenderer.on("home-cards", (_e, list) => cb(list)),
|
|
});
|
|
// Same preload also serves the branded error page (error.html). Handlers in
|
|
// main.js sender-check for error.html so a random page seeing the API shape
|
|
// can't drive navigation.
|
|
contextBridge.exposeInMainWorld("errorpage", {
|
|
retry: (url) => ipcRenderer.invoke("error-retry", url),
|
|
goHome: () => ipcRenderer.invoke("error-home"),
|
|
searchFor: (text) => ipcRenderer.invoke("error-search", text),
|
|
registerOnSirius: (host) => ipcRenderer.invoke("error-register", host),
|
|
openExternal: (url) => ipcRenderer.invoke("error-open-external", url),
|
|
});
|