#!/bin/sh [ -z "${_EXEC%/}" ] && _EXEC="$(realpath "${0%/*}")" || _EXEC="${_EXEC%/}" [ -z "${_DATA%/}" ] && _DATA=. || _DATA="${_DATA%/}" . "$_EXEC/cgilite/cgilite.sh" . "$_EXEC/widgets.sh" FILTER="$(GET f)" SEARCH="$(GET s)" ORDER="$(GET o |grep -m1 -xE 'Date|Name|Length' || printf Name)" LISTSIZE="$(COOKIE pagesize |grep -m1 -xE '[1-9][0-9]*' || printf 50)" ITEM="$(PATH "${PATH_INFO#/}")" case $(GET a) in setprefs) SET_COOKIE +$((86400 * 90)) pagesize="$(POST pagesize |grep -m1 -xE '[1-9][0-9]*' || printf 50)" SET_COOKIE +$((86400 * 90)) mode="$(POST mode |grep -m1 -xE 'browse|index' || printf browse)" SET_COOKIE +$((86400 * 90)) fakemp4="$(POST fakemp4 |grep -m1 -xE 'yes' || printf no)" REDIRECT "$(POST ref)" ;; esac 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) ;; thumbnail) printf 'Status: 404 Not Found\r\nContent-Length 0:\r\n\r\n' ;; delete) ;; *) . "$_EXEC/cgilite/file.sh" FILE "$_DATA/$ITEM" ;; esac elif [ -d "$_DATA/$ITEM" ]; then case $(GET a) in multitag) ;; *) . "$_EXEC/list.sh" ;; esac else printf 'Status: 404 Not Found\r\nContent-Length 0:\r\n\r\n' fi