summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2023-01-23 15:26:08 +0000
committerArun Isaac2023-01-23 15:28:23 +0000
commit744cb39808ac5d8399dfd1174de3d7115cb35a5f (patch)
tree88897abe7e9dbdb1cc14c496a0bd8ce028b07483
parent9997eb5c99c2a69e338fdb78219cd1cf4e5d9bd3 (diff)
downloadtissue-744cb39808ac5d8399dfd1174de3d7115cb35a5f.tar.gz
tissue-744cb39808ac5d8399dfd1174de3d7115cb35a5f.tar.lz
tissue-744cb39808ac5d8399dfd1174de3d7115cb35a5f.zip
web: Allow files to shadow the search page.
* tissue/web/dev.scm (handler): Allow files to shadow the search page. * tissue/web/server.scm (handler): Allow files to shadow the search page.
-rw-r--r--tissue/web/dev.scm10
-rw-r--r--tissue/web/server.scm12
2 files changed, 13 insertions, 9 deletions
diff --git a/tissue/web/dev.scm b/tissue/web/dev.scm
index 2be978c..0140e0f 100644
--- a/tissue/web/dev.scm
+++ b/tissue/web/dev.scm
@@ -1,5 +1,5 @@
;;; tissue --- Text based issue tracker
-;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2022, 2023 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of tissue.
;;;
@@ -40,9 +40,6 @@ documentation of @var{xapian-index} and @var{project-thunk}."
(path (uri-path (request-uri request))))
(log-request request)
(cond
- ;; Search page
- ((member path (list "/" "/search"))
- (search-handler request body xapian-index project))
;; Files
((any (lambda (web-file)
(cond
@@ -60,6 +57,11 @@ documentation of @var{xapian-index} and @var{project-thunk}."
(lambda (port get-bytevector)
((file-writer file) port)
(get-bytevector))))))
+ ;; Search page. We look for the search page only after files
+ ;; because we want to let files shadow the search page if
+ ;; necessary.
+ ((member path (list "/" "/search"))
+ (search-handler request body xapian-index project))
;; Not found
(else
(404-response request)))))
diff --git a/tissue/web/server.scm b/tissue/web/server.scm
index 95bed70..2e59a77 100644
--- a/tissue/web/server.scm
+++ b/tissue/web/server.scm
@@ -157,11 +157,6 @@ See `start-web-server' for documentation of HOSTS."
(repository-open
(assq-ref host-parameters 'repository-directory))))
(cond
- ;; Search page
- ((member path (list "/" "/search"))
- (search-handler request body
- (assq-ref host-parameters 'xapian-directory)
- (assq-ref host-parameters 'project)))
;; Static files
((let ((file-path
(find file-exists?
@@ -178,6 +173,13 @@ See `start-web-server' for documentation of HOSTS."
(file-name-extension file-path))))
(call-with-input-file file-path
get-bytevector-all))))
+ ;; Search page. We look for the search page only after files
+ ;; because we want to let files shadow the search page if
+ ;; necessary.
+ ((member path (list "/" "/search"))
+ (search-handler request body
+ (assq-ref host-parameters 'xapian-directory)
+ (assq-ref host-parameters 'project)))
;; Not found
(else
(404-response request))))))