feat: 移除WebRTC房间状态API,优化路由设置

This commit is contained in:
MatrixSeven
2025-09-11 15:55:10 +08:00
parent 4b31e76488
commit 50d30f23bf
3 changed files with 37 additions and 9 deletions

37
_deploy.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/bash
set -e
echo "🚀 构建并部署前端..."
# 构建前端
cd chuan-next
npm run build:ssg
cd ..
# 压缩
tar -czf /tmp/frontend.tar.gz -C chuan-next/out .
# 创建服务器目录并上传
ssh root@101.33.214.22 "mkdir -p /root/file-transfer/chuan-next"
scp /tmp/frontend.tar.gz root@101.33.214.22:/root/file-transfer/chuan-next/
ssh root@101.33.214.22 << 'EOF'
cd /root/file-transfer/chuan-next
# 备份 api 目录
[ -d current/api ] && cp -r current/api /tmp/api-backup
# 解压新版本
rm -rf current
mkdir current
cd current
tar -xzf ../frontend.tar.gz
# 还原 api 目录
[ -d /tmp/api-backup ] && cp -r /tmp/api-backup ./api && rm -rf /tmp/api-backup
# 清理压缩包
rm -f ../frontend.tar.gz
EOF
# 清理本地文件
rm -f /tmp/frontend.tar.gz
rm -rf chuan-next/out
echo "✅ 部署完成"

View File

@@ -106,13 +106,6 @@ export class ClientAPI {
async getRoomInfo(code: string): Promise<ApiResponse> {
return this.get(`/api/room-info?code=${code}`);
}
/**
* 获取WebRTC房间状态
*/
async getWebRTCRoomStatus(code: string): Promise<ApiResponse> {
return this.get(`/api/webrtc-room-status?code=${code}`);
}
}
// 导出单例实例

View File

@@ -51,10 +51,8 @@ func setupMiddleware(r *chi.Mux) {
func setupAPIRoutes(r *chi.Mux, h *handlers.Handler) {
// WebRTC信令WebSocket路由
r.Get("/api/ws/webrtc", h.HandleWebRTCWebSocket)
r.Get("/ws/webrtc", h.HandleWebRTCWebSocket)
// WebRTC房间API
r.Post("/api/create-room", h.CreateRoomHandler)
r.Get("/api/room-info", h.WebRTCRoomStatusHandler)
r.Get("/api/webrtc-room-status", h.WebRTCRoomStatusHandler)
}