From ea958d314bc1ca006af61d0c67c4a48c7a42b15f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Wed, 11 May 2022 00:20:21 +0200 Subject: [PATCH] nocache pragma --- index.cgi | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/index.cgi b/index.cgi index b1b2c2d..90f7d77 100755 --- a/index.cgi +++ b/index.cgi @@ -61,9 +61,12 @@ wiki() { mkdir -p -- "$_DATA/pages/$page/" # Macros expect to find page directory as working dir ( cd -- "$_DATA/pages/$page/"; - md <"$mdfile" |tee -- "${cache}.$$" + sed -E '1,20{ /^%[a-z]+/d; }' "$mdfile" \ + | md |tee -- "${cache}.$$" ) - mv -- "${cache}.$$" "${cache}" + grep -q '^%nocache' "$mdfile" \ + && rm -- "${cache}.$$" \ + || mv -- "${cache}.$$" "${cache}" fi } @@ -71,16 +74,18 @@ case "${PATH_INFO}" in /"[.]"/*) FILE "${_EXEC}/${PATH_INFO#/\[.\]}" ;; + */\[*\]/) :;; */) theme_page "${PATH_INFO}" + exit 0 ;; */"[login]") - [ "$USER_NAME" ] \ - && REDIRECT "./" \ - || theme_login + theme_login + exit 0 ;; */"[register]") theme_register + exit 0 ;; */"#"*) : # TODO: Invalid page name -- 2.39.2