From 56776e7f13ca29817b3b0052cc254b6ff13c3101 Mon Sep 17 00:00:00 2001 From: Nystik <236107-Nystik@users.noreply.gitlab.com> Date: Sun, 17 May 2026 15:48:24 +0200 Subject: [PATCH] fix version check, link to release page --- plugin/src/settings/general-tab.js | 22 +++++++++++++++------- plugin/styles.css | 5 +++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/plugin/src/settings/general-tab.js b/plugin/src/settings/general-tab.js index a9c84c9..b18f1a6 100644 --- a/plugin/src/settings/general-tab.js +++ b/plugin/src/settings/general-tab.js @@ -13,6 +13,11 @@ function getVersion(app) { } } +// SemVer build metadata (`+xyz`) is informational and ignored for precedence. +function stripBuildMetadata(version) { + return (version || "").split("+")[0]; +} + async function checkForUpdate(currentVersion) { try { const res = await fetch(GITHUB_API_LATEST); @@ -22,10 +27,11 @@ async function checkForUpdate(currentVersion) { } const data = await res.json(); - const latest = data.tag_name?.replace(/^v/, ""); + const latest = stripBuildMetadata(data.tag_name?.replace(/^v/, "")); + const current = stripBuildMetadata(currentVersion); - if (latest && latest !== currentVersion) { - return latest; + if (latest && latest !== current) { + return { version: latest, url: data.html_url }; } return null; @@ -59,9 +65,10 @@ function display(containerEl, app) { cls: "ignis-header-version", }); - const updateIndicator = versionCol.createEl("span", { + const updateIndicator = versionCol.createEl("a", { text: "Checking...", cls: "ignis-update-indicator", + attr: { target: "_blank", rel: "noopener noreferrer" }, }); const githubLink = right.createEl("a", { @@ -75,10 +82,11 @@ function display(containerEl, app) { attr: { src: "/assets/github.svg", alt: "GitHub" }, }); - checkForUpdate(version).then((latestVersion) => { - if (latestVersion) { - updateIndicator.textContent = `v${latestVersion} available`; + checkForUpdate(version).then((latest) => { + if (latest) { + updateIndicator.textContent = `v${latest.version} available`; updateIndicator.addClass("ignis-update-available"); + updateIndicator.href = latest.url; } else { updateIndicator.textContent = "Up to date"; } diff --git a/plugin/styles.css b/plugin/styles.css index e9eb304..2820ac9 100644 --- a/plugin/styles.css +++ b/plugin/styles.css @@ -54,12 +54,17 @@ .ignis-update-indicator { font-size: var(--font-ui-smaller); color: var(--text-faint); + text-decoration: none; } .ignis-update-indicator.ignis-update-available { color: var(--text-accent); } +.ignis-update-indicator.ignis-update-available:hover { + text-decoration: underline; +} + .ignis-github-link { color: var(--text-muted); display: flex;