aboutsummaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/routes/api/mod.rs10
-rw-r--r--server/src/routes/mod.rs6
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,
],
)
}