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 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'module') 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 -- cgit v1.2.3