diff options
author | metamuffin <metamuffin@disroot.org> | 2024-01-25 21:01:02 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-01-25 21:01:02 +0100 |
commit | 75ab384426ceaef0ef9c117cd180e4c52a5e8f96 (patch) | |
tree | 9a5a17347f40b45644fdeefc70cbdfd808eddfd0 /server | |
parent | 4f4f54ec239df336ca4ecc0cae9126452a2f707c (diff) | |
download | jellything-75ab384426ceaef0ef9c117cd180e4c52a5e8f96.tar jellything-75ab384426ceaef0ef9c117cd180e4c52a5e8f96.tar.bz2 jellything-75ab384426ceaef0ef9c117cd180e4c52a5e8f96.tar.zst |
debug asset tokens
Diffstat (limited to 'server')
-rw-r--r-- | server/src/routes/api/mod.rs | 10 | ||||
-rw-r--r-- | server/src/routes/mod.rs | 6 |
2 files changed, 12 insertions, 4 deletions
diff --git a/server/src/routes/api/mod.rs b/server/src/routes/api/mod.rs index 7166273..025653b 100644 --- a/server/src/routes/api/mod.rs +++ b/server/src/routes/api/mod.rs @@ -9,7 +9,10 @@ use super::ui::{ }; use crate::database::DataAcid; use anyhow::{anyhow, Context}; -use jellybase::database::{TableExt, T_NODE}; +use jellybase::{ + assetfed::AssetInner, + database::{TableExt, T_NODE}, +}; use jellycommon::{user::CreateSessionParams, Node}; use rocket::{ get, @@ -62,6 +65,11 @@ pub fn r_api_node_raw( .ok_or(anyhow!("node does not exist"))?; Ok(Json(node)) } +#[get("/api/asset_token_raw/<token>")] +pub fn r_api_asset_token_raw(admin: AdminSession, token: &str) -> MyResult<Json<AssetInner>> { + drop(admin); + Ok(Json(AssetInner::deser(token)?)) +} pub struct AcceptJson(bool); impl Deref for AcceptJson { diff --git a/server/src/routes/mod.rs b/server/src/routes/mod.rs index ced786b..27fb4f7 100644 --- a/server/src/routes/mod.rs +++ b/server/src/routes/mod.rs @@ -3,8 +3,9 @@ which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2024 metamuffin <metamuffin.org> */ +use self::playersync::{r_streamsync, PlayersyncChannels}; use crate::{database::DataAcid, routes::ui::error::MyResult}; -use api::{r_api_account_login, r_api_node_raw, r_api_root, r_api_version}; +use api::{r_api_account_login, r_api_asset_token_raw, r_api_node_raw, r_api_root, r_api_version}; use base64::Engine; use jellybase::{federation::Federation, CONF, SECRETS}; use log::warn; @@ -44,8 +45,6 @@ use ui::{ }; use userdata::{r_node_userdata, r_player_progress, r_player_watched}; -use self::playersync::{r_streamsync, PlayersyncChannels}; - pub mod api; pub mod playersync; pub mod stream; @@ -137,6 +136,7 @@ pub fn build_rocket(database: DataAcid, federation: Federation) -> Rocket<Build> r_api_account_login, r_api_root, r_api_node_raw, + r_api_asset_token_raw, ], ) } |