feat: 更新handleRequest逻辑,确保newId参数与用户关联以避免冲突
This commit is contained in:
@@ -139,13 +139,14 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse, opts?: {
|
|||||||
res.end(JSON.stringify({ code: 400, message: 'newId 参数缺失' }));
|
res.end(JSON.stringify({ code: 400, message: 'newId 参数缺失' }));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const wsMessage = wsProxyManager.get(newId!)!;
|
const realNewId = user + '--' + newId;
|
||||||
|
const wsMessage = wsProxyManager.get(realNewId!)!;
|
||||||
if (wsMessage) {
|
if (wsMessage) {
|
||||||
res.writeHead(400, { 'Content-Type': 'application/json' });
|
res.writeHead(400, { 'Content-Type': 'application/json' });
|
||||||
res.end(JSON.stringify({ code: 400, message: 'newId 已存在' }));
|
res.end(JSON.stringify({ code: 400, message: 'newId 已存在' }));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wsProxyManager.changeId(appId, newId);
|
wsProxyManager.changeId(appId, realNewId);
|
||||||
res.writeHead(200, { 'Content-Type': 'application/json' });
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
||||||
res.end(JSON.stringify({ code: 200, message: '应用重命名成功' }));
|
res.end(JSON.stringify({ code: 200, message: '应用重命名成功' }));
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user