Add new upload history page

This commit is contained in:
2024-06-13 21:17:41 +02:00
parent a5873148d4
commit 97fc5e9c1c
9 changed files with 208 additions and 175 deletions

View File

@@ -135,7 +135,7 @@ func New(r *httprouter.Router, prefix string, conf Config) (wc *WebController) {
// General navigation
{GET, "" /* */, wc.serveTemplate("home", handlerOpts{})},
{GET, "api" /* */, wc.serveMarkdown("api.md", handlerOpts{})},
{GET, "history" /* */, wc.serveTemplate("history_cookies", handlerOpts{})},
{GET, "history" /* */, wc.serveTemplate("upload_history", handlerOpts{})},
{GET, "u/:id" /* */, wc.serveFileViewer},
{GET, "u/:id/preview" /* */, wc.serveFilePreview},
{GET, "l/:id" /* */, wc.serveListViewer},
@@ -400,6 +400,10 @@ func (wc *WebController) serveNotFound(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
wc.templates.Get().ExecuteTemplate(w, "404", wc.newTemplateData(w, r))
}
func (wc *WebController) serveUnavailableForLegalReasons(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusUnavailableForLegalReasons)
wc.templates.Get().ExecuteTemplate(w, "451", wc.newTemplateData(w, r))
}
func (wc *WebController) getAPIKey(r *http.Request) (key string, err error) {
if cookie, err := r.Cookie("pd_auth_key"); err == nil {