mirror of
https://github.com/MatrixSeven/file-transfer-go.git
synced 2026-02-04 03:25:03 +08:00
feat: 移除WebRTC房间状态API,优化路由设置
This commit is contained in:
37
_deploy.sh
Executable file
37
_deploy.sh
Executable 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 "✅ 部署完成"
|
||||||
@@ -106,13 +106,6 @@ export class ClientAPI {
|
|||||||
async getRoomInfo(code: string): Promise<ApiResponse> {
|
async getRoomInfo(code: string): Promise<ApiResponse> {
|
||||||
return this.get(`/api/room-info?code=${code}`);
|
return this.get(`/api/room-info?code=${code}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取WebRTC房间状态
|
|
||||||
*/
|
|
||||||
async getWebRTCRoomStatus(code: string): Promise<ApiResponse> {
|
|
||||||
return this.get(`/api/webrtc-room-status?code=${code}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出单例实例
|
// 导出单例实例
|
||||||
|
|||||||
@@ -51,10 +51,8 @@ func setupMiddleware(r *chi.Mux) {
|
|||||||
func setupAPIRoutes(r *chi.Mux, h *handlers.Handler) {
|
func setupAPIRoutes(r *chi.Mux, h *handlers.Handler) {
|
||||||
// WebRTC信令WebSocket路由
|
// WebRTC信令WebSocket路由
|
||||||
r.Get("/api/ws/webrtc", h.HandleWebRTCWebSocket)
|
r.Get("/api/ws/webrtc", h.HandleWebRTCWebSocket)
|
||||||
r.Get("/ws/webrtc", h.HandleWebRTCWebSocket)
|
|
||||||
|
|
||||||
// WebRTC房间API
|
// WebRTC房间API
|
||||||
r.Post("/api/create-room", h.CreateRoomHandler)
|
r.Post("/api/create-room", h.CreateRoomHandler)
|
||||||
r.Get("/api/room-info", h.WebRTCRoomStatusHandler)
|
r.Get("/api/room-info", h.WebRTCRoomStatusHandler)
|
||||||
r.Get("/api/webrtc-room-status", h.WebRTCRoomStatusHandler)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user