Bumps version so the chip actually surfaces itself on 0.0.3 installs (the version-newer check requires a strict semver bump — same-version rebuilds don't trigger the chip). From this release on, whenever the manifest names a newer Theseus, users get a one-click download. Mechanism - main.js checkForUpdate() fetches https://dl.silentmode.st/releases- manifest.json on startup (5s timeout, cache: no-store) + every 6h. Finds the theseus-navigator release, compares version to app.getVersion() with a numeric a.b.c comparator that handles "0.10.0 > 0.9.9" correctly. - On a match → stores { version, setupUrl, portableUrl, setupHash, portableHash, date } and emits update-available to chrome. Cleared after the user upgrades + relaunches (same-version → null). - Re-emits on chrome's did-finish-load in case the fetch beats the chrome view. Chip UI (chrome.html) - Acid-yellow pill between the downloads button and the Tor toggle: "↓ Update to X.Y.Z" + a ✕. Main body opens setupUrl in the system browser via shell.openExternal (origin-validated to https://dl.silentmode.st/ or https://silentmode.st/). ✕ dismisses for the current session — you'll see it again next launch if still behind. Trust anchor - No signing / no cryptographic verification of the download in this phase. releases.silentmode.bch publishes the SAME manifest URL, so users who want to verify can cross-check the manifest hash against what BCNR returns. The proper auto-updater with signature checks is the follow-on to this cheap version. Non-goals in phase 1 - No delta downloads; the user clicks and gets a full installer. - No auto-install; download → user runs the installer themselves. - No "check now" button in Settings; the periodic timer suffices. - No portable-vs-installed detection; the chip prefers setupUrl (the installer upgrades in place). Right-click for portable is future work.
52 lines
3.2 KiB
JavaScript
52 lines
3.2 KiB
JavaScript
const { contextBridge, ipcRenderer } = require("electron");
|
|
contextBridge.exposeInMainWorld("theseus", {
|
|
navigate: (input) => ipcRenderer.invoke("navigate", input),
|
|
search: (q) => ipcRenderer.invoke("search", q),
|
|
newTab: () => ipcRenderer.invoke("new-tab"),
|
|
closeTab: (id) => ipcRenderer.invoke("close-tab", id),
|
|
switchTab: (id) => ipcRenderer.invoke("switch-tab", id),
|
|
moveTab: (id, targetId, place) => ipcRenderer.invoke("move-tab", id, targetId, place),
|
|
suggestAddress: (query, rect) => ipcRenderer.invoke("suggest-address", query, rect),
|
|
closeAddressPicker: () => ipcRenderer.invoke("close-address-picker"),
|
|
addressCursor: (dir) => ipcRenderer.invoke("address-cursor", dir),
|
|
togglePwFill: (rect) => ipcRenderer.invoke("toggle-pw-fill", rect),
|
|
onPwAvailability: (cb) => ipcRenderer.on("pw-availability", (_e, d) => cb(d)),
|
|
// Update chip: chrome subscribes to update-available; clicking the chip's
|
|
// download button opens the URL in the system browser; ✕ dismisses for
|
|
// the current session.
|
|
onUpdateAvailable: (cb) => ipcRenderer.on("update-available", (_e, d) => cb(d)),
|
|
openUpdateDownload: (url) => ipcRenderer.invoke("open-update-download", url),
|
|
dismissUpdate: () => ipcRenderer.invoke("dismiss-update"),
|
|
goHome: () => ipcRenderer.invoke("go-home"),
|
|
back: () => ipcRenderer.invoke("go-back"),
|
|
forward: () => ipcRenderer.invoke("go-forward"),
|
|
reload: () => ipcRenderer.invoke("reload"),
|
|
stop: () => ipcRenderer.invoke("stop"),
|
|
toggleTor: () => ipcRenderer.invoke("toggle-tor"),
|
|
openSettings: () => ipcRenderer.invoke("open-settings"),
|
|
toggleSiteInfo: (rect) => ipcRenderer.invoke("toggle-site-info", rect),
|
|
switchToBcnr: () => ipcRenderer.invoke("switch-to-bcnr"),
|
|
setChromeHeight: (h) => ipcRenderer.invoke("set-chrome-height", h),
|
|
getSearchEngines: () => ipcRenderer.invoke("search-engines"),
|
|
setSearchEngine: (id) => ipcRenderer.invoke("set-search-engine", id),
|
|
addEngine: (eng) => ipcRenderer.invoke("add-engine", eng),
|
|
removeEngine: (id) => ipcRenderer.invoke("remove-engine", id),
|
|
toggleEnginePicker: (rect) => ipcRenderer.invoke("toggle-engine-picker", rect),
|
|
onEngines: (cb) => ipcRenderer.on("engines", (_e, d) => cb(d)),
|
|
getBookmarks: () => ipcRenderer.invoke("bookmarks-get"),
|
|
addBookmark: (bm) => ipcRenderer.invoke("bookmark-add", bm),
|
|
removeBookmark: (url) => ipcRenderer.invoke("bookmark-remove", url),
|
|
onBookmarks: (cb) => ipcRenderer.on("bookmarks", (_e, d) => cb(d)),
|
|
onNav: (cb) => ipcRenderer.on("nav", (_e, d) => cb(d)),
|
|
onTor: (cb) => ipcRenderer.on("tor", (_e, d) => cb(d)),
|
|
onTabs: (cb) => ipcRenderer.on("tabs", (_e, d) => cb(d)),
|
|
onBcnrOffer: (cb) => ipcRenderer.on("bcnr-offer", (_e, d) => cb(d)),
|
|
// Collision-mode (BCNR ↔ ICANN) live switcher for the active tab
|
|
collisionSwitch: (arg) => ipcRenderer.invoke("collision-switch", arg),
|
|
collisionState: () => ipcRenderer.invoke("collision-state"),
|
|
// Downloads — the toolbar button subscribes to `downloads` to update its
|
|
// badge, and toggleDownloads opens/closes the floating panel.
|
|
getDownloads: () => ipcRenderer.invoke("downloads-get"),
|
|
toggleDownloads: (rect) => ipcRenderer.invoke("toggle-downloads", rect),
|
|
onDownloads: (cb) => ipcRenderer.on("downloads", (_e, d) => cb(d)),
|
|
});
|