Release v0.19.0. See the `## [0.19.0] — 2026-09-29` section of [CHANGELOG.md](https://github.com/ralksta/immich-folio/blob/dev/CHANGELOG.md) for the full list. Highlights: client proofing links (#683), custom content pages (#738), asset picker search (#740), concurrent-edit detection (#742), env-locked settings (#739), an accessibility baseline (#741), three security fixes with advisories (#737, #755, #759), and a pre-release quality pass (#780–#797). --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Ralf <rohlenbo79@gmail.com> Co-authored-by: Paul Thies <110185070+ImScheinox@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com> Co-authored-by: Lance Martin <lancetaylor95@gmail.com>
116 lines
3.8 KiB
TypeScript
116 lines
3.8 KiB
TypeScript
/**
|
|
* Which pages a crawler — or a feed reader — may be told about (#472, #471).
|
|
*
|
|
* This is the part that matters. A sitemap and a feed collect exactly what
|
|
* access control otherwise hides: titles, cover images, publication dates. It
|
|
* is a leak surface nobody notices, because it never shows up in the browser.
|
|
*
|
|
* The rules are kept here, as a pure function over a description of the site,
|
|
* so both surfaces answer the same question the same way and every exclusion
|
|
* can be stated as a test.
|
|
*/
|
|
|
|
export interface PublicAlbum {
|
|
id: string;
|
|
slug: string;
|
|
}
|
|
|
|
export interface PublicSubpage {
|
|
slug: string;
|
|
/** `enabled: false` in gallery.yaml — the subpage does not exist publicly. */
|
|
enabled: boolean;
|
|
/** `hidden: true` — reachable by direct link only, which a listing is not. */
|
|
hidden: boolean;
|
|
/** The subpage carries a password. */
|
|
isProtected: boolean;
|
|
albums: PublicAlbum[];
|
|
}
|
|
|
|
export interface PublicJournalEntry {
|
|
slug: string;
|
|
draft: boolean;
|
|
/** The entry carries a password of its own. */
|
|
isProtected: boolean;
|
|
}
|
|
|
|
export interface PublicContentPage {
|
|
slug: string;
|
|
draft: boolean;
|
|
/** The page carries a password of its own. */
|
|
isProtected: boolean;
|
|
}
|
|
|
|
export interface SiteShape {
|
|
/** A global site password is on and no one is past it. */
|
|
siteLocked: boolean;
|
|
subpages: PublicSubpage[];
|
|
/** Albums that are not part of any subpage. */
|
|
standaloneAlbums: PublicAlbum[];
|
|
journal: PublicJournalEntry[];
|
|
/** Content pages (#722), in or out of the menu — both are public URLs. */
|
|
pages?: PublicContentPage[];
|
|
/** Whether an album carries its own password. Keyed by Immich album id. */
|
|
isAlbumProtected: (albumId: string) => boolean;
|
|
aboutEnabled: boolean;
|
|
mapEnabled: boolean;
|
|
journalEnabled: boolean;
|
|
}
|
|
|
|
/**
|
|
* Every path that may appear in a public listing, in a stable order.
|
|
*
|
|
* A locked site yields nothing at all: the gate covers the whole site, so
|
|
* naming its pages would describe exactly what the password withholds.
|
|
*/
|
|
export function publicPaths(site: SiteShape): string[] {
|
|
if (site.siteLocked) return [];
|
|
|
|
const paths: string[] = ['/'];
|
|
|
|
if (site.aboutEnabled) paths.push('/about');
|
|
if (site.mapEnabled) paths.push('/map');
|
|
if (site.journalEnabled) paths.push('/journal');
|
|
|
|
for (const subpage of site.subpages) {
|
|
// A subpage that is off, unlisted, or behind a password is not a public
|
|
// page — and neither is anything underneath it. Inheritance is the case
|
|
// that is easy to miss: a public album under a protected subpage is not
|
|
// reachable, so listing it would advertise a URL that only asks for a
|
|
// password, and name the album while doing it.
|
|
if (!subpage.enabled || subpage.hidden || subpage.isProtected) continue;
|
|
|
|
paths.push(`/${subpage.slug}`);
|
|
|
|
for (const album of subpage.albums) {
|
|
if (site.isAlbumProtected(album.id)) continue;
|
|
paths.push(`/${subpage.slug}/${album.slug}`);
|
|
}
|
|
}
|
|
|
|
for (const album of site.standaloneAlbums) {
|
|
if (site.isAlbumProtected(album.id)) continue;
|
|
paths.push(`/${album.slug}`);
|
|
}
|
|
|
|
for (const page of site.pages ?? []) {
|
|
// A page outside the menu is still a public page; a draft or a locked
|
|
// one is not, and its title would travel with the URL.
|
|
if (page.draft || page.isProtected) continue;
|
|
paths.push(`/${page.slug}`);
|
|
}
|
|
|
|
if (site.journalEnabled) {
|
|
for (const entry of site.journal) {
|
|
// Drafts stay visible to the logged-in admin and absent for everyone
|
|
// else; a listing is "everyone else". A locked entry is left out for
|
|
// the reason /journal hides it: its URL leads to a gate that names it.
|
|
if (entry.draft || entry.isProtected) continue;
|
|
paths.push(`/journal/${entry.slug}`);
|
|
}
|
|
}
|
|
|
|
// A slug collision between a subpage and a standalone album would otherwise
|
|
// emit the same URL twice.
|
|
return [...new Set(paths)];
|
|
}
|