X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=index.cgi;h=db4d749b7c179efde9b4fec43a5158c5e4dd4d21;hb=71152d935975fa673d7ad4398a1757228cab8b8c;hp=57398a4ff7f9aabc4879b9a2b20cfb5b3b6dcb94;hpb=1861b7d2167a225930ff04d38d5d835a98c5d5c5;p=shellwiki diff --git a/index.cgi b/index.cgi index 57398a4..db4d749 100755 --- a/index.cgi +++ b/index.cgi @@ -6,9 +6,13 @@ . "${_EXEC}/tools.sh" . "${_EXEC}/acl.sh" +REV_ATTACHMENTS=${REV_ATTACHMENTS:-false} WIKI_THEME="${WIKI_THEME:-default}" . "${_EXEC}/themes/${WIKI_THEME}.sh" +# Renew session cookie, only if cookie already set +[ "$(COOKIE session)" ] && SESSION_COOKIE + wiki_text() { # Print source text of a wiki page # Get page from data or underlay dir @@ -19,6 +23,21 @@ wiki_text() { cat -- "$mdfile" } +if [ "$(which git)" -a ! -f "$_DATA/.gitignore" ]; then + cat >"$_DATA/.gitignore" <<-EOF + users.db + serverkey + $([ "$REV_ATTACHMENTS" = true ] || printf %s "**/#attachments/") + **/#cache/ + **/#page.lock + **/#page.*.cache + **/#page.*.cache.* + EOF + git init "$_DATA" + git -C "$_DATA" add .gitignore + git -C "$_DATA" commit -m 'initialization' -- .gitignore +fi 1>&2 + for handler in "$_EXEC"/handlers/*; do . "$handler" && break done