3 [ -z "${_EXEC%/}" ] && _EXEC="$(realpath "${0%/*}")" || _EXEC="${_EXEC%/}"
4 [ -z "${_DATA%/}" ] && _DATA=. || _DATA="${_DATA%/}"
8 file_pattern='^.*\.(mov|ts|mpg|mpeg|mp4|m4v|avi|mkv|flv|sfv|wmv|ogm|ogv|webm|iso|rmvb)$'
10 . "$_EXEC/cgilite/cgilite.sh"
15 ORDER="$(GET o |grep -m1 -xE 'Date|Name|Length' || printf Name)"
16 LISTSIZE="$(COOKIE pagesize |grep -m1 -xE '[1-9][0-9]*' || printf 50)"
17 ITEM="$(PATH "${PATH_INFO#/}")"
21 SET_COOKIE +$((86400 * 90)) pagesize="$(POST pagesize |grep -m1 -xE '[1-9][0-9]*' || printf 50)"
22 SET_COOKIE +$((86400 * 90)) mode="$(POST mode |grep -m1 -xE 'browse|index' || printf browse)"
23 SET_COOKIE +$((86400 * 90)) fakemp4="$(POST fakemp4 |grep -m1 -xE 'yes' || printf no)"
24 REDIRECT "$(POST ref)"
28 if [ "$ITEM" = "/style.css" ]; then
29 . "$_EXEC/cgilite/file.sh"
30 [ -r "$_DATA/$ITEM" ] && FILE "$_DATA/$ITEM" \
31 || FILE "$_EXEC/style.css"
32 elif [ -f "$_DATA/$ITEM" ]; then
37 . "$_EXEC/cgilite/file.sh"
38 index="$_DATA/${ITEM%/*}/.index"
39 thumb="$index/${ITEM##*/}"; thumb="${thumb%.*}.jpg"
40 [ -d "$index" -a \! -f "$thumb" ] \
41 && file="$_DATA/$ITEM" . "$_EXEC/thumbnail.sh"
46 *) . "$_EXEC/cgilite/file.sh"
50 elif [ -d "$_DATA/$ITEM" ]; then
53 if [ "$(POST recursive)" = yes ]; then
54 find "$_DATA/$ITEM" -depth -type d \! -name .index \
55 -exec mkdir -p '{}'/.index \;
57 mkdir -p "$_DATA/$ITEM/.index"
59 REDIRECT "$(POST ref)"
62 . "$_EXEC/multitag.sh"
63 REDIRECT "$(POST ref)"
69 printf 'Status: 404 Not Found\r\nContent-Length 0:\r\n\r\n'