release-notes.ts

5.1 KB · raw

1/** Curated release history and post-update notice selection. */23declare 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.47",25    releasedAt: "2026-09-11",26    notes: [{27      heading: "Repair Sync reset and peer removal",28      body: "Sync reset now creates the new device identity, and removing a peer still works when the old identity needs migration.",29    }],30  },31  {32    version: "5.2.46",33    releasedAt: "2026-09-11",34    importance: "breaking",35    notes: [{36      heading: "Sync needs one deliberate repair",37      body: "This security update starts a new Sync generation. Update Peach on every other device, reset Sync here, then pair each device again. Your vault and recovery words are unchanged; old device trust is archived, not silently reused.",38    }],39  },40  { 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." }] },41  { 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." }] },42  { version: "5.2.5", releasedAt: "2026-09-06", notes: [{ heading: "Quieter update notices", body: "Routine updates no longer replay unchanged What's New information." }] },43  { 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." }] },44  { 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." }] },45  { 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." }] },46  {47    version: "5.1.3", releasedAt: "2026-09-05", importance: "breaking",48    notes: [49      { heading: "Passphrases & long passwords", body: "Peach supports passphrases and passwords up to 256 characters." },50      { 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." },51    ],52  },53];5455export function hasReleaseNotes(): boolean { return RELEASES.length > 0; }5657const UPGRADE_FROM_KEY = "peach_release_notes_from";58const LEGACY_SEEN_KEY = "peach_whats_new_seen";5960function versionParts(version: string): [number, number, number] | null {61  const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);62  return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;63}6465export function compareVersions(left: string, right: string): number {66  const a = versionParts(left); const b = versionParts(right);67  if (!a || !b) return 0;68  for (let index = 0; index < 3; index += 1) if (a[index] !== b[index]) return a[index]! - b[index]!;69  return 0;70}7172export function importantReleasesSince(version: string): PeachRelease[] {73  const currentVersion = PEACH_VERSION === "0.0.0" ? RELEASES[0]!.version : PEACH_VERSION;74  return selectImportantReleases(RELEASES, version, currentVersion);75}7677export function selectImportantReleases(78  releases: PeachRelease[],79  fromVersion: string,80  throughVersion: string,81): PeachRelease[] {82  return releases.filter((release) =>83    release.importance !== undefined &&84    compareVersions(release.version, fromVersion) > 0 &&85    compareVersions(release.version, throughVersion) <= 086  );87}8889export async function recordInstalledVersion(details: chrome.runtime.InstalledDetails): Promise<void> {90  if (details.reason !== "update" || !details.previousVersion) return;91  const stored = await chrome.storage.local.get(UPGRADE_FROM_KEY);92  if (stored[UPGRADE_FROM_KEY] === undefined) await chrome.storage.local.set({ [UPGRADE_FROM_KEY]: details.previousVersion });93}9495export async function pendingImportantReleases(): Promise<PeachRelease[]> {96  try {97    const stored = await chrome.storage.local.get([UPGRADE_FROM_KEY, LEGACY_SEEN_KEY]);98    const from = stored[UPGRADE_FROM_KEY];99    return typeof from === "string" && versionParts(from) ? importantReleasesSince(from) : [];100  } catch { return []; }101}102103export async function shouldShowWhatsNew(): Promise<boolean> {104  return (await pendingImportantReleases()).length > 0;105}106107export async function markWhatsNewSeen(): Promise<void> {108  try {109    await chrome.storage.local.remove([UPGRADE_FROM_KEY, LEGACY_SEEN_KEY]);110  } catch {111    // Best effort: a storage failure may make an important notice reappear.112  }113}