feat: 更新handleRequest逻辑,确保newId参数与用户关联以避免冲突

This commit is contained in:
2026-03-07 19:48:26 +08:00
parent 69422f3e3f
commit 2b5d3250a4

View File

@@ -139,13 +139,14 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse, opts?: {
res.end(JSON.stringify({ code: 400, message: 'newId 参数缺失' }));
return;
}
const wsMessage = wsProxyManager.get(newId!)!;
const realNewId = user + '--' + newId;
const wsMessage = wsProxyManager.get(realNewId!)!;
if (wsMessage) {
res.writeHead(400, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ code: 400, message: 'newId 已存在' }));
return;
}
wsProxyManager.changeId(appId, newId);
wsProxyManager.changeId(appId, realNewId);
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ code: 200, message: '应用重命名成功' }));
return;