diff options
author | metamuffin <metamuffin@disroot.org> | 2024-04-13 16:09:36 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-04-13 16:09:36 +0200 |
commit | e503d5af484fb55a07125b3708ba658606e56c5d (patch) | |
tree | 25c0a081cdc651c69b44af88c6ac37c44d416188 | |
parent | 489cd4d833fb106d4a5257532b340969805f3f5c (diff) | |
download | jellything-e503d5af484fb55a07125b3708ba658606e56c5d.tar jellything-e503d5af484fb55a07125b3708ba658606e56c5d.tar.bz2 jellything-e503d5af484fb55a07125b3708ba658606e56c5d.tar.zst |
start native player at time
-rw-r--r-- | server/src/routes/ui/account/settings.rs | 2 | ||||
-rw-r--r-- | server/src/routes/ui/player.rs | 9 | ||||
-rwxr-xr-x | web/native-protocol/jellynative | 13 | ||||
-rw-r--r-- | web/script/player/mod.ts | 2 |
4 files changed, 13 insertions, 13 deletions
diff --git a/server/src/routes/ui/account/settings.rs b/server/src/routes/ui/account/settings.rs index ec92ba2..1b0de99 100644 --- a/server/src/routes/ui/account/settings.rs +++ b/server/src/routes/ui/account/settings.rs @@ -95,7 +95,7 @@ fn settings_page(session: Session, flash: Option<MyResult<String>>) -> DynLayout label[for="native_secret"] { "Native Secret" } input[type="password", id="native_secret", name="native_secret"]; input[type="submit", value="Update"]; - p { "The secret can be found in " code{"$XDG_CONFIG_HOME/jellynative_secret"} " or by clicking " a.button[href="jellynative://show-secret"] { "Show Secret" } "." } + p { "The secret can be found in " code{"$XDG_CONFIG_HOME/jellynative_secret"} " or by clicking " a.button[href="jellynative://show-secret-v1"] { "Show Secret" } "." } } }, ..Default::default() diff --git a/server/src/routes/ui/player.rs b/server/src/routes/ui/player.rs index 80386ad..69445ed 100644 --- a/server/src/routes/ui/player.rs +++ b/server/src/routes/ui/player.rs @@ -51,7 +51,7 @@ impl PlayerConfig { } } -fn jellynative_url(action: &str, secret: &str, node: &str, session: &str) -> String { +fn jellynative_url(action: &str, seek: f64, secret: &str, node: &str, session: &str) -> String { let protocol = if CONF.tls { "https" } else { "http" }; let host = &CONF.hostname; let stream_url = uri!(r_stream( @@ -61,7 +61,7 @@ fn jellynative_url(action: &str, secret: &str, node: &str, session: &str) -> Str ..Default::default() } )); - format!("jellynative://{action}/{secret}/{session}/{protocol}://{host}{stream_url}",) + format!("jellynative://{action}/{secret}/{session}/{seek}/{protocol}://{host}{stream_url}",) } #[get("/n/<id>/player?<conf..>", rank = 4)] @@ -84,6 +84,7 @@ pub fn r_player<'a>( } Ok(Either::Right(Redirect::temporary(jellynative_url( action, + conf.t.unwrap_or(0.), &sess.user.native_secret, id, &token::create( @@ -97,10 +98,10 @@ pub fn r_player<'a>( match conf.kind.unwrap_or(sess.user.player_preference) { PlayerKind::Browser => (), PlayerKind::Native => { - return native_session("player"); + return native_session("player-v2"); } PlayerKind::NativeFullscreen => { - return native_session("player-fullscreen"); + return native_session("player-fullscreen-v2"); } } diff --git a/web/native-protocol/jellynative b/web/native-protocol/jellynative index 8694272..51c1c6b 100755 --- a/web/native-protocol/jellynative +++ b/web/native-protocol/jellynative @@ -4,7 +4,6 @@ set protocol $parts[1] set action $parts[3] set secret $parts[4] - function die notify-send -u critical -t 5000 'Jellynative Error' $argv[1] exit 1 @@ -31,19 +30,19 @@ if not test -e $config end set secret (cat $config) -if test $action != show-secret +if test $action != show-secret-v1 if test $secret != $parts[4] die 'Incorrect secret' end end switch $action - case show-secret + case show-secret-v1 notify-send -u low Jellynative "Secret: $secret" - case player - player $parts[5] (string join / $parts[6..]) - case player-fullscreen - player $parts[5] (string join / $parts[6..]) --fullscreen + case player-v2 + player $parts[5] (string join / $parts[7..]) --seek=$parts[6] + case player-fullscreen-v2 + player $parts[5] (string join / $parts[7..]) --fullscreen --start=$parts[6] case '*' die 'Unknown action' end diff --git a/web/script/player/mod.ts b/web/script/player/mod.ts index 59aae99..693f04c 100644 --- a/web/script/player/mod.ts +++ b/web/script/player/mod.ts @@ -159,7 +159,7 @@ function initialize_player(el: HTMLElement, node_id: string) { playersync_controls(sync_state, player), e("button", "Launch Native Player", { onclick: () => { - window.location.href = `?kind=nativefullscreen` + window.location.href = `?kind=nativefullscreen&t=${player.position.value}` } }) )) |