Changeset da71f9d in Klonkt for src/routes/admin-updates.js
- Timestamp:
- 07/04/2026 05:47:49 PM (2 months ago)
- Branches:
- main
- Children:
- 8e7f0ec
- Parents:
- 0a93c15
- File:
-
- 1 edited
-
src/routes/admin-updates.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/admin-updates.js
r0a93c15 rda71f9d 45 45 const IS_ANDROID = process.platform === 'android' 46 46 || (() => { try { return fs.existsSync('/data/data/com.termux/files/usr/bin'); } catch { return false; } })(); 47 // Phone tarballs are built from the stable branch → that's the phone's "latest". 48 const ANDROID_LATEST_URL = 'https://raw.githubusercontent.com/roboburr/klonkt/stable/package.json'; 47 // "Latest" for a phone = what the update button can actually INSTALL: the version 48 // of the prebuilt bundle on the release (BUILD-INFO.txt's bundle-version). Reading 49 // the stable branch instead showed a new version during the CI window in which the 50 // bundle was still being built — pressing update then reinstalled the old version. 51 const ANDROID_BUILDINFO_URL = 'https://github.com/roboburr/klonkt-android/releases/download/termux-latest/BUILD-INFO.txt'; 52 const ANDROID_STABLE_URL = 'https://raw.githubusercontent.com/roboburr/klonkt/stable/package.json'; 53 54 async function fetchWithTimeout(url, ms) { 55 const ctl = new AbortController(); 56 const t = setTimeout(() => ctl.abort(), ms); 57 try { return await fetch(url, { signal: ctl.signal, redirect: 'follow' }); } 58 finally { clearTimeout(t); } 59 } 49 60 50 61 async function androidLatestVersion() { 51 62 try { 52 const ctl = new AbortController(); 53 const t = setTimeout(() => ctl.abort(), 8000); 54 const r = await fetch(ANDROID_LATEST_URL, { signal: ctl.signal }); 55 clearTimeout(t); 63 const r = await fetchWithTimeout(ANDROID_BUILDINFO_URL, 8000); 64 if (r.ok) { 65 const m = (await r.text()).match(/^bundle-version:\s*(\S+)/m); 66 if (m) return m[1]; 67 } 68 } catch { /* fall through */ } 69 // Older releases have no bundle-version line → fall back to the stable branch. 70 try { 71 const r = await fetchWithTimeout(ANDROID_STABLE_URL, 8000); 56 72 if (!r.ok) return null; 57 73 return (await r.json()).version || null;
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)