Add contact relay and DMCA workflow
This commit is contained in:
@@ -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 } };
|
||||
};
|
||||
Reference in New Issue
Block a user