]> git.plutz.net Git - serve0/blobdiff - actions/watch.sh
use HTT_HOST in coop redirect
[serve0] / actions / watch.sh
index 58c1e1b42858f04ec797b013e89bed731465d9a6..cfa543723f289e1d1f6fe0a1ef29c36a0e10fbe8 100755 (executable)
@@ -28,11 +28,11 @@ linkinfo="$(urlsafe "$info")"
 if [ "${_COOKIE[fakemp4]}" = yes ] && [ "${info##*.}" != mp4 ]; then
   [ -e "${_DATA}/videos/${info%.*}.mp4" ] || ln -s "${_DATA}/videos/$info" "${_DATA}/mp4/${info%.*}.mp4"
   videourl="$(urlsafe "mp4/${info%.*}.mp4")"
-elif [ -z "$info" ]; then
-  videourl="$(urlsafe "${location#/}")"
-else [ -z "$foreign" ];then
+elif [ -n "$foreign" ]; then
   _COOKIE[watch]=server
   videourl="${_GET[url]}"
+elif [ -z "$info" ]; then
+  videourl="$(urlsafe "${location#/}")"
 else
   videourl="$(urlsafe "videos/$info")"
 fi
@@ -40,7 +40,7 @@ fi
 case "$_COOKIE[watch]" in
   raspi)
     rpiaddr="http://atoemchen.helmchyn.no-ip.biz/?action=watch&url="
-    redirect "${rpiaddr}$(urlsafe "http://jupiter:8000/${videourl}")"
+    redirect "${rpiaddr}$(urlsafe "http://${HTTP_HOST}/${videourl}")"
   ;;
   480p)
     [ $height -gt 480 ] && redirect "?action=transcode&i=${linkinfo}&t=480" \
@@ -56,6 +56,7 @@ case "$_COOKIE[watch]" in
   server)
     [ -n "$location" ] && playuri="${treeroot%/}/${location#/}"
     [ -n "$info" ]     && playuri="${_DATA}/videos/$info"
+    [ -n "$foreign" ]  && playuri="$videourl"
 
     metafile="${_DATA}/meta/${info}.meta"