2021-05-11 16:14:16 +02:00
|
|
|
<script>
|
|
|
|
import { formatDate } from "../util/Formatting.svelte";
|
|
|
|
import Expandable from "../util/Expandable.svelte";
|
|
|
|
import { createEventDispatcher } from "svelte";
|
|
|
|
let dispatch = createEventDispatcher()
|
|
|
|
|
|
|
|
export let report
|
2023-11-01 12:00:07 +01:00
|
|
|
export let ip_report_count
|
2021-05-25 11:42:55 +02:00
|
|
|
let preview = false
|
2021-05-11 16:14:16 +02:00
|
|
|
|
2023-11-01 12:00:07 +01:00
|
|
|
$: can_grant = report.status !== "granted"
|
|
|
|
$: can_reject = report.status !== "rejected"
|
2021-05-11 16:14:16 +02:00
|
|
|
|
2023-11-01 12:00:07 +01:00
|
|
|
let set_status = async (action, report_type) => {
|
|
|
|
dispatch("resolve_report", {action: action, report_type: report_type})
|
2021-05-11 16:14:16 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-04-18 22:17:37 +02:00
|
|
|
<Expandable expanded={report.status === "pending"} click_expand>
|
2022-01-17 13:36:00 +01:00
|
|
|
<div slot="header" class="header">
|
2021-05-11 16:14:16 +02:00
|
|
|
<div class="icon_cell">
|
|
|
|
<img class="file_icon" src={"/api/file/"+report.file.id+"/thumbnail"} alt="File thumbnail"/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="title">{report.file.name}</div>
|
2021-05-17 11:16:20 +02:00
|
|
|
<div class="stats">Type<br/>
|
|
|
|
{report.file.abuse_type === "" ? report.type : report.file.abuse_type}
|
|
|
|
</div>
|
2021-05-11 16:14:16 +02:00
|
|
|
{#if report.status !== "pending"}
|
|
|
|
<div class="stats">Status<br/>{report.status}</div>
|
|
|
|
{/if}
|
|
|
|
<div class="stats">R<br/>{report.reports.length}</div>
|
|
|
|
<div class="stats">V<br/>{report.file.views}</div>
|
|
|
|
<div class="stats">DL<br/>{Math.round(report.file.bandwidth_used / report.file.size)}</div>
|
|
|
|
</div>
|
|
|
|
<div class="details">
|
2021-05-11 20:29:56 +02:00
|
|
|
<div class="toolbar">
|
|
|
|
<div style="flex: 1 1 auto">
|
2022-12-24 11:37:31 +01:00
|
|
|
<a class="button" target="_blank" href={"/u/"+report.file.id} rel="noreferrer">
|
2021-05-11 20:29:56 +02:00
|
|
|
<i class="icon">open_in_new</i> Open file
|
|
|
|
</a>
|
2021-05-25 11:42:55 +02:00
|
|
|
<button class:button_highlight={preview} on:click={() => {preview = !preview}}>
|
|
|
|
<i class="icon">visibility</i> Preview
|
|
|
|
</button>
|
2023-11-01 12:00:07 +01:00
|
|
|
{#if can_grant}
|
|
|
|
<button class="button_highlight" on:click={() => {set_status("grant", report.type)}}>
|
|
|
|
<i class="icon">done</i> Block ({report.type})
|
|
|
|
</button>
|
|
|
|
{/if}
|
|
|
|
{#if can_reject}
|
|
|
|
<button class="button_red" on:click={() => {set_status("reject", "")}}>
|
|
|
|
<i class="icon">delete</i> Ignore
|
|
|
|
</button>
|
|
|
|
{/if}
|
2021-05-11 20:29:56 +02:00
|
|
|
</div>
|
|
|
|
<div style="flex: 0 1 auto">
|
|
|
|
<button on:click={() => {set_status("grant", "terrorism")}}>terrorism</button>
|
|
|
|
<button on:click={() => {set_status("grant", "gore")}}>gore</button>
|
|
|
|
<button on:click={() => {set_status("grant", "child_abuse")}}>child_abuse</button>
|
|
|
|
<button on:click={() => {set_status("grant", "malware")}}>malware</button>
|
2022-01-25 20:38:08 +01:00
|
|
|
<button on:click={() => {set_status("grant", "doxing")}}>doxing</button>
|
2021-05-11 20:29:56 +02:00
|
|
|
</div>
|
2021-05-11 16:14:16 +02:00
|
|
|
</div>
|
2021-05-25 11:42:55 +02:00
|
|
|
<div style="text-align: center;">
|
|
|
|
{#if preview}
|
|
|
|
<br/>
|
|
|
|
<iframe
|
|
|
|
title="File preview"
|
|
|
|
src="/u/{report.file.id}?embed"
|
2022-02-01 18:43:52 +01:00
|
|
|
style="border: none; width: 100%; height: 600px; border-radius: 16px;"
|
2021-05-25 11:42:55 +02:00
|
|
|
></iframe>
|
|
|
|
{/if}
|
|
|
|
</div>
|
2021-05-11 16:14:16 +02:00
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td>Time</td>
|
|
|
|
<td>IP</td>
|
|
|
|
<td>Type</td>
|
|
|
|
<td>Status</td>
|
2023-11-01 12:00:07 +01:00
|
|
|
<td colspan="2">Reports from this IP</td>
|
2021-05-11 16:14:16 +02:00
|
|
|
</tr>
|
|
|
|
{#each report.reports as user_report}
|
|
|
|
<tr>
|
2021-05-17 11:16:20 +02:00
|
|
|
<td>{formatDate(user_report.time, true, true, false)}</td>
|
2021-05-11 16:14:16 +02:00
|
|
|
<td>{user_report.ip_address}</td>
|
|
|
|
<td>{user_report.type}</td>
|
|
|
|
<td>{user_report.status}</td>
|
2023-11-01 12:00:07 +01:00
|
|
|
<td>{ip_report_count[user_report.ip_address]}</td>
|
|
|
|
<td>
|
|
|
|
{#if can_grant}
|
|
|
|
<button on:click={() => dispatch("resolve_by_ip", {ip: user_report.ip_address, action: "grant"})}>
|
|
|
|
Accept all
|
|
|
|
</button>
|
|
|
|
{/if}
|
|
|
|
{#if can_reject}
|
|
|
|
<button on:click={() => dispatch("resolve_by_ip", {ip: user_report.ip_address, action: "reject"})}>
|
|
|
|
Ignore all
|
|
|
|
</button>
|
|
|
|
{/if}
|
|
|
|
</td>
|
2021-05-11 16:14:16 +02:00
|
|
|
</tr>
|
2023-11-01 13:39:53 +01:00
|
|
|
{#if user_report.description !== ""}
|
|
|
|
<tr>
|
|
|
|
<td>Description</td>
|
|
|
|
<td colspan="4" style="white-space: pre;">
|
|
|
|
{user_report.description}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{/if}
|
2021-05-11 16:14:16 +02:00
|
|
|
{/each}
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</Expandable>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.header {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
2021-05-11 20:29:56 +02:00
|
|
|
line-height: 1.2em;
|
2021-05-11 16:14:16 +02:00
|
|
|
}
|
|
|
|
.icon_cell {
|
|
|
|
flex: 0 0 auto;
|
|
|
|
line-height: 0;
|
|
|
|
margin-right: 6px;
|
|
|
|
}
|
|
|
|
.title {
|
|
|
|
flex: 1 1 auto;
|
|
|
|
align-self: center;
|
2021-08-18 13:00:07 +02:00
|
|
|
word-break: break-all;
|
2021-05-11 16:14:16 +02:00
|
|
|
}
|
|
|
|
.stats {
|
|
|
|
flex: 0 0 auto;
|
2022-01-17 13:36:00 +01:00
|
|
|
padding: 0 4px;
|
2022-03-29 21:41:46 +02:00
|
|
|
border-left: 1px solid var(--separator);
|
2021-05-11 16:14:16 +02:00
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
.details {
|
|
|
|
flex: 1 1 auto;
|
|
|
|
}
|
2021-05-11 20:29:56 +02:00
|
|
|
.toolbar {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
}
|
2021-05-11 16:14:16 +02:00
|
|
|
.file_icon {
|
|
|
|
width:48px;
|
|
|
|
height:48px;
|
|
|
|
}
|
|
|
|
</style>
|