Updater: meldet fehlendes Release statt 'aktuell', vergleicht zusätzlich mit Version im Repository
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+9
-1
@@ -64,12 +64,20 @@ class Updater {
|
|||||||
const allowPre = this.store.get().settings.updatePrerelease;
|
const allowPre = this.store.get().settings.updatePrerelease;
|
||||||
const rel = (await res.json()).find((r) => !r.draft && (allowPre || !r.prerelease));
|
const rel = (await res.json()).find((r) => !r.draft && (allowPre || !r.prerelease));
|
||||||
const current = app.getVersion();
|
const current = app.getVersion();
|
||||||
if (!rel) return { current, available: false };
|
// Version im Quellcode (Standard-Branch) – zeigt an, wenn Code neuer ist als das letzte Release
|
||||||
|
let repoVersion = null;
|
||||||
|
try {
|
||||||
|
const pj = await fetch(`${base}/api/v1/repos/${owner}/${repo}/raw/package.json`, { headers: this.headers() });
|
||||||
|
if (pj.ok) repoVersion = (await pj.json()).version || null;
|
||||||
|
} catch { /* optional */ }
|
||||||
|
const newerInRepo = repoVersion && cmpVersion(repoVersion, current) > 0 && (!rel || cmpVersion(repoVersion, rel.tag_name) > 0) ? repoVersion : null;
|
||||||
|
if (!rel) return { current, available: false, noRelease: true, repoVersion: newerInRepo };
|
||||||
const kind = installKind();
|
const kind = installKind();
|
||||||
const asset = pickAsset(rel.assets || [], kind);
|
const asset = pickAsset(rel.assets || [], kind);
|
||||||
this.latest = { version: rel.tag_name.replace(/^v/i, ''), notes: rel.body || '', url: rel.html_url, asset, kind };
|
this.latest = { version: rel.tag_name.replace(/^v/i, ''), notes: rel.body || '', url: rel.html_url, asset, kind };
|
||||||
return {
|
return {
|
||||||
current,
|
current,
|
||||||
|
repoVersion: newerInRepo,
|
||||||
available: cmpVersion(rel.tag_name, current) > 0,
|
available: cmpVersion(rel.tag_name, current) > 0,
|
||||||
version: this.latest.version,
|
version: this.latest.version,
|
||||||
notes: this.latest.notes,
|
notes: this.latest.notes,
|
||||||
|
|||||||
+4
-1
@@ -731,7 +731,10 @@ async function viewSettings(page) {
|
|||||||
const chk = h(`<button class="btn">${ICONS.refresh}Jetzt nach Updates suchen</button>`);
|
const chk = h(`<button class="btn">${ICONS.refresh}Jetzt nach Updates suchen</button>`);
|
||||||
chk.onclick = async () => {
|
chk.onclick = async () => {
|
||||||
chk.disabled = true;
|
chk.disabled = true;
|
||||||
try { await save(formValues(updFields)); const r = await call('update:check'); if (r.available) showUpdate(r); else toast(`MrTerm ist aktuell (${r.current}).`, 'ok'); } catch {}
|
try { await save(formValues(updFields)); const r = await call('update:check'); if (r.available) showUpdate(r);
|
||||||
|
else if (r.repoVersion) toast(`Im Repository liegt Version ${r.repoVersion}, aber dafür gibt es noch kein Release mit Installationspaketen. Installiert: ${r.current}.`, 'error');
|
||||||
|
else if (r.noRelease) toast('Im Repository gibt es noch keine Releases.', 'error');
|
||||||
|
else toast(`MrTerm ist aktuell (${r.current}).`, 'ok'); } catch {}
|
||||||
chk.disabled = false;
|
chk.disabled = false;
|
||||||
};
|
};
|
||||||
updCard.append(updFields, chk);
|
updCard.append(updFields, chk);
|
||||||
|
|||||||
Reference in New Issue
Block a user