From aa349ed7c91204c25d2b5ec508148618506b7d40 Mon Sep 17 00:00:00 2001 From: lew Date: Sun, 8 Feb 2026 17:17:29 +0000 Subject: [PATCH] refactor: remove /private/ routes (replaced by /dnd/) --- www/src/pages/private/[slug].astro | 40 ------------------------------ www/src/pages/private/index.astro | 35 -------------------------- 2 files changed, 75 deletions(-) delete mode 100644 www/src/pages/private/[slug].astro delete mode 100644 www/src/pages/private/index.astro diff --git a/www/src/pages/private/[slug].astro b/www/src/pages/private/[slug].astro deleted file mode 100644 index b6a40d4..0000000 --- a/www/src/pages/private/[slug].astro +++ /dev/null @@ -1,40 +0,0 @@ ---- -export const prerender = false; - -import { getCollection, render } from 'astro:content'; -import { requireAdminSession } from '../../lib/auth'; -import Layout from '../../layouts/Layout.astro'; -import { formatDate, formatListItem } from '../../lib/format'; -import { getSlug, enrichPostWithDates, enrichPostsWithDates, resolveRelatedPosts } from '../../lib/md'; - -const { session, error } = await requireAdminSession(Astro.request); -if (error) return error; -if (!session) return Astro.redirect('/api/auth/signin'); - -const slug = Astro.params.slug; -const rawPosts = await getCollection('md', ({ data }) => data.draft === true); -const rawPost = rawPosts.find(p => getSlug(p.id) === slug); - -if (!rawPost) { - return new Response('Not found', { status: 404 }); -} - -const allPosts = enrichPostsWithDates(rawPosts); -const post = enrichPostWithDates(rawPost); -const { Content } = await render(post); -const related = post.data.related ? resolveRelatedPosts(post.data.related, allPosts) : []; ---- - - -
-

{post.data.title}

-

{formatDate(post.dates.created)}{post.dates.updated && ` (updated ${formatDate(post.dates.updated)})`}

- -
-{related.length > 0 && ( -
- related -
 formatListItem(p.dates.created, `/private/${getSlug(p.id)}`, p.data.title)).join('\n')} />
-  
-)} -
diff --git a/www/src/pages/private/index.astro b/www/src/pages/private/index.astro deleted file mode 100644 index 4c85cbf..0000000 --- a/www/src/pages/private/index.astro +++ /dev/null @@ -1,35 +0,0 @@ ---- -export const prerender = false; - -import { getCollection } from 'astro:content'; -import { requireAdminSession } from '../../lib/auth'; -import Layout from '../../layouts/Layout.astro'; -import { formatListItem } from '../../lib/format'; -import { organizePostsByCategory, getSlug, enrichPostsWithDates } from '../../lib/md'; -import map from '../../content/md/dnd/drakkenheim/map.jpg'; - -const { session, error } = await requireAdminSession(Astro.request); -if (error) return error; -if (!session) return Astro.redirect('/api/auth/signin'); - -const rawPosts = await getCollection('md', ({ data }) => data.draft === true); -const posts = enrichPostsWithDates(rawPosts); -const { grouped, categories: sortedCategories } = organizePostsByCategory(posts, { sortAlphabetically: true }); ---- - - -

logged in as {session.user?.name} sign out

- -Drakkenheim map - -{sortedCategories.length === 0 ? ( -

nothing here

-) : ( - sortedCategories.map(category => ( -
- {category} -
 formatListItem(post.dates.created, `/private/${getSlug(post.id)}`, post.data.title, { pinned: post.data.pinned })).join('\n')} />
-    
- )) -)} -