3 _EXEC="${_EXEC:-${0%/*}/}"
7 . "$_EXEC"/cgilite/cgilite.sh
8 . "$_EXEC"/cgilite/session.sh
9 . "$_EXEC"/cgilite/file.sh
10 . "$_EXEC"/cgilite/storage.sh
11 #. "$_EXEC"/session_lock.sh
14 export MD_HTML="false"
15 if [ "$(which awk)" ]; then
16 markdown() { awk -f "$_EXEC/cgilite/markdown.awk"; }
18 markdown() { busybox awk -f "$_EXEC/cgilite/markdown.awk"; }
21 PATH_INFO="$(PATH "/${PATH_INFO#${_BASE}}")"
23 #git init "$_DATA" >/dev/null &
24 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})?)*')"
27 title="${1:-Webpoll}" page="$2"
28 printf '%s\r\n' 'Content-Type: text/html; charset=utf-8' \
29 "Content-Security-Policy: script-src 'none'" \
33 [meta name="viewport" content="width=device-width"]
34 [link rel="stylesheet" type="text/css" href="%s/common.css"]
35 [link rel="stylesheet" type="text/css" href="%s/widgets.css"]
36 [link rel="stylesheet" type="text/css" href="%s/webpoll.css"]
39 ' "$_BASE" "$_BASE" "$_BASE" "$(HTML "$title")" "$page"
42 } |"$_EXEC/cgilite/html-sh.sed" -u
47 local file="$_DATA/$id"
48 if [ -f "$file" ]; then
49 DBM "$file" get title || printf 'Unnamed Page'
55 page_home() { . "$_EXEC"/home.sh; }
56 page_newdate() { . "$_EXEC"/newdate.sh; }
57 page_poll() { . "$_EXEC"/poll.sh; }
60 /favicon.ico) printf '%s\r\n' 'Content-Length: 0' '';;
61 /common.css) FILE "$_EXEC/cgilite/common.css";;
62 /widgets.css|/webpoll.css) FILE "${_EXEC}/${PATH_INFO}";;
64 /[0-9a-zA-Z:=]???????????????/[0-9a-zA-Z:=]???????????????) page_newdate;;
66 /[0-9a-zA-Z:=]???????????????) page_poll;;