refactor: remove /private/ routes (replaced by /dnd/)

This commit is contained in:
Lewis Wynne 2026-02-08 17:17:29 +00:00
parent a1d7bd8fdb
commit aa349ed7c9
2 changed files with 0 additions and 75 deletions

View file

@ -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) : [];
---
<Layout title={`${post.data.title} - lewis m.w.`}>
<article>
<h1>{post.data.title}</h1>
<p class="muted" style="margin-top: 0;">{formatDate(post.dates.created)}{post.dates.updated && ` (updated ${formatDate(post.dates.updated)})`}</p>
<Content />
</article>
{related.length > 0 && (
<details open>
<summary>related</summary>
<pre set:html={related.map(p => formatListItem(p.dates.created, `/private/${getSlug(p.id)}`, p.data.title)).join('\n')} />
</details>
)}
</Layout>

View file

@ -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 });
---
<Layout title="private - lewis m.w.">
<p class="muted">logged in as {session.user?.name} <a href="/api/auth/signout">sign out</a></p>
<img src={map.src} alt="Drakkenheim map" style="max-width: 100%; height: auto;" />
{sortedCategories.length === 0 ? (
<p class="muted">nothing here</p>
) : (
sortedCategories.map(category => (
<details open>
<summary>{category}</summary>
<pre set:html={grouped[category].map(post => formatListItem(post.dates.created, `/private/${getSlug(post.id)}`, post.data.title, { pinned: post.data.pinned })).join('\n')} />
</details>
))
)}
</Layout>