release: v0.13.0 (#535)
Twenty-nine commits since v0.12.0. See CHANGELOG.md for the full list and the upgrade notes. Ten additions — the SEO package (site URL, robots.txt, sitemap.xml, JSON-LD), slideshow mode, opt-in original downloads, copy-link, previous/next album navigation, alt text from the Immich description, per-album location precision, the update notice, a Help tab, and a subpage cover grid separate from its photo grid. Two fixes: CJK album slugs, and the lightbox control bar. Photo of the Day (#476) was built on `dev` and reverted as not planned; it never appears in a release. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DmsHVRL9yQvckUB1ZpVWre --------- 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>
This commit is contained in:
50
lib/siteShape.ts
Normal file
50
lib/siteShape.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Build the description of the site that `publicPaths()` reasons about (#472).
|
||||
*
|
||||
* Kept apart from the pure rules so the exclusions stay testable without a
|
||||
* running Immich, and so the sitemap and the feed cannot answer the visibility
|
||||
* question differently.
|
||||
*/
|
||||
|
||||
import { getConfig } from './config';
|
||||
import { immich } from './immich';
|
||||
import { isProtected, isSiteLocked } from './auth';
|
||||
import { listJournalEntries } from './admin/journal-service';
|
||||
import type { SiteShape, PublicAlbum } from './publicPages';
|
||||
|
||||
export async function buildSiteShape(): Promise<SiteShape> {
|
||||
const config = getConfig();
|
||||
|
||||
// Allowlisted albums only — getAlbums() already drops everything else, so an
|
||||
// album that was never published cannot reach a listing through here.
|
||||
const albums = await immich.getAlbums();
|
||||
const byId = new Map(albums.map((album) => [album.id, album]));
|
||||
const resolve = (ids: string[]): PublicAlbum[] =>
|
||||
ids
|
||||
.map((id) => byId.get(id))
|
||||
.filter((album): album is NonNullable<typeof album> => Boolean(album))
|
||||
.map((album) => ({ id: album.id, slug: album.slug }));
|
||||
|
||||
const journal = await listJournalEntries().catch(() => []);
|
||||
|
||||
return {
|
||||
siteLocked: isSiteLocked(),
|
||||
subpages: config.subpages.map((subpage) => ({
|
||||
slug: subpage.slug,
|
||||
enabled: subpage.enabled !== false,
|
||||
hidden: subpage.hidden === true,
|
||||
isProtected: isProtected(subpage.slug, 'subpage'),
|
||||
albums: resolve(subpage.albumIds),
|
||||
})),
|
||||
standaloneAlbums: resolve(config.standaloneAlbums),
|
||||
journal: journal.map((entry) => ({
|
||||
slug: entry.slug,
|
||||
draft: entry.frontmatter.draft === true,
|
||||
})),
|
||||
isAlbumProtected: (albumId) => isProtected(albumId, 'album'),
|
||||
aboutEnabled: config.aboutEnabled,
|
||||
mapEnabled: config.map,
|
||||
// There is no switch for the journal; it exists when it has entries.
|
||||
journalEnabled: journal.length > 0,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user