diff options
author | Christopher Baines <mail@cbaines.net> | 2023-09-04 21:18:22 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-09-04 21:18:22 +0100 |
commit | c6e4a686bdbf386d81f45cb7021c516a526a4054 (patch) | |
tree | 5e42f1527c74987b4eb8d01d4b93caa3b4807d29 /guix-qa-frontpage/server.scm | |
parent | 4f3e9eb34384b1b2ea3dc6f2b74e49af4a88f966 (diff) | |
download | qa-frontpage-c6e4a686bdbf386d81f45cb7021c516a526a4054.tar qa-frontpage-c6e4a686bdbf386d81f45cb7021c516a526a4054.tar.gz |
Display the README as a page
Like the data service.
Diffstat (limited to 'guix-qa-frontpage/server.scm')
-rw-r--r-- | guix-qa-frontpage/server.scm | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/guix-qa-frontpage/server.scm b/guix-qa-frontpage/server.scm index b9a814e..affaa4d 100644 --- a/guix-qa-frontpage/server.scm +++ b/guix-qa-frontpage/server.scm @@ -20,6 +20,7 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-71) + #:use-module (ice-9 textual-ports) #:use-module (ice-9 threads) #:use-module (ice-9 match) #:use-module (web http) @@ -73,7 +74,8 @@ branches))) (define* (make-controller assets-directory database metrics-registry - #:key (patch-issues-to-show 200)) + #:key (patch-issues-to-show 200) + doc-dir) (define handle-static-assets (if (string-prefix? (%store-prefix) @@ -490,6 +492,17 @@ has no patches or has been closed.") (uri-query (request-uri request)) parse-query-string) '()))))) + (('GET "README") + (let ((filename (string-append doc-dir "/README.html"))) + (if (file-exists? filename) + (render-html + #:sxml (readme (call-with-input-file filename + get-string-all))) + (render-html + #:sxml (general-not-found + "README not found" + "The README.html file does not exist") + #:code 404)))) ((method path ...) (render-html #:sxml (general-not-found |