Fix WEB_JOIN_REQUEST and joinBtn: custom server invite + password generation

- WEB_JOIN_REQUEST handler: forceDisconnect+connect instead of reusing old socket
  (same bug as CONNECT: JOIN_ROOM was sent to official server instead of custom)
- joinBtn handler: generate random password when roomId is empty and password empty
  (previously created rooms without passwords when using the advanced join button)
- Auto-copy invite link when creating room via joinBtn (consistent with Create Room button)
This commit is contained in:
Timo
2026-06-01 13:20:45 +02:00
parent 8cc622bda0
commit 7a6ec8087e
2 changed files with 16 additions and 16 deletions
+7 -15
View File
@@ -1300,23 +1300,15 @@ async function handleAsyncMessage(message, sender, sendResponse) {
useCustomServer: !!useCustomServer,
serverUrl: serverUrl || ''
}, async () => {
reconnectFailed = false;
reconnectStartTime = null;
reconnectAttempts = 0;
chrome.storage.session.set({ reconnectFailed: false, reconnectAttempts: 0, reconnectStartTime: null });
broadcastConnectionStatus('connecting');
leaveOldRoomIfSwitching(roomId);
if (socket && socket.readyState === WebSocket.OPEN && isNamespaceJoined) {
// FORCE TRANSITION: Emit Join Room directly if already connected
const settings = await getSettings();
emit(EVENTS.JOIN_ROOM, {
roomId,
password,
peerId,
username: settings.username,
tabTitle: currentTabTitle,
protocolVersion: PROTOCOL_VERSION
});
addLog(`Joining room via link: ${roomId}`, 'info');
} else {
connect();
}
forceDisconnect();
connect();
addLog(`Joining room via link: ${roomId}`, 'info');
sendResponse({ status: 'ok' });
});
} else if (message.type === 'REGENERATE_ID') {