nightly build

This commit is contained in:
2026-06-10 01:25:51 +09:30
parent 9166bebef7
commit ec94376e1f
5 changed files with 48 additions and 13 deletions
+7 -1
View File
@@ -22,6 +22,7 @@
import {
checkGithubReleaseUpdate,
dismissNightlyUpdate,
getInstalledGhReleaseChannelLabel,
isGhReleaseUpdateCheckEnabled,
type GhReleaseUpdateInfo,
} from "@/utils/githubReleaseUpdate";
@@ -33,6 +34,7 @@
let disclaimerTitle = $state("Confirm");
let disclaimerMessage = $state("");
const ghReleaseUpdateEnabled = isGhReleaseUpdateCheckEnabled();
const ghReleaseChannelLabel = getInstalledGhReleaseChannelLabel();
let ghReleaseUpdate = $state<GhReleaseUpdateInfo | null>(null);
const openGhRelease = () => {
@@ -172,7 +174,11 @@
</button>
{/if}
<p class="text-[9px] leading-tight text-right text-zinc-500 dark:text-zinc-400">
GitHub release build — do not upload to extension stores.
{#if ghReleaseChannelLabel}
{ghReleaseChannelLabel} — do not upload to extension stores.
{:else}
GitHub release build — do not upload to extension stores.
{/if}
</p>
</div>
{/if}
+15 -2
View File
@@ -35,6 +35,14 @@ function getBuildLabel(): string {
return typeof __BUILD_LABEL__ !== "undefined" ? __BUILD_LABEL__ : "";
}
function formatNightlyLabel(buildDate: string): string {
return buildDate ? `nightly (${buildDate})` : "nightly";
}
function nightlyDateFromPublishedAt(publishedAt: string): string {
return publishedAt.slice(0, 10);
}
function getCurrentVersion(): string {
return browser.runtime.getManifest().version;
}
@@ -158,8 +166,7 @@ async function checkNightlyUpdate(): Promise<GhReleaseUpdateInfo> {
}
const lastSeen = settingsState.lastSeenNightlyPublishedAt;
const buildLabel = getBuildLabel();
const label = buildLabel ? `nightly #${buildLabel}` : "nightly";
const label = formatNightlyLabel(nightlyDateFromPublishedAt(release.published_at));
if (!lastSeen) {
settingsState.lastSeenNightlyPublishedAt = release.published_at;
@@ -177,6 +184,12 @@ export function isGhReleaseUpdateCheckEnabled(): boolean {
return isUpdateCheckEnabled();
}
/** Label for the installed GitHub release build (e.g. `nightly (2025-06-10)`). */
export function getInstalledGhReleaseChannelLabel(): string | null {
if (!isUpdateCheckEnabled() || getUpdateChannel() !== "nightly") return null;
return formatNightlyLabel(getBuildLabel());
}
export async function checkGithubReleaseUpdate(): Promise<GhReleaseUpdateInfo> {
const fallback = { available: false, label: "", url: releasesBaseUrl() };