-Subproject commit 3fdb8e7e2ed8fcf3129de33147d1dd3b4a204b21
+Subproject commit 3a5f8da6c094474cb5de33d40fc94e4497450a25
SET_COOKIE +$((86400 * 90)) pagesize="$(POST pagesize |grep -m1 -xE '[1-9][0-9]*' || printf 50)"
SET_COOKIE +$((86400 * 90)) fakemp4="$(POST fakemp4 |grep -m1 -xE 'yes' || printf no)"
printf 'Location: %s\r\n\r\n' "$(POST ref)"
+ exit 0
;;
esac
-if [ -f "$_DATA/$item" ]; then
+if [ "$item" = "/style.css" ]; then
+ . "$_EXEC/cgilite/file.sh"
+ [ -r "$_DATA/$item" ] && FILE "$_DATA/$item" \
+ || FILE "$_EXEC/style.css"
+elif [ -f "$_DATA/$item" ]; then
case $(GET a) in
tag)
;;
- download)
- ;;
thumbnail)
;;
delete)
;;
- *)
+ *) . "$_EXEC/cgilite/file.sh"
+ FILE "$_DATA/$item"
;;
esac
elif [ -d "$_DATA/$item" ]; then
case $(GET a) in
multitag)
;;
- *) printf 'Content-Type: text/html;charset=utf-8\r\n\r\n'
- "$_EXEC/cgilite/html-sh.sed" <<-EOF
- [!DOCTYPE HTML]
- [html [head [title Listing]
- ] [body
- $(w_search) $(w_prefs)
- ] ]
- EOF
- exit 0
+ *) . "$_EXEC/list.sh"
;;
esac
else
--- /dev/null
+#!/bin/sh
+
+printf 'Content-Type: text/html;charset=utf-8\r\n\r\n'
+
+"$_EXEC/cgilite/html-sh.sed" <<-EOF
+[!DOCTYPE HTML]
+[html [head [title Listing]
+ [link rel=stylesheet href="/style.css" ]
+] [body
+ $(w_search)
+ [input type=checkbox #t_prefs .toggle ][label for=t_prefs ⚙]
+ $(w_prefs)
+] ]
+EOF
+
-Subproject commit c287482dc24988cabd48a085e6d752d12b489550
+Subproject commit 8d60af41a80ea3760dd51c3bc34eab68d88b16ae
--- /dev/null
+body {
+ color: white;
+ background-color: black;
+ margin: 0;
+ padding: 0;
+}
+
+input.toggle {
+ display: none;
+}
+input.toggle + label + * {
+ display: block;
+ overflow: hidden;
+ height: 0;
+}
+input.toggle:checked + label + * { height: auto; }
+
+#search {
+ text-align: center;
+ background-color: #333;
+ padding: .25em;
+ border-bottom: 1px solid;
+ margin: 0;
+}
+
+label[for=t_prefs] {
+ position: absolute;
+ font-size: 1.5em;
+ top: 0; right: .25em;
+}
+
+#t_prefs:checked + label + #prefs {
+ background-color: #333;
+ border: 1px solid;
+ border-top: none;
+ border-right: none;
+ padding: .5em 1em;
+ margin: 0;
+ position: relative;
+ top: -1px;
+ width: 13em;
+ margin-left: auto;
+}
+
+#prefs label[for=prefs_ps] {
+ font-weight: bold;
+}
+#prefs #prefs_ps {
+ max-width: 3em;
+ margin-bottom: 1em;
+}
+#prefs button {
+ margin-top: 1em;
+}
w_search(){
printf '
- [form method=GET action=?
+ [form #search method=GET action=?
[select name=o size=1
[option disabled=disabled Order By]
[option value=Name Name]
w_prefs(){
printf '
- [form method=POST action=?a=setprefs
+ [form #prefs method="POST" action="?a=setprefs"
[hidden "ref" "%s"]
[label for=prefs_ps Pagesize]
- [input type=number name=pagesize value="%s"]
- [checkbox "fakemp4" "yes" #prefs_fmp4] [label for=prefs_fmp4 Fake .MP4 file ending]
+ [input #prefs_ps type=number name=pagesize value="%s"][br]
+ [checkbox "fakemp4" "yes" %s #prefs_fmp4] [label for=prefs_fmp4 Fake .MP4 file ending][br]
[submit "store" "store" Set Cookie]
]
' \
- "$(HTML "$REQUEST_URI")" "$pagesize"
+ "$(HTML "$REQUEST_URI")" \
+ "$(COOKIE pagesize |grep -m1 -xE '[0-9]+' || printf 50)" \
+ "$(COOKIE fakemp4 |grep -m1 -qx yes && printf checked)"
}