add abuse file viewer

This commit is contained in:
2020-07-16 17:24:03 +02:00
parent ea2e6fd9c7
commit 615327083e
5 changed files with 55 additions and 1 deletions

View File

@@ -102,6 +102,10 @@ Viewer.prototype.setFile = function(file) {
}
if (
file.abuse_type !== ""
) {
new AbuseViewer(this,file).render(this.divFilepreview)
}else if (
file.mime_type.startsWith("image")
) {
new ImageViewer(this, file).render(this.divFilepreview)

View File

@@ -0,0 +1,28 @@
function AbuseViewer(viewer, file, next) {
this.viewer = viewer
this.file = file
this.next = next
this.container = document.createElement("div")
this.container.classList = "image-container"
this.container.appendChild(document.createElement("br"))
this.title = document.createElement("h1")
this.title.innerText = "Unavailable For Legal Reasons"
this.container.appendChild(this.title)
this.description = document.createElement("p")
// this.description.style.maxWidth = "500px"
this.description.innerText = "This file has received an abuse report and "+
"was taken down."
this.container.appendChild(this.description)
this.description2 = document.createElement("p")
this.description2.innerText = "Type of abuse: '"+file.abuse_type+"'. "+
"Reporter: '"+file.abuse_reporter_name+"'."
this.container.appendChild(this.description2)
}
AbuseViewer.prototype.render = function(parent) {
parent.appendChild(this.container)
}

21
res/template/451.html Normal file
View File

@@ -0,0 +1,21 @@
{{define "451"}}<!DOCTYPE html>
<html lang="en">
<head>
{{template "meta_tags" "451, Unavailable For Legal Reasons"}}
{{template "user_style" .}}
</head>
<body>
{{template "page_top" .}}
<h1>451, Unavailable For Legal Reasons</h1>
<div class="page_content"><div class="limit_width">
<p>
Hello. This file has received an abuse report and has been taken
down. It cannot be shared anymore.
</p>
</div></div>
{{template "page_bottom" .}}
{{template "analytics"}}
</body>
</html>
{{end}}

View File

@@ -219,6 +219,7 @@
{{template `ListNavigator.js`}}
{{template `Viewer.js`}}
{{template `AbuseViewer.js`}}
{{template `ImageViewer.js`}}
{{template `VideoViewer.js`}}
{{template `AudioViewer.js`}}

View File

@@ -35,7 +35,7 @@ func adType() (i int) {
// splits like 1/3 1/4, etc
i = rand.Intn(4)
// The return value correstonds to the type of ad shown:
// The return value corresponds to the type of ad shown:
// 0: A-ads
// 1: Amarulasolutions
// 2: Patreon