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 {24 version: "5.2.49",25 releasedAt: "2026-09-11",26 notes: [{27 heading: "Make Sync reset resilient",28 body: "Sync reset no longer fails when the browser cannot refresh its session-only identity cache; the durable identity remains authoritative.",29 }],30 },31 {32 version: "5.2.48",33 releasedAt: "2026-09-11",34 notes: [{35 heading: "Complete locked-vault Sync resets",36 body: "Sync reset now unlocks the real vault before rotating its local identity when Settings is opened after the vault session expired.",37 }],38 },39 {40 version: "5.2.46",41 releasedAt: "2026-09-11",42 importance: "breaking",43 notes: [{44 heading: "A major Sync security update",45 body: "We're sorry for the extra step. This major security update makes Sync and device Revocation meaningfully more secure, but it requires a deliberate repair: 1) update Peach on every device; 2) open Sync settings on the device showing the reset notice; 3) enter your master password and complete Reset Sync; 4) pair or re-pair every device individually. Old device trust will not continue automatically. Your vault and recovery words are unchanged.",46 }],47 },48 { 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." }] },49 { 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." }] },50 { version: "5.2.5", releasedAt: "2026-09-06", notes: [{ heading: "Quieter update notices", body: "Routine updates no longer replay unchanged What's New information." }] },51 { 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." }] },52 { 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." }] },53 { 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." }] },54 {55 version: "5.1.3", releasedAt: "2026-09-05", importance: "breaking",56 notes: [57 { heading: "Passphrases & long passwords", body: "Peach supports passphrases and passwords up to 256 characters." },58 { 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." },59 ],60 },61];6263export function hasReleaseNotes(): boolean { return RELEASES.length > 0; }6465const UPGRADE_FROM_KEY = "peach_release_notes_from";66const LEGACY_SEEN_KEY = "peach_whats_new_seen";6768function versionParts(version: string): [number, number, number] | null {69 const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);70 return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;71}7273export function compareVersions(left: string, right: string): number {74 const a = versionParts(left); const b = versionParts(right);75 if (!a || !b) return 0;76 for (let index = 0; index < 3; index += 1) if (a[index] !== b[index]) return a[index]! - b[index]!;77 return 0;78}7980export function importantReleasesSince(version: string): PeachRelease[] {81 const currentVersion = PEACH_VERSION === "0.0.0" ? RELEASES[0]!.version : PEACH_VERSION;82 return selectImportantReleases(RELEASES, version, currentVersion);83}8485export function selectImportantReleases(86 releases: PeachRelease[],87 fromVersion: string,88 throughVersion: string,89): PeachRelease[] {90 return releases.filter((release) =>91 release.importance !== undefined &&92 compareVersions(release.version, fromVersion) > 0 &&93 compareVersions(release.version, throughVersion) <= 094 );95}9697export async function recordInstalledVersion(details: chrome.runtime.InstalledDetails): Promise<void> {98 if (details.reason !== "update" || !details.previousVersion) return;99 const stored = await chrome.storage.local.get(UPGRADE_FROM_KEY);100 if (stored[UPGRADE_FROM_KEY] === undefined) await chrome.storage.local.set({ [UPGRADE_FROM_KEY]: details.previousVersion });101}102103export async function pendingImportantReleases(): Promise<PeachRelease[]> {104 try {105 const stored = await chrome.storage.local.get([UPGRADE_FROM_KEY, LEGACY_SEEN_KEY]);106 const from = stored[UPGRADE_FROM_KEY];107 return typeof from === "string" && versionParts(from) ? importantReleasesSince(from) : [];108 } catch { return []; }109}110111export async function shouldShowWhatsNew(): Promise<boolean> {112 return (await pendingImportantReleases()).length > 0;113}114115export async function markWhatsNewSeen(): Promise<void> {116 try {117 await chrome.storage.local.remove([UPGRADE_FROM_KEY, LEGACY_SEEN_KEY]);118 } catch {119 120 }121}