Files
immich-folio/lib/journal.ts

836 lines
30 KiB
TypeScript
Raw Permalink Normal View History

release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
/**
* Journal & Storytelling Types, Parser and Serializer.
* Client-safe pure TypeScript module (no Node.js fs dependencies).
*/
export interface JournalFrontmatter {
title?: string;
subtitle?: string;
/** SEO description. Content pages use it (#722); journal entries ignore it. */
description?: string;
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
date?: string;
author?: string;
coverAssetId?: string;
layout?: string;
password?: string;
draft?: boolean;
}
export type JournalBlock =
| { type: 'heading'; level: number; text: string }
| { type: 'paragraph'; html: string }
| { type: 'quote'; text: string; author?: string }
| { type: 'photo'; assetId: string; caption?: string; layout: 'fullbleed' | 'wide' | 'contained' }
| { type: 'photo-pair'; assetIds: [string, string]; caption?: string }
| { type: 'photo-grid'; assetIds: string[]; caption?: string }
| { type: 'facts'; items: Array<{ label: string; value: string }> }
| { type: 'map'; caption?: string; line: boolean; items: MapItem[]; pins?: MapPin[] }
| {
/**
* "x photos from an album". Expanded on the server into photo blocks
* (lib/journalAlbum.ts) before the page renders, so the client never
* sees this type; the studio expands it through the admin assets route.
*/
type: 'album';
albumId: string;
count?: number;
skip?: number;
layout: AlbumBlockLayout;
caption?: string;
};
export type AlbumBlockLayout = 'grid' | 'pairs' | 'wide';
/**
* What an author puts on a journal map, in the order the line is drawn.
* A typed point is published as typed. A photo item is placed by its EXIF
* position under the album's `location:` precision; `all-photos` expands to
* every geotagged photo of the entry not already listed.
*/
export type MapItem =
| { kind: 'point'; label?: string; lat: number; lng: number }
| { kind: 'photo'; assetId: string }
| { kind: 'all-photos' };
export function isValidCoordinate(lat: number, lng: number): boolean {
return (
Number.isFinite(lat) && Number.isFinite(lng) && Math.abs(lat) <= 90 && Math.abs(lng) <= 180
);
}
/**
* A position on a journal map. Never authored and never serialized: the
* server derives pins from the entry's own geotagged photos at render time
* (lib/journalMap.ts), already quantised to the album's `location:` setting.
*/
export interface MapPin {
lat: number;
lng: number;
label?: string;
}
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
export interface ParsedJournal {
frontmatter: JournalFrontmatter;
blocks: JournalBlock[];
referencedAssetIds: string[];
}
/**
* Every asset id a block refers to, in block order, without duplicates.
* An empty id is an unfilled placeholder (the block editor's "+ Pick" tile),
* not a reference — it is skipped so nothing probes or renders it.
*/
export function collectAssetIds(blocks: readonly JournalBlock[]): string[] {
const ids = new Set<string>();
for (const block of blocks) {
if (block.type === 'photo') {
if (block.assetId) ids.add(block.assetId);
} else if (block.type === 'photo-pair' || block.type === 'photo-grid') {
for (const id of block.assetIds) if (id) ids.add(id);
} else if (block.type === 'map') {
for (const item of block.items)
if (item.kind === 'photo' && item.assetId) ids.add(item.assetId);
}
}
return Array.from(ids);
}
/**
* The same block with every asset id passed through `fn` — the one place that
* knows which block types carry ids, so the page that swaps raw UUIDs for
* tokens does not grow a branch per type.
*/
export function mapBlockAssetIds(block: JournalBlock, fn: (id: string) => string): JournalBlock {
switch (block.type) {
case 'photo':
return { ...block, assetId: fn(block.assetId) };
case 'photo-pair':
return { ...block, assetIds: [fn(block.assetIds[0]), fn(block.assetIds[1])] };
case 'photo-grid':
return { ...block, assetIds: block.assetIds.map(fn) };
case 'map':
return {
...block,
items: block.items.map((item) =>
item.kind === 'photo' ? { ...item, assetId: fn(item.assetId) } : item,
),
};
default:
return block;
}
}
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
export interface JournalEntrySummary {
slug: string;
filename: string;
frontmatter: JournalFrontmatter;
excerpt: string;
wordCount: number;
readingTimeMinutes: number;
}
const HTML_ESCAPES: Record<string, string> = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
};
/**
* Make an author's text inert as HTML.
*
* This escapes rather than filters. The previous implementation stripped
* `<script>` tags, `on*="..."` handlers and the literal string `javascript:`,
* which is a denylist and was trivially bypassable: `<img src=x onerror=alert(1)>`
* (unquoted handler), `onerror='...'` (single quotes), `<svg onload=...>` (not a
* script tag) and `javasjavascript:cript:` (the replacement recombines) all
* passed through into `dangerouslySetInnerHTML`.
*
* With escaping there is nothing to enumerate: the only tags in the output are
* the ones renderInlineMarkdown emits itself.
*/
export function sanitizeHtml(input: string): string {
return input.replace(/[&<>"']/g, (char) => HTML_ESCAPES[char]);
}
/**
* Reverse of sanitizeHtml, for turning rendered block HTML back into Markdown.
* Without this a save would write `&lt;` into the file and the next parse would
* escape the `&` again, corrupting the text a little more on every round trip.
*/
export function decodeHtmlEntities(input: string): string {
return input
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/&quot;/g, '"')
.replace(/&#39;/g, "'")
.replace(/&amp;/g, '&');
}
/**
* Schemes an author may link to. Everything else — `javascript:`, `data:`,
* `vbscript:` — renders as plain text instead of an anchor.
*/
const SAFE_URL = /^(?:https?:\/\/|mailto:|tel:|[./#])/i;
function isSafeUrl(url: string): boolean {
// Browsers ignore control characters and whitespace inside a scheme, so
// `java\tscript:` would run. Strip them before deciding.
return SAFE_URL.test(url.replace(/[\u0000-\u0020]/g, ''));
}
/** Sanitize a slug to only allow safe URL and filesystem characters */
export function isValidSlug(slug: string): boolean {
return /^[a-zA-Z0-9_-]+$/.test(slug) && !slug.includes('..');
}
export function sanitizeSlug(input: string): string {
return slugFieldValue(input.trim()).replace(/-$/, '') || 'untitled';
}
/**
* A slug field's value while it is being typed: sanitizeSlug() without the two
* steps that only suit a finished slug. Dropping the trailing "-" on every
* keystroke made a hyphen impossible to type ("about-" became "about", and the
* next key gave "aboutu"), and an emptied field jumped to "untitled". Pass the
* result through sanitizeSlug() before using it as a slug.
*
* Accented letters keep their base letter ("für" → "fur", "Straße" →
* "strasse"), as subpage slugs do; before, each one split the word ("f-r").
*/
export function slugFieldValue(input: string): string {
return input
.replace(/ß/g, 'ss')
.normalize('NFD')
.replace(/[̀-ͯ]/g, '')
.toLowerCase()
.replace(/[^a-z0-9_-]/g, '-')
.replace(/-+/g, '-')
.replace(/^-/, '');
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
}
/** Simple Markdown inline formatting (bold, italic, links) */
export function renderInlineMarkdown(text: string): string {
// Escape first: from here on every `<` and `"` in the string is the author's
// literal text, so the markdown rules below can only ever add the tags they
// build themselves, and a URL cannot break out of its href attribute.
let html = sanitizeHtml(text);
// Bold: **text** or __text__
//
// CodeQL flags the lazy group here as polynomial backtracking. It is left as
// is on purpose: rewriting it with a negated class (`\*\*([^*]+)\*\*`) removes
// the backtracking but also breaks nesting — `**bold *and italic* here**`
// then renders as `*<em>bold </em>and italic<em> here</em>*`. The input is
// Markdown written by an authenticated admin, never visitor input, so the
// worst case is an author slowing down their own page.
// `**bold**` works anywhere; `__bold__` only outside a word, matching
// CommonMark's intraword rule for `_` — otherwise `my_file_name` round-trips
// through `<em>` and comes back with asterisks in the middle of a word.
html = html.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');
html = html.replace(/(?<![\w])__(.*?)__(?![\w])/g, '<strong>$1</strong>');
// Italic: *text* or _text_, same intraword rule for `_`.
html = html.replace(/\*(.*?)\*/g, '<em>$1</em>');
html = html.replace(/(?<![\w])_(.*?)_(?![\w])/g, '<em>$1</em>');
// Links: [label](url). The URL may hold one level of balanced parentheses,
// as Wikipedia-style URLs do (`…/Foo_(bar)`); it used to end at the first
// `)` and leave the rest as text. The two alternatives start on disjoint
// characters, so this stays linear.
html = html.replace(/\[([^\]]+)\]\(((?:[^()]|\([^()]*\))+)\)/g, (match, label, url) => {
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
const trimmed = url.trim();
if (!isSafeUrl(trimmed)) return label;
return `<a href="${trimmed}" target="_blank" rel="noopener noreferrer">${label}</a>`;
});
return html;
}
/**
* Inverse of renderInlineMarkdown: walks the `<strong>`/`<em>`/`<a href>` tags
* it produces (and only those — anything else is dropped, keeping its
* content, matching what the previous flat regex did for unknown tags) back
* into their Markdown source, recursing so a link around bold text, or bold
* text around a link, both come back correctly. Entities are decoded once at
* the end, since every text run and the `href` value are the only places
* they appear — the markdown syntax this function adds is never itself
* entity-escaped.
*/
function inlineHtmlToMarkdownRaw(html: string): string {
let out = '';
let i = 0;
while (i < html.length) {
if (html[i] !== '<') {
out += html[i];
i++;
continue;
}
const openMatch = /^<(\w+)([^>]*)>/.exec(html.slice(i));
if (!openMatch) {
out += html[i];
i++;
continue;
}
const [full, tagName, attrs] = openMatch;
// Find this tag's matching close, tracking nested opens of the same tag.
const closeTag = `</${tagName}>`;
let depth = 1;
let scan = i + full.length;
let closeAt = -1;
while (scan < html.length) {
const nextClose = html.indexOf(closeTag, scan);
if (nextClose === -1) break;
const nextOpen = html.indexOf(`<${tagName}`, scan);
if (nextOpen !== -1 && nextOpen < nextClose) {
depth++;
scan = nextOpen + 1;
} else {
depth--;
scan = nextClose + closeTag.length;
if (depth === 0) {
closeAt = nextClose;
break;
}
}
}
if (closeAt === -1) {
// Unmatched tag: not something this renderer produces, pass it through
// as literal text rather than losing it.
out += html[i];
i++;
continue;
}
const innerMd = inlineHtmlToMarkdownRaw(html.slice(i + full.length, closeAt));
if (tagName === 'strong' || tagName === 'b') out += `**${innerMd}**`;
else if (tagName === 'em' || tagName === 'i') out += `*${innerMd}*`;
else if (tagName === 'a') {
const href = /\shref="([^"]*)"/.exec(attrs)?.[1] ?? '';
out += `[${innerMd}](${href})`;
} else {
out += innerMd;
}
i = closeAt + closeTag.length;
}
return out;
}
export function inlineHtmlToMarkdown(html: string): string {
return decodeHtmlEntities(inlineHtmlToMarkdownRaw(html));
}
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
const isWhitespace = (char: string) => char.trim() === '';
/**
* Split `Quote -- Author` at the first separator surrounded by whitespace.
*
* A plain scan rather than a pattern. The original `/^(.*?)(?:\s+--\s+(.+))?$/`
* wrapped a lazy group around an optional one — the quadratic case — and its
* first replacement, `/\s+--\s+/`, was reported as polynomial backtracking in
* turn. This is linear and needs no reasoning about the engine at all.
*/
export function splitQuoteAuthor(text: string): { body: string; author?: string } {
for (
let hyphens = text.indexOf('--');
hyphens !== -1;
hyphens = text.indexOf('--', hyphens + 2)
) {
let start = hyphens;
while (start > 0 && isWhitespace(text[start - 1])) start--;
let end = hyphens + 2;
while (end < text.length && isWhitespace(text[end])) end++;
// Whitespace is required on both sides, so `a--b` is not a separator.
if (start === hyphens || end === hyphens + 2) continue;
return { body: text.slice(0, start), author: text.slice(end).trim() || undefined };
}
return { body: text };
}
/** Parse frontmatter (YAML block delimited by ---) */
export function parseFrontmatter(content: string): {
frontmatter: JournalFrontmatter;
body: string;
} {
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);
if (!frontmatterMatch) {
return { frontmatter: {}, body: content };
}
const rawYaml = frontmatterMatch[1];
const body = content.slice(frontmatterMatch[0].length);
const frontmatter: JournalFrontmatter = {};
for (const line of rawYaml.split('\n')) {
const trimmed = line.trim();
if (!trimmed || trimmed.startsWith('#')) continue;
const colonIdx = trimmed.indexOf(':');
if (colonIdx === -1) continue;
const key = trimmed.slice(0, colonIdx).trim();
let val = trimmed.slice(colonIdx + 1).trim();
if (val.length >= 2 && val.startsWith('"') && val.endsWith('"')) {
// Undo the escaping serializeJournalMarkdown applies. Without this a title
// containing a quote or a backslash gained one more backslash on every
// save/load cycle.
val = val.slice(1, -1).replace(/\\([\\"])/g, '$1');
} else if (val.length >= 2 && val.startsWith("'") && val.endsWith("'")) {
val = val.slice(1, -1);
}
if (key === 'title') frontmatter.title = val;
else if (key === 'subtitle') frontmatter.subtitle = val;
else if (key === 'description') frontmatter.description = val;
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
else if (key === 'date') frontmatter.date = val;
else if (key === 'author') frontmatter.author = val;
else if (key === 'coverAssetId') frontmatter.coverAssetId = val;
else if (key === 'layout') frontmatter.layout = val;
else if (key === 'password') frontmatter.password = val;
else if (key === 'draft') frontmatter.draft = val === 'true' || val === '1';
}
return { frontmatter, body };
}
/**
* Split a chunk before every line that starts a photo reference (`![`).
*
* Paragraphs are separated by blank lines, so two photo lines written without
* one, or a heading or sentence directly above a photo, used to arrive as a
* single chunk. No block pattern matched it and it fell through to the
* paragraph renderer, which printed the raw asset ids on the public page.
* Directive chunks (`::map`, `::facts`, `::album`) are left alone: their
* lines are key/value pairs, never photo references.
*/
function splitAtPhotoLines(chunk: string): string[] {
if (chunk.startsWith('::') || !/(?:^|\n)[ \t]*!\[/.test(chunk)) return [chunk];
const segments: string[] = [];
let current: string[] = [];
for (const line of chunk.split(/\r?\n/)) {
if (line.trimStart().startsWith('![') && current.length > 0) {
segments.push(current.join('\n').trim());
current = [];
}
current.push(line);
}
segments.push(current.join('\n').trim());
return segments.filter(Boolean);
}
/**
* Split a photo line, `![<target>](<caption>)`, into target and caption.
*
* The target ends at the first `]` on the line: asset ids, layouts and commas
* never contain one. The caption is everything after `](` up to the chunk's
* **last** `)`, so it may itself contain parentheses and links (`Gipfel
* (560 m)`, `see [map](https://…)`) and needs no escaping. The previous
* pattern, `\(([^)]*)\)$`, stopped at the first `)`. The serializer wrote such
* captions verbatim, the next parse rejected the line, the public page printed
* it as a paragraph with the raw asset ids, and the editor turned the photo
* into a text block. A line that pattern accepted has no `)` inside its
* caption, so it parses exactly as before.
*
* Every chunk starting with `![` is a photo line, even a malformed one (no
* `(`, text after the last `)`): it becomes a photo block whose caption keeps
* the stray text, never a paragraph that would print the target.
*/
function parsePhotoLine(chunk: string): { target: string; caption: string } | null {
if (!chunk.startsWith('![')) return null;
const firstLineEnd = chunk.indexOf('\n');
const firstLine = firstLineEnd === -1 ? chunk : chunk.slice(0, firstLineEnd);
const close = firstLine.indexOf(']');
const targetEnd = close === -1 ? firstLine.length : close;
const target = chunk.slice(2, targetEnd).trim();
let rest = chunk.slice(close === -1 ? targetEnd : targetEnd + 1);
if (rest.startsWith('(')) {
rest = rest.slice(1);
if (rest.endsWith(')')) rest = rest.slice(0, -1);
}
return { target, caption: rest.trim() };
}
2026-10-02 18:14:23 +02:00
/**
* A text line that begins like a photo reference. The serializer escapes it
* so a paragraph reading `![draft]` is not reloaded as a photo block — the
* parser splits a chunk at every line that starts with `![` and turns it into
* one (splitAtPhotoLines, parsePhotoLine). The escape is one backslash in
* front of whatever backslashes are already there, so a line that really
* starts with `\![` round-trips too. Only a line start needs it: elsewhere
* in a paragraph `![` means nothing to the parser.
*/
const PHOTO_LIKE_LINE = /^([ \t]*)(\\*)!\[/;
const ESCAPED_PHOTO_LIKE_LINE = /^([ \t]*)\\(\\*)!\[/;
function escapePhotoLikeLines(markdown: string): string {
return markdown
.split('\n')
.map((line) => line.replace(PHOTO_LIKE_LINE, '$1\\$2!['))
.join('\n');
}
function unescapePhotoLikeLines(markdown: string): string {
return markdown
.split(/\r?\n/)
.map((line) => line.replace(ESCAPED_PHOTO_LIKE_LINE, '$1$2!['))
.join('\n');
}
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
/** Parse Journal Markdown content into structured blocks */
export function parseJournalMarkdown(rawContent: string): ParsedJournal {
const { frontmatter, body } = parseFrontmatter(rawContent);
const blocks: JournalBlock[] = [];
// Split body into paragraph chunks separated by blank lines
const chunks = body
.split(/\r?\n\s*\r?\n/)
.map((c) => c.trim())
.filter(Boolean)
.flatMap(splitAtPhotoLines);
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
for (const chunk of chunks) {
// 0a. Map: `::map Caption`, then one line per pin in drawing order —
// `Label: lat, lng` or `lat, lng` for a typed point, `photo: <id>` for
// a photo placed by its GPS, `photos: all` for every geotagged photo
// of the entry, `line: off` to drop the connecting line. Pins are
// never in the file — see MapPin. Malformed lines are ignored.
const [mapFirst, ...mapRest] = chunk.split('\n');
const mapMatch = mapFirst.match(/^::map(?:[ \t]+(\S.*))?[ \t]*$/);
if (mapMatch) {
const caption = mapMatch[1]?.trim();
const items: MapItem[] = [];
let line = true;
const coords = (s: string) => {
const m = s.match(/^\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s*$/);
if (!m) return null;
const lat = Number(m[1]);
const lng = Number(m[2]);
return isValidCoordinate(lat, lng) ? { lat, lng } : null;
};
for (const raw of mapRest) {
const text = raw.trim();
if (!text) continue;
const colon = text.indexOf(':');
const key = colon === -1 ? '' : text.slice(0, colon).trim();
const value = colon === -1 ? text : text.slice(colon + 1).trim();
const lowerKey = key.toLowerCase();
if (lowerKey === 'line') {
line = !['off', 'false', 'no', '0'].includes(value.toLowerCase());
} else if (lowerKey === 'photos') {
if (value.toLowerCase() === 'all') items.push({ kind: 'all-photos' });
} else if (lowerKey === 'photo') {
for (const id of value.split(',')) {
const assetId = id.trim();
if (assetId) items.push({ kind: 'photo', assetId });
}
} else {
const pos = coords(value);
if (pos)
items.push(key ? { kind: 'point', label: key, ...pos } : { kind: 'point', ...pos });
}
}
blocks.push({
type: 'map',
caption: caption ? renderInlineMarkdown(caption) : undefined,
line,
items,
});
continue;
}
// 0b. Facts: a `::facts` line, then `Label: Value` lines in the same chunk.
// `::` because `![facts]` would read as a legacy photo reference and `#`
// and `>` are taken; no paragraph starts that way. The first colon
// splits, so `Time: 08:30` keeps its value. Lines without one, or with
// an empty side, are ignored.
if (chunk.startsWith('::facts')) {
const items = chunk
.split('\n')
.slice(1)
.flatMap((line) => {
const colon = line.indexOf(':');
if (colon === -1) return [];
const label = line.slice(0, colon).trim();
const value = line.slice(colon + 1).trim();
return label && value ? [{ label, value: renderInlineMarkdown(value) }] : [];
});
blocks.push({ type: 'facts', items });
continue;
}
// 0c. Album: `::album <id>` with `count:`, `skip:`, `layout:` and
// `caption:` lines. An empty id is the studio's unfilled placeholder.
const [albumFirst, ...albumRest] = chunk.split('\n');
const albumMatch = albumFirst.match(/^::album(?:[ \t]+(\S+))?[ \t]*$/);
if (albumMatch) {
let count: number | undefined;
let skip: number | undefined;
let layout: AlbumBlockLayout = 'grid';
let caption: string | undefined;
for (const raw of albumRest) {
const colon = raw.indexOf(':');
if (colon === -1) continue;
const key = raw.slice(0, colon).trim().toLowerCase();
const value = raw.slice(colon + 1).trim();
if (key === 'count' && /^\d+$/.test(value)) count = Number(value);
else if (key === 'skip' && /^\d+$/.test(value)) skip = Number(value);
else if (key === 'layout' && (value === 'grid' || value === 'pairs' || value === 'wide'))
layout = value;
else if (key === 'caption' && value) caption = renderInlineMarkdown(value);
}
blocks.push({
type: 'album',
albumId: albumMatch[1] ?? '',
...(count !== undefined ? { count } : {}),
...(skip ? { skip } : {}),
layout,
...(caption ? { caption } : {}),
});
continue;
}
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
// 1. Headings (# H1, ## H2, ### H3)
// `[ \t]+` rather than `\s+`: next to `(.+)` the two overlap, and the
// engine has to try every split of the whitespace run before failing.
const headingMatch = chunk.match(/^(#{1,6})[ \t]+(\S.*)$/);
if (headingMatch) {
blocks.push({
type: 'heading',
level: headingMatch[1].length,
text: headingMatch[2].trim(),
});
continue;
}
// 2. Blockquote (> Quote text)
if (chunk.startsWith('>')) {
const quoteText = chunk
.split('\n')
.map((l) => l.replace(/^>\s?/, ''))
.join(' ')
.trim();
const { body: quoteBody, author: quoteAuthor } = splitQuoteAuthor(quoteText);
blocks.push({
type: 'quote',
text: renderInlineMarkdown(quoteBody),
author: quoteAuthor,
});
continue;
}
// 3. Image syntax: ![assetId:layout](Caption), ![id1, id2](Caption) for a
// pair, ![id1, id2, id3, …](Caption) for a grid
//
// The bracket group allows zero characters (`*`, not `+`) so a template's
// unfilled placeholder — `assetId: ''`, serialized as `![](Caption)` or
// `![:wide](Caption)` — still parses back into a `photo` block instead of
// silently degrading into a text paragraph on the next load.
//
// parsePhotoLine() has the caption run to the last `)`, see there.
const photoLine = parsePhotoLine(chunk);
if (photoLine) {
const rawTarget = photoLine.target;
const caption = photoLine.caption ? renderInlineMarkdown(photoLine.caption) : undefined;
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
// Two ids are a side-by-side pair, three or more a grid. The pair used
// to take the first two of any count and drop the rest on the next save.
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
if (rawTarget.includes(',')) {
const parts = rawTarget.split(',').map((s) => s.trim());
if (parts.length >= 3) {
blocks.push({ type: 'photo-grid', assetIds: parts, caption });
continue;
}
if (parts.length === 2) {
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
blocks.push({
type: 'photo-pair',
assetIds: [parts[0], parts[1]],
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
caption,
});
continue;
}
}
// Single photo: ![assetId:layout](Caption)
let assetId = rawTarget;
let layout: 'fullbleed' | 'wide' | 'contained' = 'contained';
if (rawTarget.includes(':')) {
const [id, l] = rawTarget.split(':');
assetId = id.trim();
const normLayout = l.trim().toLowerCase();
if (normLayout === 'fullbleed') layout = 'fullbleed';
else if (normLayout === 'wide') layout = 'wide';
}
blocks.push({
type: 'photo',
assetId,
caption,
layout,
});
continue;
}
// 4. Standard Text Paragraph
blocks.push({
type: 'paragraph',
2026-10-02 18:14:23 +02:00
html: renderInlineMarkdown(unescapePhotoLikeLines(chunk).replace(/\r?\n/g, ' ')),
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
});
}
// The cover comes first, as before; collectAssetIds() skips '' placeholders.
const referencedAssetIds = Array.from(
new Set([
...(frontmatter.coverAssetId ? [frontmatter.coverAssetId] : []),
...collectAssetIds(blocks),
]),
);
return { frontmatter, blocks, referencedAssetIds };
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
}
/** Converts a ParsedJournal structure back into clean Markdown syntax */
export function serializeJournalMarkdown(journal: ParsedJournal): string {
const lines: string[] = [];
// Frontmatter
const fmKeys = Object.keys(journal.frontmatter) as Array<keyof JournalFrontmatter>;
if (
fmKeys.length > 0 &&
fmKeys.some((k) => journal.frontmatter[k] !== undefined && journal.frontmatter[k] !== '')
) {
lines.push('---');
for (const key of fmKeys) {
const val = journal.frontmatter[key];
if (val !== undefined && val !== '') {
if (typeof val === 'boolean') {
lines.push(`${key}: ${val}`);
} else {
const escaped = String(val).replace(/\\/g, '\\\\').replace(/"/g, '\\"');
lines.push(`${key}: "${escaped}"`);
}
}
}
lines.push('---');
lines.push('');
}
// Blocks
for (const block of journal.blocks) {
switch (block.type) {
case 'heading': {
const hashes = '#'.repeat(Math.min(Math.max(block.level, 1), 6));
lines.push(`${hashes} ${block.text}`);
break;
}
case 'paragraph': {
2026-10-02 18:14:23 +02:00
lines.push(escapePhotoLikeLines(inlineHtmlToMarkdown(block.html)));
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
break;
}
case 'quote': {
const authorSuffix = block.author ? ` -- ${block.author}` : '';
const text = inlineHtmlToMarkdown(block.text.replace(/[\r\n]+/g, ' '));
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
lines.push(`> ${text}${authorSuffix}`);
break;
}
case 'photo': {
const layoutSuffix = block.layout !== 'contained' ? `:${block.layout}` : '';
const caption = block.caption
? inlineHtmlToMarkdown(block.caption.replace(/[\r\n]+/g, ' '))
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
: '';
lines.push(`![${block.assetId}${layoutSuffix}](${caption})`);
break;
}
case 'photo-pair': {
const caption = block.caption
? inlineHtmlToMarkdown(block.caption.replace(/[\r\n]+/g, ' '))
: '';
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
lines.push(`![${block.assetIds[0]}, ${block.assetIds[1]}](${caption})`);
break;
}
case 'photo-grid': {
const caption = block.caption
? inlineHtmlToMarkdown(block.caption.replace(/[\r\n]+/g, ' '))
: '';
lines.push(`![${block.assetIds.join(', ')}](${caption})`);
break;
}
case 'map': {
const caption = block.caption
? inlineHtmlToMarkdown(block.caption.replace(/[\r\n]+/g, ' ')).trim()
: '';
lines.push(caption ? `::map ${caption}` : '::map');
for (const item of block.items) {
if (item.kind === 'all-photos') lines.push('photos: all');
else if (item.kind === 'photo') {
if (item.assetId) lines.push(`photo: ${item.assetId}`);
} else if (isValidCoordinate(item.lat, item.lng)) {
const label = item.label?.replace(/[\r\n]+/g, ' ').trim();
lines.push(label ? `${label}: ${item.lat}, ${item.lng}` : `${item.lat}, ${item.lng}`);
}
}
if (!block.line) lines.push('line: off');
break;
}
case 'album': {
lines.push(block.albumId ? `::album ${block.albumId}` : '::album');
if (block.count !== undefined) lines.push(`count: ${block.count}`);
if (block.skip) lines.push(`skip: ${block.skip}`);
if (block.layout !== 'grid') lines.push(`layout: ${block.layout}`);
if (block.caption) {
const caption = inlineHtmlToMarkdown(block.caption.replace(/[\r\n]+/g, ' ')).trim();
if (caption) lines.push(`caption: ${caption}`);
}
break;
}
case 'facts': {
lines.push('::facts');
for (const item of block.items) {
const label = item.label.trim();
const value = inlineHtmlToMarkdown(item.value)
.replace(/[\r\n]+/g, ' ')
.trim();
if (label && value) lines.push(`${label}: ${value}`);
}
break;
}
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
}
lines.push('');
}
return lines.join('\n').trim();
}
/** Calculate approximate word count and reading time */
export function calculateReadingTime(text: string): { words: number; minutes: number } {
const plainText = text
.replace(/<[^>]+>/g, ' ')
// A photo line is a reference and its caption, to the end of the line:
// the caption may itself contain `)`.
.replace(/^[ \t]*!\[.*$/gm, ' ')
// Directive lines (`::facts`, `::map …`) are structure, not reading.
.replace(/^::\w+.*$/gm, ' ');
release: v0.11.0 — journal fixes, admin URLs, design system cleanup (#432) * fix(screenshots): sharp-Typen fuer 0.34 und 0.35 gleichzeitig (#410) sharp 0.35 ist von `export =` auf ESM umgestellt: der Modul-Namespace ist nicht mehr aufrufbar, die Factory sitzt unter .default. Der Type-Check brach damit in scripts/screenshots.ts weg, sobald der Next-Bump (#402) sharp von 0.34.5 auf 0.35.3 mitzieht -- sharp ist hier keine deklarierte Dependency, sondern kommt ueber Next mit. Die Form wird jetzt aus dem installierten Paket abgeleitet statt festgeschrieben, zur Laufzeit wie im Typ. Geprueft mit beiden Versionen: tsc laeuft mit 0.34.5 und mit 0.35.3 fehlerfrei durch. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): bump the nextjs group across 1 directory with 2 updates (#402) Bumps the nextjs group with 2 updates in the / directory: [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/compare/v16.2.12...v16.3.0) Updates `eslint-config-next` from 16.2.12 to 16.3.0 - [Release notes](https://github.com/vercel/next.js/releases) - [Commits](https://github.com/vercel/next.js/commits/v16.3.0/packages/eslint-config-next) --- updated-dependencies: - dependency-name: eslint-config-next dependency-version: 16.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: nextjs - dependency-name: next dependency-version: 16.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: nextjs ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 3.8.3 to 3.9.6 (#405) Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.6. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.6) --- updated-dependencies: - dependency-name: prettier dependency-version: 3.9.6 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(changelog): Unreleased-Sektion fuer die Bumps nach v0.10.0 (#413) Die Dependency-PRs sind nach dem Release auf dev gelandet, teils auch auf main. Ohne Eintrag waeren sie beim naechsten Release unsichtbar -- inklusive Next 16.3.0, das CVE-2025-13465 mitbringt. Ausserdem im 0.10.0-Abschnitt nachgetragen, dass der Trivy-Scan bis #409 nie gelaufen ist. Der Fix steckt im Tag v0.10.0, fehlte aber in der Aufzaehlung -- und "Images werden bei jedem Publish gescannt" stand im Changelog, waehrend der Job im Action-Setup abbrach. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(gallery): per-album sort order, independent of Immich (#408) (#414) Album order was dictated entirely by Immich: getAlbum() sorted by the album's own asc/desc flag, so a Folio album always mirrored the archive. A curated series has a narrative order that has nothing to do with capture time, and changing the Immich album's sort to fit the website changes it for the archive too. Adds an optional per-album `sort` in gallery.yaml, editable in /admin, defaulting to today's behaviour so every existing config is unchanged: immich (default) | newest | oldest | filename | manual `manual` is a pinned *prefix*: `assetOrder` lists only the photos placed by hand, everything else follows in the album's Immich order. A full permutation of a 2,000-photo album would be ~80 KB of UUIDs in a file that is rewritten and copied to content/.backups/ on every admin save. It also makes drift fall out for free — photos removed in Immich never match, new ones land in the tail rather than being hidden. Sorting is applied after the cache read, not before the cache write, so the LRU keeps one canonical Immich-ordered copy per album. That avoids putting the mode in the cache key, lets a config change take effect without depending on invalidation, and keeps the stale-serving path correct. cache.get() returns the stored object by reference, so withSort() returns a shallow clone with a new array — sorting in place would reorder the shared entry, and under request coalescing every concurrent caller would be sorting the same array. Also fixes a prerequisite bug: /api/admin/albums/[albumId]/assets read album.assets from GET /albums/:id, which Immich 3.x no longer populates (lib/immich.ts:507). The hero picker's "This Album" tab returned nothing and threw outright when the key was absent. It now goes through the client's paginated metadata search, with ?types=all to opt videos in for the reorder editor. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): drop decorative emoji from the sort select labels (#415) An <option> cannot contain markup, so the SVG set in Icons is not reachable there — but a decorative emoji is not a substitute for it. Plain text instead; the album card badge already uses a real icon. The remaining emoji in the admin panel (asset picker tabs, section headings, layout picker options) predate this branch and are left for a separate cleanup. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): replace emoji icons with the shared SVG icon set (#416) The admin panel mixed two icon conventions: inline SVGs from `Icons.tsx` in most components, and decorative emoji in the asset picker and a few PageBuilder labels. Emoji render inconsistently across platforms, ignore the accent colour, and cannot inherit the `.svg-icon` sizing rules. - Icons.tsx: add `IconStar` (filled — it marks a state, not an action) and `IconImage`. - AssetPicker: the three tab labels and the favourite tile badge now use IconFolder / IconStar / IconImage. - PageBuilder: the "Standalone Albums" and "Subpages" headings use the icon set instead of an emoji. - PageBuilder: the layout picker drops its emoji for plain text. An <option> cannot contain markup, so an SVG is impossible there and a decorative glyph is not a substitute. - admin.css: align icon and label in the picker tabs, and swap the favourite badge's text-shadow for drop-shadow, which is what applies to an inline SVG. Co-authored-by: ralksta <ralksta@users.noreply.github.com> * refactor(admin): fold PageBuilder's local icons into the shared Icons module (#418) * refactor(admin): fold PageBuilder's local icons into the shared module PageBuilder.tsx carried its own `Icons` object duplicating most of the glyphs already exported by Icons.tsx, with hardcoded sizes and slightly divergent paths. Migrate all 32 call sites to the shared module and delete the local object. Five glyphs had no counterpart and are added to Icons.tsx as 1:1 ports of the local paths: IconX, IconPlus, IconHome, IconCopy, IconImage. The local ExternalLink and Check are dropped rather than ported — both had zero call sites. Two glyphs change shape slightly, which is the point of consolidating: the shared IconCamera includes the viewfinder bump the local copy omitted, and drag handles now use IconGripVertical. IconGripVertical uses the module's square 24x24 viewBox, so `.svg-drag` goes from 12x18 to 18x18 — the old non-square box would letterbox the glyph down to 12x12 and shrink the handle. * fix(admin): resolve icon-module integration after #416 Merging dev brought in #416, which added a second IconImage to Icons.tsx and two <Icons.Camera>/<Icons.Folder> section headers that reference the local Icons object this PR removes. Git merged both cleanly but the result did not type-check. - drop the duplicate IconImage (both copies were byte-identical) - point the two section headers at the imported IconCamera/IconFolder - refresh the SORT_LABELS comment: the icon set is imported now, not declared below --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(config): allow an empty gallery, guard against a double /api suffix (#421) An empty gallery is now a valid, rendered state instead of a throw: deriveGallery() no longer requires at least one album or subpage, so a deployment with no albums yet renders a bare homepage the owner can fill in via /admin. getConfig() also stops appending /api to an Immich URL that already ends in it, which previously produced .../api/api and broke every upstream request. Includes a restore of the per-album sort test cases, which the branch had lost by being cut before #408/#414. * feat(admin): favicon upload, served from the content volume (#422) Adds a bundled default favicon, an upload widget in admin Settings > General, and a route that serves the icon from the writable content/ volume with a fallback to the bundled default. Raster uploads (PNG/ICO/JPEG) are wrapped in an SVG container; the response carries its own CSP so an uploaded SVG cannot execute script on the origin. The GET route revalidates with an ETag instead of caching immutably, so a newly uploaded icon shows up immediately. Uploads are written via temp file + rename, and a Reset button restores the bundled default. * ci: flag unformatted files in a PR, without blocking it (#424) Prettier is configured as an error rule in eslint.config.mjs but has never run in CI, so part of the tree predates it. A final CI step now diffs against the PR base, runs prettier --list-different over the changed files, and emits a warning annotation per offender plus a job summary. Advisory by design: it never fails the job. Blocking would turn a PR red for merely touching a file that was already unformatted, and normalising the tree in one commit would wreck git blame and conflict with the PRs in flight. Requires fetch-depth: 0, since diffing against the base needs its history. * feat(install): first-run wizard gated by a one-time setup token (#419) Adds /install, a four-step first-run wizard: connect to Immich, optionally pick albums, name the site, finish. It verifies the credentials against the Immich server before writing anything, then writes gallery.yaml, settings.yaml and a content/install.json carrying the Immich credentials and a generated site secret. install.json exists because a running process cannot pick up new env vars — the wizard has to write configuration that takes effect without a restart. getInstallCredentials() merges it under the real environment, so env vars always win and rotation stays a matter of setting one. Both the page and the API routes are gated by a one-time setup token printed to the server log, so a deployment that is reachable before gallery.yaml exists cannot be configured by whoever finds it first. The token is stored in content/.setup-token (0600) rather than a module variable: Next.js bundles the page and each route handler separately, so a module-level token left the page and the API disagreeing inside one process and the wizard stuck on step 1. It is removed once the install completes. The admin password is stored as an scrypt hash using the scheme lib/auth.ts already applies to album passwords; a plaintext ADMIN_PASSWORD env var keeps working. * docs: document the setup wizard, fix the read-only content mount (#425) Quick Start now leads with the /install wizard, with the hand-written YAML route kept alongside it, and a First-Run Setup section covers the setup token, the files the wizard writes, and env-var precedence. Two corrections: both Docker examples mounted content/ as :ro, which silently breaks the wizard, the admin panel and the backup rotation alike — docs/admin-panel.md already said so and the README contradicted it. And nothing documented that content/install.json holds the Immich API key, so a backup of content/ is a backup of credentials. Also adds a Contributors section crediting the people whose work is in the project. * feat(admin): floating save bar pinned to the bottom of the viewport (#426) The save bar was the first, static element inside .admin-main. Since the document itself scrolls, it left the viewport as soon as you scrolled down — editing a subpage section or a settings block far below gave no visible dirty hint and no reachable save button. Replace it with a bottom-pinned floating bar shared by both editors. It only mounts while there is something to act on (unsaved changes, an in-flight save, or a result message), so it never covers content while idle. The success message clears after 5s, which hides the bar again. - new SaveBar component, replacing the duplicated markup in PageBuilder and SettingsEditor - adopt the previously unused .floating-save-bar CSS: slide-in keyframes (carrying translateX(-50%)), dirty border, wrap/gap, mobile variant and a prefers-reduced-motion opt-out; z-index 900 keeps it below modals - .admin-main gains bottom padding so the bar never covers page content - drop the now-unreachable idle hints: the ⌘S hint becomes a button title, the Live Sync note becomes a static line above the settings layout - header "Site" link now bypasses the cache (/?fresh=1), so the preview stays reachable when the bar is hidden Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(admin): themed listbox for the album sort control (#427) The per-album "Photo order" control was a native <select>. Because an <option> cannot contain markup, its choices could not use the admin panel's currentColor SVG set — the reason #415 had to fall back to plain text after dropping the emoji labels. Adds a Listbox component implementing the ARIA combobox/listbox pattern, so options can render a glyph beside their label: - DOM focus stays on the trigger button; the active option is announced through aria-activedescendant, keeping focus management to one element - Keyboard: arrows (clamped at the ends, like a native select), Home/End, Enter/Space to commit, Escape to cancel, Tab commits and moves on, and prefix type-ahead with a repeat-key cycle - Outside dismissal on pointerdown, so a press starting outside closes the popup before the click retargets The sort options now carry an icon each: calendar, arrow-down, arrow-up, an A→Z marker, and the drag glyph for manual — matching the badge the album card already shows. SORT_LABELS stays plain text because the badge feeds it to a title attribute. Closes #417 Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(git): ignore generated design handoff folders * fix(admin): stop the album sort dropdown clipping, and simplify the panel (#428) * fix(admin): render listbox popup in a portal so it escapes modal clipping The sort control's popup was position:absolute inside three clipping ancestors (.album-drawer overflow:hidden > .album-drawer-body overflow-y:auto > .modal-right-column overflow-y:auto), so it was cut off at the bottom of the Edit Album Details modal. z-index could not help: clipping happens before stacking. It also always hung below the trigger, with no flip. Portal the popup to document.body and position it from the trigger's viewport rect, flipping above when there is more room there and capping max-height to the space available so it scrolls internally rather than overflowing. It is dismissed on scroll and resize, since the anchor is only measured on open. The outside-pointerdown handler now also treats the popup as inside; without that the portalled list counts as outside, and a click on an option would close it before the selection commits. * refactor(admin): single-column album details panel The left column spent 1.2fr on a cover thumbnail and three stat rows, two of which (Status, Custom Hero) only restated the form fields opposite them, while the form itself was squeezed into 1.8fr behind a second nested scroller. Stack the drawer in one column instead: cover as a banner, then the form at full width, with the UUID moved into the footer. The body is now the only scroll container, which also removes one of the ancestors that was clipping the sort popup. --------- Co-authored-by: ralksta <ralksta@users.noreply.github.com> * fix(admin): give the portalled listbox its theme back, lock the page behind modals (#429) Two defects in the album editor. The sort listbox popup painted transparent. Every --admin-* variable is scoped to .admin-layout, and since the popup moved into document.body it sits outside that subtree, so background/border/text all resolved to nothing. It now carries its own copy of the palette in both colour schemes, plus the font it no longer inherits. Scrolling inside a modal also moved the page behind it. No admin modal ever locked body scroll: the overlay covers the page but does not absorb wheel events, so a scroll starting on the backdrop — or continuing past the end of the modal's own scroller — reaches the document. overscroll-behavior cannot cover that case on its own, because it only applies to scroll containers and the backdrop is not one. useScrollLock freezes body while a modal is open and compensates for the width the scrollbar gives up, so nothing shifts underneath. Each lock restores the inline value it found, which makes nesting work without a counter — a picker opened from the drawer restores the drawer's hidden state instead of clearing it. Applied to both drawers and all four picker modals, which share the defect. overscroll-behavior: contain on the scrollers stops the chaining they can handle themselves. Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> * fix(security): allow unsafe-eval in CSP script-src during dev mode * feat(journal): add Journal Studio with split-screen editor, live preview and dedicated routes * fix(build): separate client parser from server journal-service and fix build type errors * fix(journal): Fotos rendern, Layout und Lightbox-Steuerung korrigieren Fünf unabhängige Fehler in der öffentlichen Journal- und Essay-Ansicht: * Foto-Blöcke wurden nie angezeigt. EssayView löst ein Foto über PhotoItem.id auf, und das sind verschlüsselte Tokens — die Blöcke aus dem Markdown tragen aber rohe Asset-UUIDs. Jede Zuordnung lief ins Leere, und nicht auflösbare Blöcke werden still verworfen. Die IDs werden jetzt serverseitig übersetzt; damit verschwinden nebenbei die rohen UUIDs aus dem Client-Payload, die dort laut Projektregel nie auftauchen dürfen. Nicht auflösbare Referenzen werden geloggt. * Überschriften standen weiter links als der Fließtext. Jeder Block hatte einzeln `max-width: 68ch`, und `ch` ist relativ zur Schrift des Elements — die Serif-Überschrift ergab eine breitere Spalte. Ersetzt durch eine gemeinsame, font-unabhängige `--essay-measure`. * Fullbleed-Fotos bluteten nur nach links aus: `.essay-figure` ist `width: 100%`, wodurch die Box überbestimmt ist und der negative rechte Margin verworfen wird. * Foto-Paare stellten beide Bilder gleich breit dar, wodurch ein Hochformat neben einem Querformat doppelt so hoch wurde. Jetzt eine Justified-Reihe: Breite proportional zum Seitenverhältnis, dadurch exakt gleiche Höhen ohne Beschnitt. * Die Lightbox hatte im Journal keine Tastatursteuerung und keine Scroll-Sperre — beides lag in PhotoGrid, also nur im Album-Raster. Verlagert in die Lightbox selbst, der doppelte Handler in PhotoGrid entfernt (sonst wäre pro Pfeildruck zwei Bilder weitergesprungen). Zusätzlich sind Proofing-Herzen und das EXIF-Panel im redaktionellen Modus abschaltbar und im Journal aus: Client-Proofing ist ein Übergabe-Workflow für Alben, keine Funktion einer Reportage. Auf der Übersicht wurde der Untertitel doppelt gerendert, weil extractExcerpt() auf ihn zurückfällt. * feat(admin): eigene URLs für alle Bereiche und überarbeiteter Journal Studio Das Panel war eine einzige Client-Komponente, die ihre Tabs über useState umschaltet: keine Route pro Bereich, kein Deep-Link, kein Zurück-Button, und nach jedem Reload landete man wieder auf "Pages". Auch der Journal-Editor hatte keine eigene URL. Jetzt sieben echte Routen (/admin, /admin/pages, /admin/journal, /admin/journal/<slug>, /admin/settings, /admin/settings/<section>, /admin/analytics). Die Shell mit Auth-Prüfung und Kopfzeile sitzt im Layout und umschließt children — so bleibt die Session-Prüfung über Routenwechsel montiert, statt bei jedem Tab-Wechsel neu zu laufen und den Spinner aufblitzen zu lassen. Unbekannte Settings-Sections fallen auf General zurück. Im selben Zug der Journal Studio, der die Routing-Änderung ohnehin berührt: * Alle Eingabefelder nutzten die Klasse `admin-input`, die in keinem CSS definiert war — sie fielen auf Browser-Defaults zurück. Jetzt gestylt, gescoped, damit der generische Name nicht ins übrige Panel leckt. * Der Split View ist per Divider verschiebbar (Maus, Tastatur, Doppelklick zum Zurücksetzen), Breite in localStorage. * Das Studio bricht aus der 1120px-Spalte aus, die Preview hat Platz. * Die Preview zeigte für jedes Foto fest 3:2 und log damit über das Layout der veröffentlichten Seite; die echten Verhältnisse werden jetzt an den Thumbnails gemessen. * Blöcke mit alten positionsbasierten Foto-Referenzen werden markiert — die lassen sich auf einer eigenständigen Journal-Seite nicht auflösen und verschwanden bisher stillschweigend. * Blocktyp-Chips als gemeinsame Komponente, monochrom und per Icon unterschieden statt in einer eigenen Blau/Lila/Orange-Palette, die sonst nirgends im Panel vorkommt. * Emojis raus, SVG-Icons rein. * fix(admin): Designsystem-Lücken im Panel schließen Eine systematische Suche nach Klassen, die im TSX benutzt, aber in keinem CSS definiert sind, hat vier Stellen mit demselben Muster gefunden: * `admin-btn-secondary` und `admin-btn-danger` existierten nicht. Sämtliche Löschen-Buttons sahen aus wie normale Buttons — keine Warnwirkung. Als `.admin-btn.admin-btn-danger` geschrieben, weil die Varianten mit den Größenklassen kombiniert werden, die weiter unten ihren eigenen Hintergrund setzen. * `page-progress-fill` fehlte: die Balken im Analytics-Panel waren leere Rinnen, der Wert unsichtbar. Ebenso `analytics-empty` und `admin-loading-container`. * `subpage-drawer-section`, `subpage-drawer-title-group` und `input-with-icon` im PageBuilder waren wirkungslos und teils mit Inline-Styles notdürftig kompensiert. * `grid-card-preview` fehlte, wodurch alle Layout-Vorschauen auf Höhe null kollabierten. Nur "Showcase" war sichtbar — und das aus Versehen, weil sein Tile `hero-tile` hieß und damit die `aspect-ratio` einer fremden PageBuilder-Klasse erbte. Umbenannt. Dazu die Theme-Vorschauen, die praktisch identisch aussahen: alle sieben zeigten dieselben drei quadratischen Kacheln, einziger Unterschied war die Hintergrundfarbe. Sie spiegeln jetzt die echten Preset-Daten aus lib/config/theme.ts — Schriftcharakter, Eckradius, Rasterdichte, Passepartout bzw. Schatten. Die Kopfzeile richtet sich an einer gemeinsamen Steuerhöhe aus. Der "Site"-Link war höher als die Buttons daneben: `.admin-btn` hatte keine explizite line-height, und <button> bekommt box-sizing: border-box vom Browser, <a> nicht. Die Statusanzeige setzte weder Schriftfamilie noch -größe und fiel auf den Browser-Default zurück — sie war nie Teil des Designsystems. Jetzt gleiche Höhe und Typografie, Pillenform als Zustandsanzeige, Trenner zur Aktionsgruppe. Das dauerhafte Pulsieren des grünen Punkts entfällt; Animation bleibt den Zuständen vorbehalten, die Aufmerksamkeit brauchen. Restliche Emojis durch SVG-Icons ersetzt. * feat(admin): add scroll-to-top toggle and SVG arrow The back-to-top button was always on and drew its arrow with the ↑ text character. Add a `scrollToTop` setting (General section in the admin panel, defaults to on so existing sites are unaffected) and replace the glyph with a stroked SVG that inherits currentColor across all presets. Scroll handling is now rAF-throttled, and prefers-reduced-motion turns off both the hover lift and the smooth scroll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * security(journal): escape author HTML instead of filtering it CodeQL flags 26 high-severity alerts on the release PR; the bulk of them point at sanitizeHtml(), a denylist of three regexes whose output goes into dangerouslySetInnerHTML. I reproduced the bypasses before changing anything — all four pass the old filter: <img src=x onerror=alert(1)> unquoted handler, regex wants quotes <img src=x onerror='alert(1)'> single quotes, same reason <svg onload=alert(1)> not a <script> tag javasjavascript:cript:alert(1) one-pass replace, the rest recombines Plus an attribute breakout in the link renderer, which interpolated the URL into href="${url}" unescaped: [x](" onmouseover=alert(1) x=") -> <a href="" onmouseover=alert(1" ...> Replaced with escaping. Every `&<>"'` in author text becomes an entity before any markdown rule runs, so the only tags in the output are the ones renderInlineMarkdown builds itself and a URL cannot leave its attribute. Link schemes are now an allowlist (http, https, mailto, tel, relative, anchor); anything else renders as plain text. The serializer needed decodeHtmlEntities to match: without it a save would write `&lt;` into the Markdown file and the next parse would escape the `&` again, corrupting the text further on every round trip. A test covers parse -> serialize -> parse stability. Two existing tests asserted the old behaviour and were rewritten rather than deleted: one expected the script tag to be *removed* from the output, the other expected the substring "onerror" to be absent. Both now assert the property that matters — that no tag can form — because `onerror` surviving as inert text is fine. Exploitation required admin access either way: journal and essay text comes from the studio or from content/*.md. This removes the weakness, it does not close an open door. * fix(journal): contain file paths, fix frontmatter escaping, defuse two regexes Follow-up to the CodeQL findings on release PR #432. I went through all 23 alerts individually; this addresses the ones that are worth addressing and documents the ones that are not. Path containment (12 alerts, all false positives). Every path built from a slug goes through isValidSlug(), a strict `/^[a-zA-Z0-9_-]+$/` allowlist — verified against `../../etc/passwd`, `foo/../../bar`, `a/b`, `..` and friends, all rejected. CodeQL cannot see it because the check lives in another module. Added a containedPath() helper that resolves the path and refuses anything landing outside the content directory: a second lock on a door that was already locked, and a barrier the analysis can follow. Also removed the dead `slug.endsWith('.md')` branches — isValidSlug rejects dots, so they could never be taken. Frontmatter escaping (1 alert, a real bug). The serializer escaped `"` but not `\`, and the parser never unescaped anything. A title containing either character gained a backslash on every save/load cycle: Path C:\Users "quoted" -> Path C:\\Users \"quoted\" -> ... Escaping now covers the backslash first and the parser undoes both. A round trip test covers quotes, backslashes, colons and apostrophes. Two of three ReDoS regexes (2 alerts). The heading pattern had `\s+` next to `(.+)`, which overlap, so the engine tried every split of the whitespace run before failing; it is `[ \t]+` and `(\S.*)` now. The quote author pattern wrapped a lazy group around an optional group — the quadratic case — and is an index split on the first separator now. The third regex, the bold/italic pass, is deliberately left alone. Rewriting it with a negated class removes the backtracking but breaks nesting: `**bold *and italic* here**` renders as `*<em>bold </em>and italic<em> here</em>*`. The input is Markdown from an authenticated admin, never a visitor, so the worst case is an author slowing down their own page. The comment in the code says so. Not addressed: 5 js/insufficient-password-hash alerts. They ask for a slow KDF where the code uses SHA-256/HMAC — correct in general, but the admin password comes from an environment variable and is never stored, so a stronger KDF protects nothing that is not already in plaintext in the environment. 399 unit tests pass (18 new), build and tsc clean. * fix(journal): split the quote author by scanning, not by pattern Cleaning up after myself. #439 replaced the quote author regex `/^(.*?)(?:\s+--\s+(.+))?$/` — a lazy group around an optional one, the quadratic case — with `/\s+--\s+/`, and CodeQL promptly flagged the replacement for the same reason. One reported pattern traded for another. splitQuoteAuthor() scans for the first `--` that has whitespace on both sides. Linear, and it needs no reasoning about the regex engine at all. Behaviour is identical to the original regex, checked case by case against it: separator, no separator, several separators, tabs, wide gaps, `a--b` without spaces, leading and trailing separators, empty string. All nine are covered by tests, plus one asserting it stays fast on a 50k whitespace run. * security(admin): derive the session signing key with scrypt getSigningKey() ran the admin password through a single SHA-256 digest. It is key derivation rather than password storage, so it was never a stored-hash problem — but if the derived key ever leaked, one fast hash makes recovering the password by brute force cheap. CodeQL flags it as js/insufficient-password-hash and, for this particular alert, has a point. scrypt now. Two details that matter: The salt has to be stable. A random salt would produce a different key on every call and invalidate every session; it is derived from AUTH_SECRET, which is deployment-specific. Verified across separate processes: same inputs produce a verifying token, so a restart or redeploy does not log everyone out. The result is cached for the process lifetime. scrypt is deliberately slow and getSigningKey() runs on every admin request — deriving per call would add ~24ms to each one. The cache key is a digest of secret plus password, so a rotation misses the cache and derives again, and no extra plaintext copy of the password is kept around. Measured: first derivation 24ms, subsequent calls 0.12ms. Password change and secret change both invalidate an existing token, checked in separate processes. Note the one-time effect: existing admin sessions are invalidated by the change in derivation, so everyone logs in once more. * security(admin): key the signing-key cache on its inputs, not a digest #441 removed the SHA-256 digest of the admin password from the key derivation and introduced a new one three lines above it, as the cache key. Same rule, same file: CodeQL reported it immediately. The comment justifying it was wrong too. It claimed no second plaintext copy of the password was retained, while building the digest input allocates exactly that in order to hash it. The cache now holds the two input strings and compares them directly. They are the same objects the env and install caches already hold, so nothing extra is retained, and no fast hash of the password exists in memory for the life of the process. Re-verified after the change, in separate processes: a token from one process verifies in another with the same inputs, a changed password or secret rejects it, first derivation 24ms, cached calls 0.001ms. That leaves scrypt as the only place the password is hashed here. The two HMACs further down operate on the derived key and on token data, not on the password; the constant-time comparison in verifyAdminPassword is the previously dismissed one. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
2026-08-14 16:55:07 +02:00
const words = plainText.trim().split(/\s+/).filter(Boolean).length;
const minutes = Math.max(1, Math.round(words / 200));
return { words, minutes };
}
/** Extract a brief plain-text excerpt from journal blocks */
export function extractExcerpt(parsed: ParsedJournal, maxLength = 160): string {
if (parsed.frontmatter.subtitle) return parsed.frontmatter.subtitle;
for (const block of parsed.blocks) {
if (block.type === 'paragraph') {
const text = block.html.replace(/<[^>]+>/g, '').trim();
if (text) {
return text.length > maxLength ? `${text.slice(0, maxLength).trim()}...` : text;
}
}
}
return '';
}