Remove old user and block file pages

This commit is contained in:
2021-09-23 22:21:27 +02:00
parent d896d8794c
commit 3c478720c9
7 changed files with 79 additions and 563 deletions

View File

@@ -90,65 +90,3 @@ func (wc *WebController) adminGlobalsForm(td *TemplateData, r *http.Request) (f
}
return f
}
func (wc *WebController) adminAbuseForm(td *TemplateData, r *http.Request) (f Form) {
if !td.Authenticated || !td.User.IsAdmin {
return Form{Title: ";-)"}
}
f = Form{
Name: "admin_file_removal",
Title: "Admin file removal",
PreFormHTML: template.HTML("<p>Paste any pixeldrain file links in here to remove them</p>"),
Fields: []Field{
{
Name: "text",
Label: "Files to delete",
Type: FieldTypeTextarea,
}, {
Name: "type",
Label: "Type",
DefaultValue: "unknown",
Type: FieldTypeRadio,
RadioValues: []string{
"unknown",
"copyright",
"child_abuse",
"terrorism",
"gore",
"malware",
},
}, {
Name: "reporter",
Label: "Reporter",
DefaultValue: "Anonymous tip",
Type: FieldTypeText,
},
},
BackLink: "/admin",
SubmitLabel: "Submit",
}
if f.ReadInput(r) {
resp, err := td.PixelAPI.AdminBlockFiles(
f.FieldVal("text"),
f.FieldVal("type"),
f.FieldVal("reporter"),
)
if err != nil {
formAPIError(err, &f)
return
}
successMsg := template.HTML("The following files were blocked:<br/><ul>")
for _, v := range resp.FilesBlocked {
successMsg += template.HTML("<li>pixeldrain.com/u/" + v + "</li>")
}
successMsg += "<ul>"
// Request was a success
f.SubmitSuccess = true
f.SubmitMessages = []template.HTML{successMsg}
}
return f
}