// User-facing release notes. One entry per released version, newest first. The end-of-line
// `sha` is the repo commit the release was cut from (our stand-in for an issue/ticket ref);
// it's attached when the version is tagged. `chores` are internal and hidden from the public
// Release Notes dialog by default.

export interface ReleaseEntry {
  version: string;
  date: string; // ISO date (YYYY-MM-DD)
  sha?: string; // short commit the release was tagged from
  summary?: string;
  features?: string[];
  fixes?: string[];
  chores?: string[];
}

export const RELEASE_NOTES: ReleaseEntry[] = [
  {
    version: "0.20.1",
    date: "2026-07-01",
    summary: "A refreshed sign-in / landing page.",
    chores: [
      "Rewrote the landing-page copy and replaced its preview screenshots with richer, real examples. No change to the app itself.",
    ],
  },
  {
    version: "0.20.0",
    date: "2026-07-01",
    summary: "Saved views: keep several filter setups and switch between them in one click.",
    features: [
      "Saved views: save your current feed filters (and sort) under a name, then apply them again with a single click. Rename them, drag to reorder, share a view by link, and star one as your default — the default loads automatically when you open the app. They live in a new “Saved views” box at the top of the filter sidebar.",
    ],
    fixes: [
      "The “Filters active” count and Clear all now also cover the Source filter and the Mine/Library switch, so clearing gives a truly clean slate — back to Mine with search results hidden. The default view (Mine, unwatched, no search results) is unchanged.",
      "The search box now has a clear (✕) button. Clearing your filters keeps the search text — the search has its own ✕ — and clearing the search returns the feed to its normal order.",
    ],
  },
  {
    version: "0.19.0",
    date: "2026-07-01",
    summary: "Channel pages, much smarter search, and self-tidying YouTube search results.",
    features: [
      "Channel pages: open any channel's own page inside Siftlode — banner, stats (subscribers, videos, views, joined) and its uploads, with Videos and About tabs. Click a channel name anywhere to open it.",
      "Explore channels you don't follow: opening an un-subscribed channel loads its recent uploads just for you — private until you subscribe. Channels you explore but don't keep tidy themselves away automatically after a while.",
      "Smarter search: results are now relevance-ranked and match far more than the title — a video's tags, its description, and even the searches that first surfaced it all count, so you can find things by meaning instead of exact words. In your own feed (Mine), a Source filter separates your subscriptions from your search finds.",
      "Temporary search results: live YouTube search results are clearly marked temporary — they clear themselves unless you watch or save one, with a “Clear now” button to do it at once. Pick how many to fetch (20/40/60/100), and videos you already have are sorted below fresh discoveries.",
      "Block channels: hide a channel everywhere — from search, your feed and channel pages — and manage your blocked channels from the Channel manager.",
      "The Channel manager gets a search box and clickable tag chips, and a floating “back to top” button appears on long pages.",
    ],
    fixes: [
      "The Back button no longer does nothing the first time: after you closed the video player (or a dialog) with its ✕/Escape and opened another, the next Back press now closes it right away — everywhere in the app.",
      "Reloading the page now keeps your YouTube search results on screen (they re-fetch for free) instead of dropping you back to the feed.",
    ],
  },
  {
    version: "0.18.0",
    date: "2026-06-29",
    summary: "Search all of YouTube from your feed, and new keyboard/scroll controls in the video player.",
    features: [
      "Live YouTube search: type a search and press Enter (or the YouTube button) to search all of YouTube right from the feed — results show up as normal cards you can play, save and add to playlists. They're kept out of your regular Library by default; a Source filter lets you show or hide search-found videos. Shorts and currently-live/upcoming results are left out automatically.",
      "Live search uses no YouTube API quota by default, so it's no longer limited to a handful of searches per day. (Admins can switch back to the official API under Configuration → Quota if the quota-free source ever stops working.)",
      "Video player shortcuts: press F for fullscreen, Space to play/pause, and scroll the mouse wheel over the video to change the volume (with an on-screen volume bar). YouTube's own controls — the seek bar, captions and settings — still work as before.",
      "Feed search now ignores accents, so searching “tiesto” also finds “Tiësto”.",
    ],
    fixes: [
      "After a live YouTube search, the Back button now closes the open video player first and keeps you on the search results, instead of jumping straight back to your feed.",
      "The search box no longer flickers or briefly blanks the feed while you type.",
    ],
  },
  {
    version: "0.17.0",
    date: "2026-06-29",
    summary: "Messaging and notification fixes, plus a large under-the-hood cleanup.",
    fixes: [
      "Switching between signed-in accounts no longer drops you on a blank chat: after you switch, a message you just received shows up in the right conversation instead of an empty screen.",
      "You're now reliably notified when a video you'd saved or added to a playlist is removed because it's no longer available on YouTube — this notice could previously be missed.",
      "“Time remaining” estimates (e.g. on sync progress) and a few small labels are now translated in Hungarian and German like the rest of the app.",
    ],
    chores: [
      "A large internal code cleanup: removed duplicated logic across the backend and frontend and factored out shared building blocks (form controls, the save/discard bar, popovers, browser-storage helpers, time/date formatters). No change to how the app behaves — groundwork that keeps future features consistent and quicker to build.",
    ],
  },
  {
    version: "0.16.2",
    date: "2026-06-26",
    summary: "Smoother navigation and tidier access-request handling.",
    fixes: [
      "The browser/mouse Back button now steps back the way you'd expect: from an open message conversation it returns to your conversation list (not the previous module), and it closes the video player or an open dialog instead of jumping off the page.",
      "Access requests: the “Review” link opens straight to the Access requests tab, the notice clears itself the moment you approve (no refresh needed), and a leftover sign-in link no longer lingers in the address bar.",
    ],
  },
  {
    version: "0.16.1",
    date: "2026-06-26",
    summary: "Clearer action messages, and a fix for background syncing on self-hosted setups.",
    fixes: [
      "Action confirmations now name what they acted on — which channel was unsubscribed or reset, which address was added to a list, which tag was deleted, and which playlist was reloaded or synced.",
      "Background syncing keeps working when the server's public IP changes: an instance can now be pointed at a fixed-IP egress proxy, so an IP-restricted YouTube API key no longer breaks after a network change.",
    ],
  },
  {
    version: "0.16.0",
    date: "2026-06-26",
    summary: "Private messaging: chat with other members in real time, end-to-end encrypted.",
    features: [
      "A new Messages module: send direct messages to other members of your instance. Messages are end-to-end encrypted — only you and the person you're chatting with can read them, not even an admin. The first time you open it, you set a message passphrase that protects your key; it never leaves your device.",
      "Real-time delivery: messages arrive instantly, with an unread badge on the Messages icon. A new message pops up (or flashes) a small Messenger-style chat window in the bottom-right corner that you can keep using while you browse — minimise, close, or open several at once.",
      "A friendly Siftlode welcome message greets you in your inbox on first arrival.",
    ],
  },
  {
    version: "0.15.0",
    date: "2026-06-25",
    summary: "A faster, smoother feed that stays light no matter how far you scroll.",
    features: [
      "The feed now draws only the videos currently on screen, so scrolling stays fluid and the page stays light even after you've loaded thousands of videos.",
      "Paging through the feed is quicker and steadier: scrolling deep into a large catalogue no longer slows down, and videos arriving in the background while you scroll can no longer cause an item to show up twice or be skipped.",
    ],
  },
  {
    version: "0.14.1",
    date: "2026-06-21",
    summary:
      "Internal cleanup: the project's original working name was fully retired in favour of Siftlode.",
    chores: [
      "Renamed the last remaining references to the project's original codename throughout the codebase, deployment config and database identity. No behavioural change. One side effect: locally remembered view preferences (theme, feed filters, dismissed hints) reset to their defaults once, because the browser-storage keys were renamed too.",
    ],
  },
  {
    version: "0.14.0",
    date: "2026-06-21",
    summary:
      "Run your own Siftlode: a guided first-run setup and a one-command self-host package.",
    features: [
      "A first-run setup wizard: the very first time a fresh instance is opened, a guided wizard walks you through creating the first admin account and (optionally) entering your Google and email credentials — no editing config files by hand. Once finished, the instance is marked configured and the wizard steps aside.",
      "Google sign-in is now optional: if an instance hasn't been given Google credentials, the Google buttons and YouTube-account features are simply hidden, so a self-hoster can run the app with email-and-password accounts only.",
    ],
    chores: [
      "A one-command self-host package: a ready-made compose file with a bundled database plus install scripts for Linux/macOS and Windows that generate the needed secrets, start everything and print the setup URL. The app now ships as a prebuilt image, so hosts pull the exact released artifact instead of building it.",
    ],
  },
  {
    version: "0.13.0",
    date: "2026-06-19",
    summary:
      "Sign in with email & password (not just Google), a redesigned welcome page, account management for admins, and self-service account deletion.",
    features: [
      "Sign in with an email and password, alongside Google. Register with email+password (with email verification and admin approval), set or change a password under Settings → Account, and link a Google account to your existing account — or set a password on a Google-only account — so either method gets you in.",
      "A redesigned welcome page: a short product tour with screenshots you can click to enlarge, and a one-click way to try the shared demo.",
      "Admin account management: a Users page with tabs for roles, access requests and the demo whitelist. Promote or demote users, suspend or unsuspend an account (a suspended user can't sign in by any method and is signed out at once), and delete an account. The affected person is emailed on approval, role change, suspension, reinstatement and deletion.",
      "Delete your account yourself: Settings → Account now has a permanent “delete my account and all data” option that erases your subscriptions, tags, watch history and playlists, revokes the app's access to your Google account, and emails you a confirmation.",
    ],
    fixes: [
      "Landing-page screenshots now appear in the real app, not only the dev preview; a suspended or deleted account is taken to the login page right away with a clear explanation; and the login page no longer occasionally flickers.",
      "Signing in with Google now correctly counts your email as verified, and an admin-assigned role is kept across logins instead of being reset.",
    ],
    chores: [
      "Tab-ified the admin Configuration and Users pages, and added a reusable tab and image-lightbox component.",
      "Self-hosting without email configured still works: registrations are auto-verified and gated by admin approval. The demo account now shows sample channels in its Channel manager.",
    ],
  },
  {
    version: "0.12.0",
    date: "2026-06-19",
    summary:
      "A dedicated Usage & stats page, a live Configuration page for admins, and polish on the channel-discovery list.",
    features: [
      "Usage & stats is now its own page (moved out of Settings): see your sync status and your personal API usage at a glance, with a clear, translated breakdown by action. Admins get an extra System tab with the instance-wide quota dashboard and the background-sync pause control.",
      "“Discover from playlists” now shows each channel's total video count, so you can size it up before following — and subscribing asks for confirmation first, since it changes your real YouTube account and uses a little quota.",
    ],
    chores: [
      "Admins can edit operational settings live from a new Configuration page — email/SMTP, the YouTube API key, the daily quota budget, and backfill/Shorts-probe limits — stored in the database and applied without a redeploy. Secrets (SMTP password, API key) are encrypted and write-only.",
      "Standardized the names of API-usage actions with full English/Hungarian/German labels, and unified the version/demo banners into one reusable component.",
    ],
  },
  {
    version: "0.11.2",
    date: "2026-06-19",
    summary: "Clearer messages when a YouTube action can't be completed.",
    fixes: [
      "When a YouTube action can't go through — syncing or pushing a playlist, removing a playlist on YouTube, or looking up a video — you now get a clear explanation of why, instead of a misleading “connection lost” notice.",
    ],
  },
  {
    version: "0.11.1",
    date: "2026-06-19",
    summary: "A fix for subscribing from the discovery list.",
    fixes: [
      "Subscribing to a channel you already follow on YouTube now simply records it here instead of showing a misleading “connection lost” error — which also clears the case where such a channel kept reappearing under “Discover from playlists”.",
    ],
    chores: [
      "YouTube-side action failures now surface as a clear message instead of being mistaken for a transient connection drop.",
    ],
  },
  {
    version: "0.11.0",
    date: "2026-06-19",
    summary:
      "Discover channels from your playlists, notifications that link to where they point, and a clearer, faster background sync.",
    features: [
      "Discover channels from your playlists: the Channel manager has a new “Discover from playlists” tab listing channels that appear in your playlists but that you don't follow yet. Each shows its subscriber count and avatar so you can size it up first, then follow it in one click — your own channel is left out.",
      "Notifications now link to where they point, and the links keep working after a reload: subscribing names the channel with shortcuts to open it in the Channel manager or on YouTube; a “Marked watched” notice gains a “Find in feed” action (matching “Hidden”); and a finished background job links back to the Scheduler.",
    ],
    fixes: [
      "The header's sync indicator now spins only while a sync is actually running — instead of perpetually whenever some full-history backfill was still pending — and it refreshes more promptly while work is in progress.",
      "“N without full history” in the header now reliably opens the Channel manager on the right tab and shows exactly those channels, even if you'd previously left a channel filter applied.",
      "New uploads are picked up faster: the background feed check now reads many channels' feeds at once instead of one by one, cutting a full pass from minutes to seconds.",
    ],
    chores: [
      "Shared a single channel-link component and YouTube-URL helper across the app, and the admin Scheduler now shows live progress for every job type.",
    ],
  },
  {
    version: "0.10.0",
    date: "2026-06-19",
    summary: "Settings you save explicitly, plus a calmer, more honest playback experience.",
    features: [
      "Settings now save explicitly: your changes preview instantly, but only apply to your account when you press Save — with a clear “Settings saved” confirmation. A Discard button reverts everything, and switching to another section with unsaved changes asks before discarding them.",
    ],
    fixes: [
      "The in-app player no longer throws a spurious “Server error (502)” when a video finishes or while the server is briefly busy: passing hiccups are retried automatically, and if the server is momentarily unreachable you get a single “connection lost” notice that clears itself the moment it's back — instead of an error you had to dismiss.",
      "Confirmations like “Marked watched” or “Hidden” now appear only after the server has actually applied the change, so you'll never see a success message for something that didn't go through.",
      "Tidied the Settings page height — no more unnecessary empty space and scrolling.",
    ],
  },
  {
    version: "0.9.0",
    date: "2026-06-18",
    summary: "A notifications inbox, and automatic clean-up of videos that can no longer be played.",
    features: [
      "New Notifications center in the left sidebar, with an unread badge: one place for both durable system updates (about your library and background jobs) and your recent activity (with quick Unhide / Unwatch / Find-in-feed actions). Mark items read, dismiss them individually, or clear everything. Pop-up toasts still appear as before.",
      "Automatic library maintenance: a background job spots videos that can no longer be played anywhere — deleted, made private, or premieres that never went live — hides them from your feed right away, and removes them after a grace period. Genuine 24/7 livestreams are left alone.",
      "If a video you'd saved or added to a playlist gets removed this way, you get a single summary notification listing them — never one message per video.",
      "Admin Scheduler: run any background job on demand with a “Run now” button (or “Start all now”), watch a live progress bar while long jobs run, and get an inbox notification with the result when a job you started finishes.",
    ],
  },
  {
    version: "0.8.0",
    date: "2026-06-18",
    summary: "Richer channel columns, a proper tag workflow, video reset, and clearer errors.",
    features: [
      "Channel manager: new sortable columns — last upload, total length, and a Normal/Shorts/Live breakdown — with subscriber counts shown compactly (e.g. 919K). Columns size to their content.",
      "Tags, reworked: each channel row now shows only the tags you've attached, with a “+” to add or remove them per channel. A tag manager (open it from the Channel manager or the feed sidebar) lets you add, rename and delete tags — deleting only asks to confirm when a tag is actually in use.",
      "Filter the feed by a tag: click a tag on a channel, and a new “Your tags” widget in the feed sidebar shows that filter so you can see and clear it. In the tag manager, hovering a tag's channel count lists those channels, each a link that jumps to it in the Channel manager.",
      "Video cards get a reset action that returns a video to pristine — clearing watch progress and status, as if you'd never opened it.",
    ],
    fixes: [
      "When the server can't complete an action (for example a duplicate tag name), you now get a clear pop-up explaining why, instead of a cryptic failure.",
      "Pressing Esc with a dialog stacked over another now closes only the top one, leaving your work underneath open.",
    ],
  },
  {
    version: "0.7.0",
    date: "2026-06-17",
    summary: "A redesigned, sortable Channel manager — plus a reorganized sidebar and several fixes.",
    features: [
      "Channel manager is now a sortable, filterable table: sort by any column, filter channels by name or tag straight from the headers, choose how many rows per page (or show them all), and jump to any page. Your sorting, filters and page are remembered across reloads.",
      "Channel rows: open a channel on YouTube (middle-click the name or the ↗ icon), a single “fully synced” badge once a channel is fully caught up, and instant tag toggling. Admins can reset a channel to re-fetch it from scratch.",
      "Reorganized left sidebar: your content (Feed, Channels, Playlists) and the admin tools (Stats, Scheduler) are now grouped, and the language, About and notifications controls moved into the sidebar. Pop-up notifications now appear bottom-left, by the bell.",
      "Playlists: the “new playlist” box moved to the top of the list.",
    ],
    fixes: [
      "Marking a video watched at the end of playback now sticks — it leaves the Unwatched feed and stays gone after a refresh.",
      "Settings now remembers which tab you were on after a reload.",
      "The usage chart's daily bars are always visible now, not just on hover.",
    ],
  },
  {
    version: "0.6.0",
    date: "2026-06-16",
    summary: "Admins get a live Background Scheduler dashboard.",
    features: [
      "New admin Scheduler page: a live, self-refreshing view of the background jobs — what's running, each job's last result and a countdown to its next run — plus the work still queued and the shared API quota. Each job has a tooltip explaining what it does, and its run frequency is editable inline.",
    ],
  },
  {
    version: "0.5.1",
    date: "2026-06-16",
    summary: "A clearer message when a video can't play in the in-app player.",
    fixes: [
      "When a video can't be played here — some music tracks and other videos have embedding disabled by their owner — the player now shows a clear note and an “Open on YouTube” button instead of a blank error screen.",
    ],
  },
  {
    version: "0.5.0",
    date: "2026-06-16",
    summary: "Clearer live videos — and they now settle into normal videos once they end.",
    features: [
      "Live and premiere videos now show a LIVE / upcoming badge where the duration usually sits, so a missing runtime is obviously by design, not a gap.",
    ],
    fixes: [
      "When a live stream ends, it now updates by itself into a normal video with its real length, instead of staying stuck as “live” with no duration.",
    ],
    chores: [
      "Shared demo-account mode: a curated whitelist can preview the app (shared library, playlists, hiding) without signing in; admin whitelist + state reset in Settings.",
    ],
  },
  {
    version: "0.4.1",
    date: "2026-06-16",
    summary: "Feed controls above the videos, and clearer view counts and dates.",
    features: [
      "The view filter (Unwatched / In progress / All / …) and the content type (Normal / Shorts / Live) are now quick chips right above the videos.",
      "Cleaner ordering: pick what to sort by, then flip ascending/descending with one arrow (and 'Most viewed' is now 'Popular').",
      "Video cards and the player show the exact upload date next to '… ago', and the full view count on hover.",
    ],
  },
  {
    version: "0.4.0",
    date: "2026-06-16",
    summary: "A clearer left-hand navigation, a glassier look, and account switching.",
    features: [
      "New left navigation sidebar: Feed, Channels, Playlists and Stats are now always visible (no longer tucked under your avatar), and the rail collapses to icons when you want more room.",
      "Switch accounts without signing in again: the account menu lists everyone signed in on this browser — pick one to switch instantly, or “Add another account”. Signing out drops you to the next account if you have one.",
      "Settings is now its own page that opens right where you are, instead of a panel sliding in from the far side.",
      "The browser/back button now steps back through the app (Feed, Channels, …) instead of leaving the app.",
      "A frosted-glass refresh across the navigation, header and dialogs.",
    ],
  },
  {
    version: "0.3.0",
    date: "2026-06-16",
    summary:
      "Playlists — build your own, mirror your YouTube ones, and sync edits back to YouTube.",
    features: [
      "Local playlists: create named, ordered playlists, reorder by drag, and add videos straight from the feed or the player. Play a whole playlist with auto-advance and prev/next.",
      "Watch later is now a built-in playlist — the bookmark button adds to it, and you can play and manage it like any other list.",
      "Your YouTube playlists are mirrored in automatically and kept fresh, shown with a YouTube badge and an “open on YouTube” link.",
      "Two-way YouTube sync: export a local playlist to YouTube, or push your edits (add, remove, reorder, rename) back to a linked playlist. Every push shows an estimate and a confirm first, because YouTube playlist writes are quota-heavy.",
      "Edit mirrored playlists freely — your unsynced changes are protected from the automatic refresh, an “Unsynced” marker shows when you have pending edits, and “Reset to YouTube” discards them to reload the original.",
      "Sort a playlist by title, duration or channel (ascending/descending) and optionally group by channel — with full undo/redo (buttons and Ctrl/Cmd+Z / Ctrl+Y).",
      "The playlist list can be ordered by name, item count or total length (and float your unsynced lists to the top); it shows each list’s total length and remembers your selection.",
    ],
  },
  {
    version: "0.2.0",
    date: "2026-06-15",
    summary:
      "Browse beyond your own subscriptions, and a much smarter filter sidebar.",
    features: [
      "Shared library: a new Mine / Library switch in the header lets you browse every channel the community has added — not just your own subscriptions — and even works without granting YouTube access. Your watch, save and hide state always stays private to you.",
      "Smarter filter chips: topic and language chips now show live counts for your current view and hide the ones that no longer match anything, so narrowing down is quicker. Chips are ordered by size, and topics have a clear Any / All match toggle (All = channels that have all the selected topics).",
      "“Surprise me” ordering now has a reshuffle button to reroll the order, and the topic/language chips show how many channels fall under each.",
      "Share a view: copy a link that reproduces your current filters. Filters are otherwise no longer kept in the address bar.",
    ],
    fixes: [
      "The channel manager now tells apart a full-history backfill you requested from one another member already queued, and the header shows “fetching history” while the back-catalogue is still downloading instead of claiming everything is synced.",
    ],
  },
  {
    version: "0.1.0",
    date: "2026-06-15",
    // sha filled in when v0.1.0 is tagged at release time.
    summary:
      "First release: a self-hosted, multi-user reader for your own YouTube subscriptions — " +
      "fast local-first feed with rich filtering, in-app playback with resume, and channel management.",
    features: [
      "Multi-user feed of your own YouTube subscriptions: invite-only Google sign-in, per-user watch/save/hide state, encrypted token storage.",
      "Ingest: subscription import, free RSS new-video detection, recent-first and full-history backfill, metadata enrichment (duration, views, category, Shorts & livestream classification), a shared daily API-quota guard, and a background scheduler.",
      "Automatic tagging: system tags for channel language and topic (your own tags are never overwritten).",
      "Reader UI: grid/list feed scoped to your subscriptions; faceted tag filters, content-type toggles (Normal / Shorts / Live), date range, search and sort; four colour schemes (dark/light) with adjustable text size.",
      "In-app player: a modal YouTube player that resumes where you left off, auto-marks watched near the end, and turns description timestamps and links into clickable seeks.",
      "Watch progress: a resume progress bar on video cards, Continue / Restart buttons, and an “In progress” feed filter — your position is saved server-side, so it follows you across devices.",
      "Channel manager: per-channel priority, hide, personal tags, sync badges, and per-channel full-history opt-in.",
      "Header status: your video count vs. the whole catalogue, sync progress, and (for admins) a pause control; onboarding wizard; notification centre; admin usage & quota stats.",
      "Multilingual interface — switch between English, Hungarian and German; your choice is saved to your account and the default is guessed from your Google locale.",
      "About dialog and this Release Notes view, with a heads-up banner when a new version ships.",
    ],
    fixes: [
      "Backfill no longer skips the band of videos sitting on the 365-day boundary page.",
      "A channel whose full catalogue is already stored is no longer stuck showing “needs full history”.",
    ],
    chores: [
      "Public-readiness repo hygiene: internal planning/infra details removed, build stamped with version/commit.",
    ],
  },
];

export const CURRENT_VERSION = RELEASE_NOTES[0]?.version ?? "dev";
