From 4d35c26aaac2a8738a8831118671d7a70dca827c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Wed, 11 May 2022 18:21:13 +0200 Subject: [PATCH] error pages 409 and 500 --- macros/errormessage | 7 +++++++ pages/[wiki]/409/#page.md | 9 +++++++++ pages/[wiki]/500/#page.md | 9 +++++++++ themes/default.sh | 20 ++++++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100755 macros/errormessage create mode 100644 pages/[wiki]/409/#page.md create mode 100644 pages/[wiki]/500/#page.md diff --git a/macros/errormessage b/macros/errormessage new file mode 100755 index 0000000..c95688a --- /dev/null +++ b/macros/errormessage @@ -0,0 +1,7 @@ +#!/bin/sh + +. "$_EXEC/cgilite/cgilite.sh" + +if [ "$1" -o "$ERROR_MSG" ]; then + printf '

%s

' "$(HTML "${1:-${ERROR_MSG}}")" +fi diff --git a/pages/[wiki]/409/#page.md b/pages/[wiki]/409/#page.md new file mode 100644 index 0000000..0727e7c --- /dev/null +++ b/pages/[wiki]/409/#page.md @@ -0,0 +1,9 @@ +%nocache + +409 +=== + +**Conflict** +<> + +<> diff --git a/pages/[wiki]/500/#page.md b/pages/[wiki]/500/#page.md new file mode 100644 index 0000000..0d56e0a --- /dev/null +++ b/pages/[wiki]/500/#page.md @@ -0,0 +1,9 @@ +%nocache + +500 +=== + +**Internal Server Error** +<> + +<> diff --git a/themes/default.sh b/themes/default.sh index 9826a79..36710db 100755 --- a/themes/default.sh +++ b/themes/default.sh @@ -192,3 +192,23 @@ theme_404(){ printf "Content-Length: 0\r\n\r\n" fi } + +theme_409(){ + printf "%s\r\n" "Status: 409 Conflict" + + if [ "$(mdfile '/[wiki]/409/')" ]; then + theme_page '/[wiki]/409/' + else + printf "Content-Length: 0\r\n\r\n" + fi +} + +theme_500(){ + printf "%s\r\n" "Status: 500 Internal Server Error" + + if [ "$(mdfile '/[wiki]/500/')" ]; then + theme_page '/[wiki]/500/' + else + printf "Content-Length: 0\r\n\r\n" + fi +} -- 2.39.2