aboutsummaryrefslogtreecommitdiff
path: root/stream/src/jhls.rs
diff options
context:
space:
mode:
Diffstat (limited to 'stream/src/jhls.rs')
-rw-r--r--stream/src/jhls.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/stream/src/jhls.rs b/stream/src/jhls.rs
index 5183a26..850cc32 100644
--- a/stream/src/jhls.rs
+++ b/stream/src/jhls.rs
@@ -1,8 +1,9 @@
use anyhow::Result;
-use jellybase::CONF;
+use jellybase::{permission::PermissionSetExt, CONF};
use jellycommon::{
jhls::{JhlsMetadata, JhlsTrack},
stream::StreamSpec,
+ user::{PermissionSet, UserPermission},
LocalTrack, Node,
};
use tokio::io::{AsyncWriteExt, DuplexStream};
@@ -12,6 +13,7 @@ pub async fn jhls_stream(
track_sources: Vec<LocalTrack>,
_spec: StreamSpec,
mut b: DuplexStream,
+ perms: &PermissionSet,
) -> Result<()> {
let media = node.public.media.clone().unwrap();
let tracks = tokio::task::spawn_blocking(move || {
@@ -42,7 +44,11 @@ pub async fn jhls_stream(
let out = serde_json::to_string(&JhlsMetadata {
tracks,
- extra_profiles: CONF.transcoding_profiles.clone(),
+ extra_profiles: if perms.check(&UserPermission::Transcode) {
+ CONF.transcoding_profiles.clone()
+ } else {
+ vec![]
+ },
duration: media.duration,
})?;
tokio::spawn(async move { b.write_all(out.as_bytes()).await });