Add contact relay and DMCA workflow

This commit is contained in:
JB
2026-07-25 19:20:43 -04:00
parent e0bf3b05ab
commit 7f9a75021d
11 changed files with 308 additions and 4 deletions
@@ -0,0 +1,15 @@
import { error } from '@sveltejs/kit';
import { getDatabase } from '$lib/server/database';
import { getSessionUser } from '$lib/server/auth/session';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ cookies, params }) => {
const user = await getSessionUser(cookies);
if (!user) error(401, 'Sign in to view this contact message.');
const database = await getDatabase();
const message = await (await database.prepare(`SELECT contact_messages.* FROM contact_messages
JOIN contact_message_recipients ON contact_message_recipients.message_id=contact_messages.id
WHERE contact_messages.id=? AND contact_message_recipients.user_id=?`)).get(params.id, user.id);
if (!message) error(404, 'Contact message not found.');
return { message: { ...message, dmca: message.dmca_json ? JSON.parse(String(message.dmca_json)) : null } };
};