支持配置是否开去推流鉴权

pull/673/head
648540858 2022-11-08 20:29:27 +08:00
parent 73c7dab47f
commit cc4c4ac144
3 changed files with 50 additions and 36 deletions

View File

@ -35,6 +35,8 @@ public class UserSetting {
private Boolean streamOnDemand = Boolean.TRUE; private Boolean streamOnDemand = Boolean.TRUE;
private Boolean pushAuthority = Boolean.TRUE;
private String serverId = "000000"; private String serverId = "000000";
private String thirdPartyGBIdReg = "[\\s\\S]*"; private String thirdPartyGBIdReg = "[\\s\\S]*";
@ -156,4 +158,12 @@ public class UserSetting {
public void setStreamOnDemand(Boolean streamOnDemand) { public void setStreamOnDemand(Boolean streamOnDemand) {
this.streamOnDemand = streamOnDemand; this.streamOnDemand = streamOnDemand;
} }
public Boolean getPushAuthority() {
return pushAuthority;
}
public void setPushAuthority(Boolean pushAuthority) {
this.pushAuthority = pushAuthority;
}
} }

View File

@ -183,8 +183,10 @@ public class ZLMHttpHookListener {
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
String mediaServerId = json.getString("mediaServerId"); String mediaServerId = json.getString("mediaServerId");
MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId); MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);
if (!"rtp".equals(param.getApp())) { if (!"rtp".equals(param.getApp())) {
// 推流鉴权 if (userSetting.getPushAuthority()) {
// 推流鉴权
if (param.getParams() == null) { if (param.getParams() == null) {
logger.info("推流鉴权失败: 缺少不要参数sign=md5(user表的pushKey)"); logger.info("推流鉴权失败: 缺少不要参数sign=md5(user表的pushKey)");
ret.put("code", 401); ret.put("code", 401);
@ -220,13 +222,13 @@ public class ZLMHttpHookListener {
assistRESTfulUtils.addStreamCallInfo(mediaInfo, param.getApp(), param.getStream(), callId, null); assistRESTfulUtils.addStreamCallInfo(mediaInfo, param.getApp(), param.getStream(), callId, null);
}); });
} }
}
}else { }else {
zlmMediaListManager.sendStreamEvent(param.getApp(),param.getStream(), param.getMediaServerId()); zlmMediaListManager.sendStreamEvent(param.getApp(),param.getStream(), param.getMediaServerId());
} }
ret.put("code", 0); ret.put("code", 0);
ret.put("msg", "success"); ret.put("msg", "success");
ret.put("enable_hls", false);
if (!"rtp".equals(param.getApp())) { if (!"rtp".equals(param.getApp())) {
ret.put("enable_audio", true); ret.put("enable_audio", true);

View File

@ -190,6 +190,8 @@ user-settings:
use-pushing-as-status: true use-pushing-as-status: true
# 按需拉流, true有人观看拉流无人观看释放 false拉起后不自动释放 # 按需拉流, true有人观看拉流无人观看释放 false拉起后不自动释放
stream-on-demand: true stream-on-demand: true
# 推流鉴权, 默认开启
push-authority: true
# 关闭在线文档(生产环境建议关闭) # 关闭在线文档(生产环境建议关闭)
springdoc: springdoc: