把 XH巡课 的当前可运行版本放进仓库,方便后续继续改并同步。

This commit is contained in:
itxiaohui committed 2026-11-21 12:31:01 +08:00
commit 6e5107f1b6
134 files changed
+11284

No files matched your search

@@ -0,0 +1,26 @@
package com.xh.xunke.config;
import com.xh.xunke.live.LiveStatusSocket;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
@Configuration
@EnableWebSocket
public class LiveSocketConfig implements WebSocketConfigurer {
private final LiveStatusSocket socket;
private final AppProperties props;
public LiveSocketConfig(LiveStatusSocket socket, AppProperties props) {
this.socket = socket;
this.props = props;
}
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
String[] origins = java.util.Arrays.stream(props.getCorsOrigins().split(","))
.map(String::trim).filter(item -> !item.isEmpty()).toArray(String[]::new);
registry.addHandler(socket, "/ws/events").setAllowedOrigins(origins);
}
}