Pithos desktop: update notices per platform
With Linux builds joining Windows in the release list, the check must only compare builds for its own system, and the link must fetch the Linux AppImage (or, later, the macOS dmg) rather than the Windows installer.
This commit is contained in:
parent
3d863b5fe6
commit
9cad6eb136
2 changed files with 6 additions and 2 deletions
|
|
@ -166,6 +166,7 @@ export async function createPithos(opts = {}) {
|
|||
pithos: pithosVersion,
|
||||
// electron-builder's portable exe sets this; updates then fetch the portable build.
|
||||
portable: hostName === 'desktop' && !!process.env.PORTABLE_EXECUTABLE_FILE,
|
||||
platform: process.platform,
|
||||
daemon: daemon.status(),
|
||||
external: await probeExternal(c),
|
||||
s3d: { ...v, pinned: S3D_VERSION, installable: !!assetForPlatform(), outdated: !!(v?.version && cmpVersion(v.version, S3D_VERSION) < 0) },
|
||||
|
|
@ -540,7 +541,9 @@ export async function createPithos(opts = {}) {
|
|||
if (releaseCache && Date.now() - releaseCache.at < 10 * 60_000 && url.searchParams.get('fresh') !== '1') return releaseCache.body;
|
||||
const res = await fetch(`${RELEASES_URL}?t=${Math.floor(Date.now() / 60000)}`, { cache: 'no-store', signal: AbortSignal.timeout(15_000) }).catch((e) => { throw new HttpError(502, e.message); });
|
||||
if (!res.ok) throw new HttpError(502, `the release list answered ${res.status}`);
|
||||
const list = ((await res.json())?.releases || []).filter((e) => e.id === 'pithos-desktop' && /^\d+\.\d+\.\d+$/.test(e.version));
|
||||
// each build is listed per platform ("win-x64", "linux-x64", "mac-…"); only ours counts
|
||||
const os = { win32: 'win', linux: 'linux', darwin: 'mac' }[process.platform];
|
||||
const list = ((await res.json())?.releases || []).filter((e) => e.id === 'pithos-desktop' && /^\d+\.\d+\.\d+$/.test(e.version) && String(e.platform || '').startsWith(`${os}-`));
|
||||
const latest = list.reduce((best, e) => (!best || cmpVersion(e.version, best.version) > 0 ? e : best), null);
|
||||
const body = { latest: latest && { version: latest.version, date: latest.date || null, changes: String(latest.changes || '').slice(0, 600) } };
|
||||
releaseCache = { at: Date.now(), body };
|
||||
|
|
|
|||
|
|
@ -2570,7 +2570,8 @@ const UPDATES_URL = 'https://navigate.st/bns/theseus.x/extensions/pithos/updates
|
|||
// (read by the local server). The chip downloads the matching installer, or
|
||||
// the portable exe, in the browser.
|
||||
function desktopUpdates(current, { ver, chip, check }) {
|
||||
const file = state.status?.portable ? 'Pithos-portable.exe' : 'Pithos-Setup.exe';
|
||||
const plat = state.status?.platform;
|
||||
const file = plat === 'linux' ? 'Pithos.AppImage' : plat === 'darwin' ? 'Pithos.dmg' : state.status?.portable ? 'Pithos-portable.exe' : 'Pithos-Setup.exe';
|
||||
const rest = () => { chip.hidden = true; ver.hidden = false; };
|
||||
const flash = (text, cls, title) => {
|
||||
chip.hidden = false; ver.hidden = true; chip.className = `brandupd ${cls}`; chip.textContent = text; chip.title = title || ''; chip.disabled = true; chip.onclick = null;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue