From 15dd184106124f83fda639c61f932f25e8e018b4 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sun, 21 May 2023 20:21:41 +0400 Subject: [PATCH] Added deleted page to show if file was successfully deleted. --- internal/http/handlers.go | 1 + web/templates/deleted.jade | 11 +++++++++++ web/web.go | 1 + 3 files changed, 13 insertions(+) create mode 100644 web/templates/deleted.jade diff --git a/internal/http/handlers.go b/internal/http/handlers.go index abb8bd2..4887aac 100644 --- a/internal/http/handlers.go +++ b/internal/http/handlers.go @@ -210,6 +210,7 @@ func (h *UploadHandlers) Delete(w http.ResponseWriter, r *http.Request) { h.logDelete.Printf("| %s | %s | %s | %s", r.Header.Get("X-Real-IP"), netTyp, saltedHash, r.UserAgent()) w.WriteHeader(http.StatusNoContent) + web.Deleted(utils.MainSite(r.Host), site) } func NotFound(w http.ResponseWriter, r *http.Request) { diff --git a/web/templates/deleted.jade b/web/templates/deleted.jade new file mode 100644 index 0000000..d7eb0a5 --- /dev/null +++ b/web/templates/deleted.jade @@ -0,0 +1,11 @@ +extends base.jade + +block header + h1 Deleted + +block body + :go:func Deleted(mainSite, site string) + section + h2 File was successfully deleted. + center + a(href="/") Back to index page diff --git a/web/web.go b/web/web.go index 1d2f60f..4348286 100644 --- a/web/web.go +++ b/web/web.go @@ -8,6 +8,7 @@ import ( //go:generate $GOPATH/bin/jade -pkg=web -stdbuf -stdlib -writer templates/index.jade //go:generate $GOPATH/bin/jade -pkg=web -stdbuf -stdlib -writer templates/nospace.jade +//go:generate $GOPATH/bin/jade -pkg=web -stdbuf -stdlib -writer templates/deleted.jade //go:generate $GOPATH/bin/jade -pkg=web -stdbuf -stdlib -writer templates/uploaded.jade //go:generate $GOPATH/bin/jade -pkg=web -stdbuf -stdlib -writer templates/error404.jade