Add e-mail preview to abuse reporter page

This commit is contained in:
2024-09-23 19:47:46 +02:00
parent a31cccb341
commit da9886ecdd
5 changed files with 88 additions and 77 deletions

View File

@@ -1,9 +1,21 @@
<script>
import { createEventDispatcher } from "svelte";
import { formatDate } from "../util/Formatting.svelte";
import Modal from "../util/Modal.svelte"
let dispatch = createEventDispatcher()
export let reporters = []
let modal
let preview_subject = ""
let preview_html = ""
let preview_text = ""
const toggle_preview = (rep) => {
preview_subject = rep.last_message_subject
preview_text = rep.last_message_text
preview_html = rep.last_message_html
modal.show()
}
</script>
<table>
@@ -25,6 +37,9 @@ export let reporters = []
<td>{formatDate(rep.last_used, true, true, false)}</td>
<td>{formatDate(rep.created, false, false, false)}</td>
<td>
<button on:click|preventDefault={() => toggle_preview(rep)} class="button round">
<i class="icon">visibility</i>
</button>
<button on:click|preventDefault={() => {dispatch("edit", rep)}} class="button round">
<i class="icon">edit</i>
</button>
@@ -45,3 +60,26 @@ export let reporters = []
</tr>
{/each}
</table>
<Modal bind:this={modal} title={preview_subject} width="1000px">
{#if preview_html !== ""}
<div class="message_html">{@html preview_html}</div>
{:else if preview_text !== ""}
<div class="message_pre">{preview_text}</div>
{/if}
</Modal>
<style>
.message_html {
padding: 8px;
text-align: initial;
white-space: normal;
overflow: hidden;
}
.message_pre {
padding: 8px;
text-align: initial;
white-space: pre-wrap;
overflow: hidden;
}
</style>

View File

@@ -17,11 +17,12 @@ const filter_visual = type => {
type.startsWith("video/") ||
type === "application/pdf"
}
const filter_audio = type => {
return type.startsWith("audio/")
}
const filter_audiovisual = type => {
return type.startsWith("image/") ||
type.startsWith("video/") ||
type.startsWith("audio/") ||
type === "application/pdf"
return filter_visual(type) || filter_audio(type)
}
const filter_app = type => {
return type.startsWith("application/") ||
@@ -30,10 +31,6 @@ const filter_app = type => {
const abuse_categories = [
{
type: "copyright", name: "Copyright",
desc: `Protected content which is shared without constent from the
rightsholder`,
}, {
type: "porn", name: "Porn",
desc: `Sexually explicit videos or images`,
filter: filter_visual,
@@ -143,22 +140,10 @@ let submit = async e => {
}
let description = ""
let copyright_rightsholder = ""
let copyright_email = ""
let copyright_sources = ""
let malware_proof = ""
let child_abuse_password = ""
const report_description = () => {
if (abuse_type === "copyright") {
return "Rightholder name: " + copyright_rightsholder + "\n" +
"Contact e-mail: " + copyright_email + "\n" +
"Sources:\n" + copyright_sources + "\n\n" +
"Description:\n" + description;
} else if (abuse_type === "malware") {
return "Proof: " + malware_proof + "\n" +
"Description:\n" + description;
} else if (abuse_type === "child_abuse") {
if (abuse_type === "child_abuse") {
return "Password: " + child_abuse_password + "\n" +
"Description:\n" + description;
} else {
@@ -171,7 +156,8 @@ const report_description = () => {
<p>
If you think this file violates pixeldrain's
<a href="/abuse">content policy</a> you can report it for moderation
with this form.
with this form. Please submit copyright infringement notices through our
<a href="/abuse#toc_2">abuse e-mail address</a>.
</p>
<form on:submit={submit} style="width: 100%" class="report_form">
<h3>Abuse type</h3>
@@ -206,38 +192,7 @@ const report_description = () => {
<h3>Description</h3>
{#if abuse_type === "copyright"}
<div class="highlight_yellow" style="text-align: initial;">
<p>
Copyright claims can only be submitted by the copyright
owner or an authorized agent. If you do not own the rights
to this file then you don't have the rights to file a
copyright claim.
</p>
</div>
<br/>
<div>Name rightsholder (can be a registered company name)</div>
<input type="text" bind:value={copyright_rightsholder} required/>
<div>Contact e-mail</div>
<input type="email" bind:value={copyright_email} required/>
<div>Source URLs (links to the places where the original content was sold/provided)</div>
<textarea bind:value={copyright_sources} placeholder="https://some.store.com" required></textarea>
{:else if abuse_type === "malware"}
<div>
Proof that this file is malware. This can be a link to
<a href="https://www.virustotal.com/"target="_blank">VirusTotal</a>
scan results, or some other security vendor which has
information about this file
</div>
<input type="text" bind:value={malware_proof} required/>
{:else if abuse_type === "child_abuse"}
{#if abuse_type === "child_abuse"}
<div class="highlight_yellow" style="text-align: initial;">
<p>
@@ -340,7 +295,6 @@ input[type="radio"]:checked+div {
width: 100%;
}
.report_form > input[type="text"],
.report_form > input[type="email"],
.report_form > textarea {
width: 100%;
margin: 0 0 0.5em 0;

View File

@@ -59,7 +59,7 @@ onMount(() => {
Downloading
</div>
<div class="feature_cell free_feat">
<span class="bold">5 GB per day</span><br/>
<span class="bold">6 GB per day</span><br/>
Download speed is reduced to 1 MiB/s when exceeded. Max 5 concurrent
downloads

View File

@@ -189,7 +189,7 @@ onMount(() => {
<div class="feat_normal round_br" class:feat_highlight={subscription === ""}>
<ul>
<li>Standard free plan, files expire after 120 days.</li>
<li>Download limit of 5 GB per day</li>
<li>Download limit of 6 GB per day</li>
</ul>
</div>
</div>