|
@@ -1,6 +1,7 @@
|
|
package com.backendsys.modules.log.controller;
|
|
package com.backendsys.modules.log.controller;
|
|
|
|
|
|
import cn.hutool.core.convert.Convert;
|
|
import cn.hutool.core.convert.Convert;
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
import com.backendsys.exception.CustomException;
|
|
import com.backendsys.exception.CustomException;
|
|
import com.backendsys.modules.common.config.security.annotations.Anonymous;
|
|
import com.backendsys.modules.common.config.security.annotations.Anonymous;
|
|
import com.backendsys.modules.sse.emitter.SseEmitterManager;
|
|
import com.backendsys.modules.sse.emitter.SseEmitterManager;
|
|
@@ -39,16 +40,19 @@ public class LogStreamController {
|
|
private String charset;
|
|
private String charset;
|
|
@Value("${log-stream.exec}")
|
|
@Value("${log-stream.exec}")
|
|
private String exec;
|
|
private String exec;
|
|
-
|
|
|
|
|
|
+ @Value("${log-stream.sign}")
|
|
|
|
+ private String signValue;
|
|
|
|
|
|
/**
|
|
/**
|
|
* [SSE] 消息监听
|
|
* [SSE] 消息监听
|
|
*/
|
|
*/
|
|
@Anonymous
|
|
@Anonymous
|
|
@GetMapping(value = "/api/log/stream/watch", produces = "text/event-stream")
|
|
@GetMapping(value = "/api/log/stream/watch", produces = "text/event-stream")
|
|
- public SseEmitter stream() {
|
|
|
|
|
|
+ public SseEmitter stream(String sign) {
|
|
|
|
|
|
if (!isEnable) return null;
|
|
if (!isEnable) return null;
|
|
|
|
+ if (StrUtil.isEmpty(sign)) return null;
|
|
|
|
+ if (!signValue.equals(sign)) return null;
|
|
|
|
|
|
String userId = Convert.toStr(1L);
|
|
String userId = Convert.toStr(1L);
|
|
SseEmitterUTF8 emitter = new SseEmitterUTF8(Long.MAX_VALUE);
|
|
SseEmitterUTF8 emitter = new SseEmitterUTF8(Long.MAX_VALUE);
|