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 } };
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
<script lang="ts">
|
||||
let { data } = $props();
|
||||
const message = $derived(data.message);
|
||||
</script>
|
||||
|
||||
<svelte:head><title>{message.subject} — Contact Relay — SHD.build</title></svelte:head>
|
||||
<main class="contact-message-page">
|
||||
<a class="contact-back" href="/account/notifications">← RETURN TO INBOX</a>
|
||||
<article class="contact-message">
|
||||
<header><div><span>SHD CONTACT RELAY</span><strong>{message.team === 'dmca' ? 'DMCA / COPYRIGHT' : String(message.team).toUpperCase()}</strong></div><time datetime={message.created_at}>{new Date(message.created_at).toLocaleString()}</time></header>
|
||||
<div class="contact-message-title"><p class="eyebrow"><span></span> INBOUND TRANSMISSION</p><h1>{message.subject}</h1><p>FROM {message.sender_name} · <a href={`mailto:${message.sender_email}`}>{message.sender_email}</a></p></div>
|
||||
<section><h2>MESSAGE</h2><p>{message.body}</p></section>
|
||||
{#if message.dmca}
|
||||
<section class="contact-dmca-record"><h2>DMCA NOTICE DETAILS</h2><dl><div><dt>COPYRIGHTED WORK</dt><dd>{message.dmca.work}</dd></div><div><dt>MATERIAL LOCATION</dt><dd>{message.dmca.locations}</dd></div><div><dt>CLAIMANT CONTACT</dt><dd>{message.dmca.contact}</dd></div><div><dt>ELECTRONIC SIGNATURE</dt><dd>{message.dmca.signature}</dd></div><div><dt>ATTESTATIONS</dt><dd>Good-faith authorization statement confirmed · Accuracy and authority statement confirmed under penalty of perjury</dd></div></dl></section>
|
||||
{/if}
|
||||
<footer><a class="primary" href={`mailto:${message.sender_email}?subject=${encodeURIComponent(`Re: ${message.subject}`)}`}>REPLY BY EMAIL →</a></footer>
|
||||
</article>
|
||||
</main>
|
||||
@@ -34,6 +34,7 @@
|
||||
if (notification.category === 'contributions' && /(approved|deployed)/.test(text)) return { label: 'VIEW PUBLISHED DATA', href: notification.link };
|
||||
if (notification.category === 'guides') return { label: 'OPEN GUIDE', href: notification.link };
|
||||
if (notification.category === 'builds') return { label: 'OPEN BUILD', href: notification.link };
|
||||
if (notification.source === 'SHD CONTACT RELAY') return { label: notification.title.startsWith('DMCA NOTICE') ? 'REVIEW COPYRIGHT REQUEST' : 'OPEN CONTACT MESSAGE', href: notification.link };
|
||||
if (notification.link === '/account') return { label: 'OPEN AGENT PROFILE', href: notification.link };
|
||||
return { label: 'OPEN RELATED PAGE', href: notification.link };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user