Reject server-routed streams before starting a P2P viewer
This commit is contained in:
1 parent
8a8f52d7f1
commit
d5b9541d1d
9 files changed
+84
-7
No files matched your search
@@ -22,10 +22,17 @@ pub(super) async fn project(ctx:&RuntimeServices)->Result<Vec<StreamPresentation
|
||||
for offer in ctx.streams.offers(key,channel).map_err(stream_error)?{
|
||||
match offer{
|
||||
ChannelOffer::Stream{client,stream}=>{
|
||||
if result.iter().any(|entry|entry.id==tile_id(key,&stream.id)){continue}
|
||||
let id=tile_id(key,&stream.id);
|
||||
let sfu=stream.uses_sfu();
|
||||
let unsupported="ui.this.stream.uses.a.teamspeak.sfu.server";
|
||||
if let Some(existing)=result.iter_mut().find(|entry|entry.id==id){
|
||||
if sfu{existing.status=catalog.text(unsupported);existing.actions.retain(|a|a.operation!=Operation::StreamRejoin);}
|
||||
continue
|
||||
}
|
||||
let uid=client["uid"].as_str().unwrap_or_default().to_owned();if uid.is_empty(){continue}
|
||||
let target=Target{session:Some(key.clone()),entity:Entity::Stream{id:stream.id.clone(),owner_uid:uid},name:stream.name.clone(),own_channel_id:Some(channel)};
|
||||
result.push(StreamPresentation{id:tile_id(key,&stream.id),title:stream.name,status:catalog.text("ui.watch"),volume:1.0,actions:vec![action(&target,Operation::StreamJoin,&catalog)],target});
|
||||
let (status,actions)=if sfu{(catalog.text(unsupported),vec![])}else{(catalog.text("ui.watch"),vec![action(&target,Operation::StreamJoin,&catalog)])};
|
||||
result.push(StreamPresentation{id,title:stream.name,status,volume:1.0,actions,target});
|
||||
},
|
||||
other=>{
|
||||
let (client,status)=match other{
|
||||
|
||||
Reference in new issue
Block a user