From: Paul Hänsch Date: Wed, 28 Jul 2021 20:59:45 +0000 (+0200) Subject: clear deleted polls from bookmarks X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=a193b5186dd4d330110f120fbc23277e426679f9;p=webpoll clear deleted polls from bookmarks --- diff --git a/index.cgi b/index.cgi index 1bfc2b7..e0f8a1c 100755 --- a/index.cgi +++ b/index.cgi @@ -13,8 +13,14 @@ _BASE="${_BASE%/}" PATH_INFO="$(PATH "/${PATH_INFO#${_BASE}}")" -#git init "$_DATA" >/dev/null & -bookmarks="$(COOKIE bookmarks |grep -xE '[0-9a-zA-Z:=]{16}(/[0-9a-zA-Z:=]{16})?( [0-9a-zA-Z:=]{16}(/[0-9a-zA-Z:=]{16})?)*')" +# bookmarks_cookie="$(COOKIE bookmarks |grep -xE '[0-9a-zA-Z:=]{16}(/[0-9a-zA-Z:=]{16})?( [0-9a-zA-Z:=]{16}(/[0-9a-zA-Z:=]{16})?)*')" +bookmarks='' +for bm in $(COOKIE bookmarks); do + [ -f "${_DATA}/$(checkid "${bm%/*}")" ] && bookmarks="${bookmarks}${bookmarks:+ }${bm}" +done +if [ "$bookmarks" ]; then + SET_COOKIE +$((182 * 86400)) bookmarks="${bm}" Path="${_BASE}/" +fi yield_page(){ title="${1:-Webpoll}" page="$2"