← Commit history

1.3.15: ui_build load beacon (server stamps the HTML, the page reports it to /state/ui) so a stale webview tab is provable, not guessable

John Lauer ·d428bf4397 ·1mo ago ·parent a761cf5
4 files changed +5−3
Cargo.lock+1−1
@@ -4,7 +4,7 @@ version = 4  [[package]] name = "adom-chip-fetcher"-version = "1.3.14"+version = "1.3.15" dependencies = [  "anyhow",  "clap",
Cargo.toml+1−1
@@ -1,6 +1,6 @@ [package] name = "adom-chip-fetcher"-version = "1.3.14"+version = "1.3.15" edition = "2021" description = "Crawls the web on your behalf to gather everything about the chips you care about (datasheet, symbol, footprint, 3D, stock) into one library, by driving Chrome via pup." 
src/serve.rs+1−1
@@ -107,7 +107,7 @@ pub fn run(port: u16, print_url: bool, detached_child: bool) -> Result<()> {         let qs = raw_url.split('?').nth(1).unwrap_or("").to_string();         let response = match (&method, url.as_str()) {             (Method::Options, _) => Response::from_string(String::new()).with_status_code(204),-            (Method::Get, "/") | (Method::Get, "/index.html") => html_response(INDEX_HTML),+            (Method::Get, "/") | (Method::Get, "/index.html") => html_response(&INDEX_HTML.replace("__CF_VERSION__", crate::dock::VERSION)),             (Method::Get, "/health") => json_response(crate::dock::health_json()),             (Method::Get, "/api/status") => json_response(crate::dock::status_json(qs.contains("force=1"))),             (Method::Get, "/state") => json_response(state_json()),
src/ui/index.html+2
@@ -735,6 +735,7 @@ const $id = id => document.getElementById(id); function escapeHtml(s) { return String(s == null ? '' : s).replace(/[&<>"']/g, m => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'})[m]); } // Relative paths so the page works behind /proxy/<port>/ and inside a webview. const API_BASE = location.pathname.replace(/index\.html$/, '').replace(/\/$/, '');+const UI_BUILD = '__CF_VERSION__'; // stamped by the server at serve time; the page reports it on load so a stale tab is provable const TRY_IT_PARKED = true; // ship-night posture: no /ai-threads calls; Try it copies instead (John's ruling, 2026-08-23) function copyViaTextarea(t) {   // Must run synchronously inside the click gesture: execCommand('copy')@@ -2055,6 +2056,7 @@ document.addEventListener('keydown', e => { if (e.key === 'Escape' && isPhone()) // ---- Boot: first paint never waits on one slow endpoint; each source loads independently. ---- buildSay(); loadStatus();+postJson('/state/ui', { ui_build: UI_BUILD, view: 'grid' }).catch(() => {}); loadSettings(); loadLibrary().catch(e => { $id('cards').innerHTML = '<div class="empty-state">Could not load the library: ' + escapeHtml(e.message) + '</div>'; }); api('/state').then(s => { if (s && s.version) { SERVER_VERSION = s.version; $id('popVersion').textContent = 'v' + s.version; $id('settingsVersion').textContent = 'v' + s.version; } }).catch(() => {});