]> git.plutz.net Git - serve0/blobdiff - actions/watch.sh
submit page locators via post instead of relying on referrer
[serve0] / actions / watch.sh
index 01de7d57555739c2bae3a6035cd68dda458a7408..60d29db336b26b9649b5078bf7a0a3aa81474ada 100755 (executable)
@@ -3,10 +3,10 @@
 cgi_refdata
 info="${_GET[i]}"
 location="$(invalidate "${_GET[l]}" '(.*/)?\.\.(/.*)?|' /)"
-order="${_REF[o]}"
-search="${_REF[s]}"
-filter="${_REF[f]}"
-page="${_REF[pn]}"
+order="${_POST[o]}"
+search="${_POST[s]}"
+filter="${_POST[f]}"
+page="${_POST[pn]}"
 
 watch_link=''
 [ -n "$location" ] && watch_link="l=$(urlsafe "${location}")&"
@@ -71,18 +71,20 @@ case "${_COOKIE[watch]}" in
       "${_EXEC}"/helpers/genmeta.sh "$playuri" "$playmeta" >/dev/null
     fi
 
-    DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1006 \
-      nohup /usr/bin/mplayer -ao pulse \
+    export DISPLAY=":0"
+    uid="$(id |sed -rn '1s;.*uid=([0-9]+)[^0-9].*;1;p')"
+    export XDG_RUNTIME_DIR="/run/user/$uid"  # required for Pulseaudio
+
+    nohup /usr/bin/mplayer -ao pulse \
       -slave -input file="$fifofile" \
       -volume "$volume" \
       "$playuri" >"$statusfile" 2>/dev/null &
 
     # # MPlayer2:
-    # DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1006 \
-    #   nohup /usr/bin/mplayer -ao pulse --quiet \
+    # nohup /usr/bin/mplayer -ao pulse \
     #   --slave --input=file="$fifofile" \
     #   --volume="$volume" \
-    #   "$playuri" >/dev/null 2>/dev/null &
+    #   "$playuri" >"$statusfile" 2>/dev/null &
 
     redirect "?p=playctl&${watch_link}"
   ;;