error pages
This commit is contained in:
parent
7f3d75abca
commit
0e9bd79d00
|
@ -5,17 +5,15 @@
|
||||||
- user pages
|
- user pages
|
||||||
- search form
|
- search form
|
||||||
- page tags should link to the tag index
|
- page tags should link to the tag index
|
||||||
- error pages: 404, 500, etc
|
|
||||||
|
|
||||||
# wishlist
|
# wishlist
|
||||||
|
|
||||||
- prefers-color-scheme
|
- prefers-color-scheme
|
||||||
- robots.txt, sitemap.xml
|
- robots.txt, sitemap.xml
|
||||||
- firefox alternative stylesheets too maybe (send more js for chrome to do the thing too)
|
- firefox alternative stylesheets too maybe (send more js for chrome to do the thing too)
|
||||||
- explicitly block brave (also needs js)
|
- make /unsupported-browser page for brave
|
||||||
- rss/atom
|
- rss/atom
|
||||||
- indieweb: microformats2, webmentions, websub, rel=me
|
- indieweb: microformats2, webmentions, websub, rel=me
|
||||||
- reject brave (lol)
|
|
||||||
- support tor and opennic
|
- support tor and opennic
|
||||||
- activitypub
|
- activitypub
|
||||||
- gopher and gemini variants
|
- gopher and gemini variants
|
||||||
|
|
17
init.rkt
17
init.rkt
|
@ -13,6 +13,7 @@
|
||||||
(define src (simple-form-path (build-path dir "src")))
|
(define src (simple-form-path (build-path dir "src")))
|
||||||
(define target (simple-form-path (build-path dir "target")))
|
(define target (simple-form-path (build-path dir "target")))
|
||||||
(make-directory* src)
|
(make-directory* src)
|
||||||
|
(make-directory* target)
|
||||||
(with-output-to-file
|
(with-output-to-file
|
||||||
(build-path src "index.md")
|
(build-path src "index.md")
|
||||||
(λ ()
|
(λ ()
|
||||||
|
@ -37,6 +38,22 @@
|
||||||
(build-path src "config.rktd")
|
(build-path src "config.rktd")
|
||||||
(λ () (pretty-write (list (list 'base "http://localhost:8080")))))
|
(λ () (pretty-write (list (list 'base "http://localhost:8080")))))
|
||||||
|
|
||||||
|
(with-output-to-file
|
||||||
|
(build-path src "40x.md")
|
||||||
|
(λ ()
|
||||||
|
(pretty-write
|
||||||
|
'((title "error page")
|
||||||
|
(lang "en")))
|
||||||
|
(write-string "\n# error\n\nno such page; or you are not authorized to view it")))
|
||||||
|
|
||||||
|
(with-output-to-file
|
||||||
|
(build-path src "50x.md")
|
||||||
|
(λ ()
|
||||||
|
(pretty-write
|
||||||
|
'((title "error page")
|
||||||
|
(lang "en")))
|
||||||
|
(write-string "\n# error\n\nthe server ran into an error :(")))
|
||||||
|
|
||||||
(with-output-to-file
|
(with-output-to-file
|
||||||
(build-path dir "nginx.conf")
|
(build-path dir "nginx.conf")
|
||||||
(λ ()
|
(λ ()
|
||||||
|
|
|
@ -22,7 +22,10 @@
|
||||||
|
|
||||||
(define *reserved-slugs*
|
(define *reserved-slugs*
|
||||||
(apply set (map build-path '("hashtag" "user" "tech" "capybara" "dynamic" "robots.txt"
|
(apply set (map build-path '("hashtag" "user" "tech" "capybara" "dynamic" "robots.txt"
|
||||||
"sitemap.xml" "feeds"))))
|
"sitemap.xml" "feeds" "unsupported-browser"))))
|
||||||
|
|
||||||
|
(define *special-slugs*
|
||||||
|
(apply set (map build-path '("/40x" "/50x"))))
|
||||||
|
|
||||||
(define (read-input-doc xref-name [port (current-input-port)])
|
(define (read-input-doc xref-name [port (current-input-port)])
|
||||||
(define metadata (read port))
|
(define metadata (read port))
|
||||||
|
@ -293,7 +296,8 @@
|
||||||
;; TODO : this sucks
|
;; TODO : this sucks
|
||||||
;; we should have a radix tree
|
;; we should have a radix tree
|
||||||
(define xrefs-repo
|
(define xrefs-repo
|
||||||
(for/set ([spec (in-list rule-specs)])
|
(for/set ([spec (in-list rule-specs)]
|
||||||
|
#:unless (set-member? *special-slugs* (rule-spec-xref-name spec)))
|
||||||
(define exploded (explode-path (rule-spec-xref-name spec)))
|
(define exploded (explode-path (rule-spec-xref-name spec)))
|
||||||
(when (and (> (length exploded) 1)
|
(when (and (> (length exploded) 1)
|
||||||
(set-member? *reserved-slugs* (second exploded)))
|
(set-member? *reserved-slugs* (second exploded)))
|
||||||
|
|
|
@ -30,6 +30,8 @@ http {
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri.html $uri/ =404;
|
try_files $uri $uri.html $uri/ =404;
|
||||||
sub_filter "__X_MATHJAX_POLYFILL_PLACEHOLDER__" $mathjax_polyfill;
|
sub_filter "__X_MATHJAX_POLYFILL_PLACEHOLDER__" $mathjax_polyfill;
|
||||||
|
error_page 401 403 404 410 /40x.html;
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue