aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-01-31 23:15:22 +0100
committermetamuffin <metamuffin@disroot.org>2024-01-31 23:15:22 +0100
commitc4362adc4af0c4dcdbb2346a9e077bdf580d8007 (patch)
tree0500be10f312714973338969c50dd8319d839965 /web
parent39a4b10789ff9f97ddc3de7d55bc845cabaac333 (diff)
downloadjellything-c4362adc4af0c4dcdbb2346a9e077bdf580d8007.tar
jellything-c4362adc4af0c4dcdbb2346a9e077bdf580d8007.tar.bz2
jellything-c4362adc4af0c4dcdbb2346a9e077bdf580d8007.tar.zst
fix native player
Diffstat (limited to 'web')
-rwxr-xr-xweb/native-protocol/install14
-rwxr-xr-xweb/native-protocol/jellynative22
-rwxr-xr-xweb/native-protocol/uninstall12
3 files changed, 31 insertions, 17 deletions
diff --git a/web/native-protocol/install b/web/native-protocol/install
index f197b01..97d92f6 100755
--- a/web/native-protocol/install
+++ b/web/native-protocol/install
@@ -1,5 +1,13 @@
#!/bin/fish
-install -Dm750 jellynative ~/.local/bin/jellynative
-install -Dm640 jellynative.desktop ~/.local/share/applications/jellynative.desktop
-update-desktop-database ~/.local/share/applications
+if fish_is_root_user
+ echo 'Global installation'
+ install -Dm755 jellynative /usr/local/bin/jellynative
+ install -Dm644 jellynative.desktop /usr/local/share/applications/jellynative.desktop
+ update-desktop-database /usr/local/share/applications
+else
+ echo 'User installation'
+ install -Dm750 jellynative ~/.local/bin/jellynative
+ install -Dm640 jellynative.desktop ~/.local/share/applications/jellynative.desktop
+ update-desktop-database ~/.local/share/applications
+end
echo 'In firefox about:config set network.protocol-handler.expose.jellynative to true'
diff --git a/web/native-protocol/jellynative b/web/native-protocol/jellynative
index e1b310c..8694272 100755
--- a/web/native-protocol/jellynative
+++ b/web/native-protocol/jellynative
@@ -4,9 +4,6 @@ set protocol $parts[1]
set action $parts[3]
set secret $parts[4]
-if not test $protocol = "jellynative:"
- die "Wrong protocol"
-end
function die
notify-send -u critical -t 5000 'Jellynative Error' $argv[1]
@@ -14,26 +11,23 @@ function die
end
function player
- if which mpv &>/dev/null
- set playercommand mpv
- else if which vlc &>/dev/null
- set playercommand vlc
- else
- die 'No Media Player detected'
- end
notify-send -u low -t 1000 Jellynative 'Player ist launching...'
- if not $playercommand $argv[2..] $argv[1]
+ if not mpv --http-header-fields=(echo -s 'Cookie: session=' $argv[1]) $argv[3..] $argv[2]
die 'Player exited with error code'
end
end
+if not test $protocol = "jellynative:"
+ die "Wrong protocol"
+end
+
set config_dir $XDG_CONFIG_HOME
if test -z $config
set config_dir ~/.config
end
set config $config_dir/jellynative_secret
if not test -e $config
- random 0 4000000000 >$config
+ head -c 16 /dev/urandom | xxd -p >$config
end
set secret (cat $config)
@@ -47,9 +41,9 @@ switch $action
case show-secret
notify-send -u low Jellynative "Secret: $secret"
case player
- player (string join / $parts[5..])
+ player $parts[5] (string join / $parts[6..])
case player-fullscreen
- player (string join / $parts[5..]) --fullscreen
+ player $parts[5] (string join / $parts[6..]) --fullscreen
case '*'
die 'Unknown action'
end
diff --git a/web/native-protocol/uninstall b/web/native-protocol/uninstall
new file mode 100755
index 0000000..42e074e
--- /dev/null
+++ b/web/native-protocol/uninstall
@@ -0,0 +1,12 @@
+#!/bin/fish
+if fish_is_root_user
+ echo 'Global uninstallation'
+ rm /usr/local/bin/jellynative
+ rm /usr/local/share/applications/jellynative.desktop
+ update-desktop-database /usr/local/share/applications
+else
+ echo 'User uninstallation'
+ rm ~/.local/bin/jellynative
+ rm ~/.local/share/applications/jellynative.desktop
+ update-desktop-database ~/.local/share/applications
+end