From 8e60469703c2551f119ce43ea62dbe6a2ddfd00d Mon Sep 17 00:00:00 2001 From: Local Dev Date: Tue, 8 Sep 2026 00:20:37 +0200 Subject: [PATCH] fix(theseus/home): dynamic search-engine name in placeholder Home page's search-box placeholder was hardcoded "Search the web (DuckDuckGo)", but the browser's default engine has been Startpage for a while and any user can switch to another in Settings. The "DuckDuckGo" claim then contradicted the actual engine that would run the query (main.js routes through settings.searchEngine). Fix: placeholder starts as plain "Search the web" and populates on load with "Search the web with " via a new window.home.getEngines() IPC (reuses the existing search-engines handler). Silently no-ops if the preload isn't bound. Also swapped the never-fires no-preload fallback URL from duckduckgo.com to startpage.com so it matches Theseus's own default. --- home-preload.js | 4 ++++ home.html | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/home-preload.js b/home-preload.js index 7d0202f..aa3b2c9 100644 --- a/home-preload.js +++ b/home-preload.js @@ -10,6 +10,10 @@ contextBridge.exposeInMainWorld("home", { setCards: (cards) => ipcRenderer.invoke("home-cards-set", cards), resetCards: () => ipcRenderer.invoke("home-cards-reset"), navigate: (url) => ipcRenderer.invoke("navigate", url), + // Current default search engine — used to populate the search box + // placeholder with the actual engine name (e.g. "Search the web with + // Startpage") instead of hardcoding DuckDuckGo. + getEngines: () => ipcRenderer.invoke("search-engines"), // 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)), diff --git a/home.html b/home.html index e4f86ea..6b7aba4 100644 --- a/home.html +++ b/home.html @@ -118,7 +118,7 @@

Theseus Navigator

A browser that follows the thread. Names that live on the Bitcoin Cash chain.

- +

Tip: type a .bch name in the address bar above to open a decentralized site.

@@ -165,8 +165,23 @@ e.preventDefault(); const q = $("q").value.trim(); if (!q) return; if (window.home && window.home.navigate) window.home.navigate(q); - else window.location.href = "https://duckduckgo.com/?q=" + encodeURIComponent(q); + // Fallback if the preload didn't bind (shouldn't happen). Startpage + // over DuckDuckGo since that's Theseus's own default engine now. + else window.location.href = "https://www.startpage.com/do/search?q=" + encodeURIComponent(q); }); + // Populate placeholder with the user's current default engine name so + // "Search the web with " reflects reality. Silently no-ops if + // the preload or IPC isn't available (dev-open of home.html in a plain + // Chromium tab). Also refreshes on onEngines events would be nice but + // main only broadcasts `engines` to chrome — home only queries at load, + // which is fine because switching engines is a settings action that + // usually implies a reload of the tab shortly after. + if (window.home && window.home.getEngines) { + window.home.getEngines().then((r) => { + const name = r && r.engines && r.engines.find((x) => x.id === r.current)?.name; + if (name) $("q").placeholder = "Search the web with " + name; + }).catch(() => {}); + } function badgeClass(b) { // Normalize badge label into a CSS class (spaces + case → dashes / lower). if (!b) return "b-default";