X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=page_video.sh;h=296148472cb430d26ad363ceb307824791f0eb79;hb=e6f798224430d0ecb16835c58c7ea1610a65d0a4;hp=9f214093b8f4dcabaad20657ec48c42f3558ecf4;hpb=0e7d01bc8a75d903e27f17ff2b89f41794d8ffea;p=rawnet diff --git a/page_video.sh b/page_video.sh index 9f21409..2961484 100644 --- a/page_video.sh +++ b/page_video.sh @@ -71,7 +71,7 @@ update_video(){ "$(printf %s "${description-$(UNSTRING "$DESCRIPTION")}" |markdown |STRING)" \ "${FUTUREUSE:-\\}" else - printf '%s %s %s %i %i %i %s %s %s %i %s %s\n' \ + printf '%s %s %s %i %i %f %s %s %s %i %s %s\n' \ "$ID" "$NAME" "$DESCRIPTION" "$RESX" "$RESY" "$LENGTH" \ "$COVER" "$STATUS" "$UPLOADER" "$HITS" "$DESCR_CACHE" \ "$FUTUREUSE" @@ -87,7 +87,6 @@ update_video(){ UPLOAD(){ local file="$1" local boundary line last - local CONTENT_TYPE="$(HEADER Content-Type)" [ ! "${CONTENT_TYPE}" -o "${CONTENT_TYPE##multipart/form-data;*}" ] && return 1 @@ -96,15 +95,15 @@ UPLOAD(){ head -c "$CONTENT_LENGTH" \ | sed -nE ' + # discard lines prior to boundary /^--'"${boundary}"'\r?$/!b; - :A; n; - /^\r?$/!bA; - n; - :FILE - p; n; + # discard lines until first blank + :A; n; /^\r?$/!bA; n; + # print lines until boundary ( = actual file upload) + :FILE; p; n; /^--'"${boundary}"'(--)?\r?$/!bFILE; - :END - $q; n; bEND; + # discard remaining lines + :END; $q; n; bEND; ' >"$file" truncate -s $(( $(stat -c %s -- "$file") -2 )) -- "$file" } @@ -137,9 +136,8 @@ if [ "$REQUEST_METHOD" = POST -a "$channel" -a "$video" ]; then head -c "$CONTENT_LENGTH" >/dev/null REDIRECT "${_BASE}/channel/${channel}/${video}/#ERROR_UPLOAD_NOCLOBBER" elif UPLOAD "$_DATA/$channel/$video.mp4"; then - update_video "$video" "$VIDEO_NAME" "$VIDEO_DESCRIPTION" 0 0 0 \ - "$VIDEO_COVER" private "$VIDEO_UPOADER" "$VIDEO_HITS" \ - "" "" + update_video "$video" status=private + VIDEO_STATUS=private fi fi @@ -162,6 +160,61 @@ if [ "$channel" -a "$video" -a "$action" = edit ]; then [submit "action" "update_video_cancel" . Cancel] ] EOF + +elif [ "$channel" -a "$video" -a "$action" = frameuploadprogress ]; then + AUTHOR || REDIRECT "$_BASE/$channel/$video/#ERROR_EDIT_NOTALLOWED" + printf '%s\r\n' 'Content-Type: text/html' 'Connection: close' '' + printf ' +
+