From 1f1889fbe25a680b6e2c6b22a576a2192ee1bcaa Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 1 Oct 2015 15:27:46 +0000 Subject: [PATCH] updates in shcgi svn path=/trunk/; revision=91 --- constants.sh => globals.sh | 4 +++- pages/error.sh | 32 -------------------------------- pages/list.sh | 12 ------------ pages/view.sh | 12 ------------ templates/frame.html.sh | 8 ++++---- 5 files changed, 7 insertions(+), 61 deletions(-) rename constants.sh => globals.sh (97%) delete mode 100755 pages/error.sh diff --git a/constants.sh b/globals.sh similarity index 97% rename from constants.sh rename to globals.sh index 266f734..1445d48 100755 --- a/constants.sh +++ b/globals.sh @@ -17,12 +17,14 @@ # You should have received a copy of the GNU Affero General Public License # along with Serve0. If not, see . + alias _wiki="stx2any --no-template --link-abbrevs --quote -T html" -[ -z "${_GET[p]}" ] && _GET[p]=list file_pattern='^.*(mov|ts|mpg|mpeg|mp4|m4v|avi|mkv|flv|sfv|wmv|ogm|webm|iso|rmvb)$' data_dirs cache meta mp4 videos thumbs trash by_length transcoded +PAGE="${_GET[p]:-${PAGE:-list}}" + cgi_cookie validate(){ printf '%s\n' "$1" |sed -rn '2q;/^('"$2"')$/{p;q};a'"$3"; } diff --git a/pages/error.sh b/pages/error.sh deleted file mode 100755 index b842cf0..0000000 --- a/pages/error.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -# Copyright 2014 Paul Hänsch -# -# This file is part of Serve0 -# -# Serve0 is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Serve0 is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Serve0 If not, see . - -case "$1" in - title) - ;; - css) - ;; - body) -cat < -Quoth the server: 404 -EOF - ;; -esac - diff --git a/pages/list.sh b/pages/list.sh index cc5a7d2..94d12ce 100755 --- a/pages/list.sh +++ b/pages/list.sh @@ -46,15 +46,3 @@ category_selected(){ | sed -rn 's;^(0|1) '"$cat"'([^:]+)$;\1 \2;p' \ | sed 's;^0 ;;' } - -case "$1" in - title) - echo "Videos" - ;; - css) - . ${_EXEC}/templates/common.css.sh - ;; - body) - . ${_EXEC}/templates/list.html.sh - ;; -esac diff --git a/pages/view.sh b/pages/view.sh index 9dc0cc7..639bf0a 100755 --- a/pages/view.sh +++ b/pages/view.sh @@ -28,15 +28,3 @@ length=0; width=0; height=0; eval $(mplayer -noconsolecontrols -input file=/dev/null -slave -really-quiet -identify -frames 0 -ao null -vo null "$video" 2>/dev/null\ | sed -rn 's:ID_VIDEO_WIDTH=(.*):width=\1:p;s:ID_VIDEO_HEIGHT=(.*):height=\1:p;s:ID_LENGTH=(.*)(\..*)$:length=\1:p;') video="videos/$info" - -case "$1" in - title) - echo "Videos" - ;; - css) - . ${_EXEC}/templates/common.css.sh - ;; - body) - . ${_EXEC}/templates/view.html.sh - ;; -esac diff --git a/templates/frame.html.sh b/templates/frame.html.sh index 4172786..7d953da 100755 --- a/templates/frame.html.sh +++ b/templates/frame.html.sh @@ -1,4 +1,4 @@ -# Copyright 2014 Paul Hänsch +# Copyright 2014, 2015 Paul Hänsch # # This file is part of Serve0 # @@ -21,15 +21,15 @@ cat < - $(. $PAGE title) + ${PAGE} - $(. $PAGE body) + $([ -x "${BODY}" ] && . "${BODY}" || printf %s Error) EOF -- 2.39.2