Add type filters for abuse report window

This commit is contained in:
2024-04-11 14:40:39 +02:00
parent f8a97d2183
commit 089fa3ad84
3 changed files with 50 additions and 14 deletions

View File

@@ -5,12 +5,29 @@ export let file = {
id: "", id: "",
name: "", name: "",
get_href: "", get_href: "",
mime_type: "",
} }
export let list = { export let list = {
id: "", id: "",
files: [], files: [],
} }
const filter_visual = type => {
return type.startsWith("image/") ||
type.startsWith("video/") ||
type === "application/pdf"
}
const filter_audiovisual = type => {
return type.startsWith("image/") ||
type.startsWith("video/") ||
type.startsWith("audio/") ||
type === "application/pdf"
}
const filter_app = type => {
return type.startsWith("application/") ||
type.startsWith("text/")
}
const abuse_categories = [ const abuse_categories = [
{ {
type: "copyright", name: "Copyright", type: "copyright", name: "Copyright",
@@ -19,14 +36,17 @@ const abuse_categories = [
}, { }, {
type: "porn", name: "Porn", type: "porn", name: "Porn",
desc: `Sexually explicit videos or images`, desc: `Sexually explicit videos or images`,
filter: filter_visual,
}, { }, {
type: "terrorism", name: "Terrorism", type: "terrorism", name: "Terrorism",
desc: `Videos, images or audio fragments showing or promoting the use desc: `Videos, images or audio fragments showing or promoting the use
of intentional violence to achieve political aims`, of intentional violence to achieve political aims`,
filter: filter_audiovisual,
}, { }, {
type: "gore", name: "Gore", type: "gore", name: "Gore",
desc: `Graphic and shocking videos or images depicting severe harm to desc: `Graphic and shocking videos or images depicting severe harm to
humans (or animals)`, humans (or animals)`,
filter: filter_visual,
}, { }, {
type: "child_abuse", name: "Child abuse", type: "child_abuse", name: "Child abuse",
desc: `Videos or images depicting inappropriate touching or nudity of desc: `Videos or images depicting inappropriate touching or nudity of
@@ -35,6 +55,10 @@ const abuse_categories = [
type: "zoophilia", name: "Zoophilia", type: "zoophilia", name: "Zoophilia",
desc: `Videos or images depicting of sexual acts being performed on desc: `Videos or images depicting of sexual acts being performed on
animals`, animals`,
}, {
type: "revenge_porn", name: "Revenge porn",
desc: `The distribution of sexually explicit images or videos of
individuals without their consent`,
}, { }, {
type: "doxing", name: "Doxing", type: "doxing", name: "Doxing",
desc: `Personally identifiable information being shared without the desc: `Personally identifiable information being shared without the
@@ -43,10 +67,7 @@ const abuse_categories = [
}, { }, {
type: "malware", name: "Malware", type: "malware", name: "Malware",
desc: `Software programs designed to cause harm to computer systems`, desc: `Software programs designed to cause harm to computer systems`,
}, { filter: filter_app,
type: "revenge_porn", name: "Revenge porn",
desc: `The distribution of sexually explicit images or videos of
individuals without their consent`,
}, },
] ]
@@ -160,10 +181,12 @@ const report_description = () => {
</p> </p>
{#each abuse_categories as cat} {#each abuse_categories as cat}
<label for="type_{cat.type}"> {#if cat.filter === undefined || cat.filter(file.mime_type) }
<input type="radio" bind:group={abuse_type} id="type_{cat.type}" name="abuse_type" value="{cat.type}"> <label class="type_label" for="type_{cat.type}">
<b>{cat.name}</b>: {cat.desc} <input class="type_button" type="radio" bind:group={abuse_type} id="type_{cat.type}" name="abuse_type" value="{cat.type}">
</label> <span class="type_desc"><b>{cat.name}</b>: {cat.desc}</span>
</label>
{/if}
{/each} {/each}
{#if list.id !== "" && file.id !== ""} {#if list.id !== "" && file.id !== ""}
@@ -271,4 +294,15 @@ label {
.report_form > textarea { .report_form > textarea {
height: 5em; height: 5em;
} }
.type_label {
display: flex;
flex-direction: row;
}
.type_button {
flex: 0 0 auto;
margin-right: 1em;
}
.type_label {
flex: 1 1 auto;
}
</style> </style>

View File

@@ -37,11 +37,13 @@ let file = {
{/if} {/if}
</p> </p>
<p> {#if file.abuse_type !== "porn"}
Pixeldrain has zero tolerance towards abuse. The IP address this file <p>
originated from has been banned and is no longer able to upload files to Pixeldrain has zero tolerance towards abuse. The IP address this file
pixeldrain. originated from has been banned and is no longer able to upload files to
</p> pixeldrain.
</p>
{/if}
</TextBlock> </TextBlock>
{#if file.can_download} {#if file.can_download}

View File

@@ -6,7 +6,7 @@ export const formatNumber = (amt, precision) => {
} else if (amt >= 1e3) { } else if (amt >= 1e3) {
return (amt/1e3).toPrecision(precision) + "k"; return (amt/1e3).toPrecision(precision) + "k";
} }
return amt return amt.toPrecision(precision)
} }
export const formatThousands = (x) => { export const formatThousands = (x) => {