mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-02 04:52:50 +08:00
fix: address Phase 6 review — error handling on player routes, SPA fallback scope, WS cleanup
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
0b54809113
commit
2a966e914c
3 files changed
+51
-58
No files matched your search
+3
-2
@@ -56,13 +56,13 @@ export function createWebServer(options: WebServerOptions): WebServer {
|
||||
|
||||
if (options.staticDir) {
|
||||
app.use(express.static(options.staticDir));
|
||||
app.get("*", (_req, res) => {
|
||||
app.get(/^(?!\/api|\/ws)/, (_req, res) => {
|
||||
res.sendFile(path.join(options.staticDir!, "index.html"));
|
||||
});
|
||||
}
|
||||
|
||||
const wss = new WebSocketServer({ server, path: "/ws" });
|
||||
setupWebSocket(wss, options.botManager, logger);
|
||||
const cleanupWs = setupWebSocket(wss, options.botManager, logger);
|
||||
|
||||
return {
|
||||
async start(): Promise<void> {
|
||||
@@ -74,6 +74,7 @@ export function createWebServer(options: WebServerOptions): WebServer {
|
||||
});
|
||||
},
|
||||
stop(): void {
|
||||
cleanupWs();
|
||||
wss.close();
|
||||
server.close();
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user