123declare const __PEACH_VERSION__: string;45export type ReleaseImportance = "breaking" | "critical";6export interface ReleaseNote {7 heading: string;8 body: string;9}1011export const PEACH_VERSION: string = typeof __PEACH_VERSION__ !== "undefined"12 ? __PEACH_VERSION__13 : "0.0.0";1415export interface PeachRelease {16 version: string;17 releasedAt: string;18 notes: ReleaseNote[];19 importance?: ReleaseImportance;20}2122export const RELEASES: PeachRelease[] = [23 { version: "5.2.17", releasedAt: "2026-09-07", importance: "breaking", notes: [{ heading: "Sync may need device repair", body: "If sync starts failing after this security update, revoke the affected devices and pair them again. A recent security change may require repairing device trust before sync can resume." }] },24 { version: "5.2.6", releasedAt: "2026-09-06", notes: [{ heading: "Release history", body: "Settings now has an accurate, versioned changelog. Important notices combine every critical or breaking change since your previous installed version." }] },25 { version: "5.2.5", releasedAt: "2026-09-06", notes: [{ heading: "Quieter update notices", body: "Routine updates no longer replay unchanged What's New information." }] },26 { version: "5.2.4", releasedAt: "2026-09-06", notes: [{ heading: "Chrome passkey sign-in", body: "Older Peach passkeys work again on GitHub and other strict sites." }] },27 { version: "5.2.3", releasedAt: "2026-09-06", notes: [{ heading: "Inline entry creation", body: "The + button keeps new-entry creation inside the unlocked page helper." }] },28 { version: "5.2.2", releasedAt: "2026-09-06", notes: [{ heading: "Inline editing", body: "Entry editing stays in the page helper, and password-limit guidance is readable." }] },29 {30 version: "5.1.3", releasedAt: "2026-09-05", importance: "breaking",31 notes: [32 { heading: "Passphrases & long passwords", body: "Peach supports passphrases and passwords up to 256 characters." },33 { heading: "Update Android before using Vault V4", body: "Vault V4 requires Peach Android v2.15.3 or newer. Update Android and export a backup there before moving to Vault V4." },34 ],35 },36];3738export function hasReleaseNotes(): boolean { return RELEASES.length > 0; }3940const UPGRADE_FROM_KEY = "peach_release_notes_from";41const LEGACY_SEEN_KEY = "peach_whats_new_seen";4243function versionParts(version: string): [number, number, number] | null {44 const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);45 return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;46}4748export function compareVersions(left: string, right: string): number {49 const a = versionParts(left); const b = versionParts(right);50 if (!a || !b) return 0;51 for (let index = 0; index < 3; index += 1) if (a[index] !== b[index]) return a[index]! - b[index]!;52 return 0;53}5455export function importantReleasesSince(version: string): PeachRelease[] {56 const currentVersion = PEACH_VERSION === "0.0.0" ? RELEASES[0]!.version : PEACH_VERSION;57 return selectImportantReleases(RELEASES, version, currentVersion);58}5960export function selectImportantReleases(61 releases: PeachRelease[],62 fromVersion: string,63 throughVersion: string,64): PeachRelease[] {65 return releases.filter((release) =>66 release.importance !== undefined &&67 compareVersions(release.version, fromVersion) > 0 &&68 compareVersions(release.version, throughVersion) <= 069 );70}7172export async function recordInstalledVersion(details: chrome.runtime.InstalledDetails): Promise<void> {73 if (details.reason !== "update" || !details.previousVersion) return;74 const stored = await chrome.storage.local.get(UPGRADE_FROM_KEY);75 if (stored[UPGRADE_FROM_KEY] === undefined) await chrome.storage.local.set({ [UPGRADE_FROM_KEY]: details.previousVersion });76}7778export async function pendingImportantReleases(): Promise<PeachRelease[]> {79 try {80 const stored = await chrome.storage.local.get([UPGRADE_FROM_KEY, LEGACY_SEEN_KEY]);81 const from = stored[UPGRADE_FROM_KEY];82 return typeof from === "string" && versionParts(from) ? importantReleasesSince(from) : [];83 } catch { return []; }84}8586export async function shouldShowWhatsNew(): Promise<boolean> {87 return (await pendingImportantReleases()).length > 0;88}8990export async function markWhatsNewSeen(): Promise<void> {91 try {92 await chrome.storage.local.remove([UPGRADE_FROM_KEY, LEGACY_SEEN_KEY]);93 } catch {94 95 }96}