From fe913e4a7f40b378429b4e74dc89b7c8b4b34366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 24 Oct 2022 20:39:59 +0200 Subject: Replace root-redirect with propper HTTP 307. --- module/calp/server/routes.scm | 14 ++++---------- po/sv.po | 4 ++++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/module/calp/server/routes.scm b/module/calp/server/routes.scm index 877bd8f2..925b22b5 100644 --- a/module/calp/server/routes.scm +++ b/module/calp/server/routes.scm @@ -124,7 +124,6 @@ (define ical-namespace '(IC . "urn:ietf:params:xml:ns:icalendar-2.0")) -(define root-script "window.onload = () => document.querySelector('a').click()") ;; TODO ensure encoding on all fields which take user provided data. ;; Possibly a fallback which strips everything unknown, and treats @@ -132,16 +131,11 @@ (define (make-make-routes) (make-routes - ;; Manual redirect to not reserve root. - ;; Also reason for really ugly frontend redirect. (GET "/" (html) - (return `((content-type ,(content-type html))) - (with-output-to-string - (lambda () - ((sxml->output html) - (xhtml-doc - (body (a (@ (href "/today")) ,(G_ "Go to Today")) - (script ,(lambda () (display root-script)))))))))) + (return (build-response code: 307 + headers: `((Location . "/today/") + (content-type tex/plain))) + (G_ "Redirecting to today, might take some time if server was just restarted."))) (GET "/favicon.ico" () (return diff --git a/po/sv.po b/po/sv.po index c447172f..8021951a 100644 --- a/po/sv.po +++ b/po/sv.po @@ -952,3 +952,7 @@ msgstr "Händelse ~a tillagd till ~a~%" #, scheme-format msgid "end (~a) must be equal to or greater than start (~a)" msgstr "slut (~a) måste vara större en eller lika med start (~a)" + +msgid "Redirecting to today, might take some time if server was just " + "restarted." +msgstr "Omdirigerar till idag, kan ta viss tid om servern just startated om." -- cgit v1.2.3