3 [ -z "${_EXEC%/}" ] && _EXEC="$(realpath "${0%/*}")" || _EXEC="${_EXEC%/}"
4 [ -z "${_DATA%/}" ] && _DATA=. || _DATA="${_DATA%/}"
6 file_pattern='^.*\.(mov|ts|mpg|mpeg|mp4|m4v|avi|mkv|flv|sfv|wmv|ogm|ogv|webm|iso|rmvb)$'
8 . "$_EXEC/cgilite/cgilite.sh"
12 ORDER="$(GET o |grep -m1 -xE 'Date|Name|Length' || printf Name)"
13 LISTSIZE="$(COOKIE pagesize |grep -m1 -xE '[1-9][0-9]*' || printf 50)"
14 ITEM="$(PATH "${PATH_INFO#/}")"
18 SET_COOKIE +$((86400 * 90)) pagesize="$(POST pagesize |grep -m1 -xE '[1-9][0-9]*' || printf 50)"
19 SET_COOKIE +$((86400 * 90)) mode="$(POST mode |grep -m1 -xE 'browse|index' || printf browse)"
20 SET_COOKIE +$((86400 * 90)) fakemp4="$(POST fakemp4 |grep -m1 -xE 'yes' || printf no)"
21 REDIRECT "$(POST ref)"
25 if [ "$ITEM" = "/style.css" ]; then
26 . "$_EXEC/cgilite/file.sh"
27 [ -r "$_DATA/$ITEM" ] && FILE "$_DATA/$ITEM" \
28 || FILE "$_EXEC/style.css"
29 elif [ -f "$_DATA/$ITEM" ]; then
34 . "$_EXEC/cgilite/file.sh"
35 index="$_DATA/${ITEM%/*}/.index"
36 thumb="$index/${ITEM##*/}"; thumb="${thumb%.*}.jpg"
37 [ -d "$index" -a \! -f "$thumb" ] \
38 && file="$_DATA/$ITEM" . "$_EXEC/thumbnail.sh"
43 *) . "$_EXEC/cgilite/file.sh"
47 elif [ -d "$_DATA/$ITEM" ]; then
50 . "$_EXEC/advsearch.sh"
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'