feat: implement one-click auto-join and self-closing bridge with countdown

This commit is contained in:
Timo
2026-04-22 12:29:09 +02:00
parent 901b97dcaf
commit 0509b993e5
3 changed files with 31 additions and 4 deletions
+3
View File
@@ -596,6 +596,7 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
useCustomServer: !!useCustomServer,
serverUrl: serverUrl || ''
}, () => {
broadcastConnectionStatus('connecting');
if (socket && socket.readyState === WebSocket.OPEN && isNamespaceJoined) {
// FORCE TRANSITION: Emit Join Room directly if already connected
getSettings().then(settings => {
@@ -612,7 +613,9 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
} else {
connect();
}
sendResponse({ status: 'ok' });
});
return true; // Keep channel open for async getSettings
} else if (message.type === 'REGENERATE_ID') {
const newId = self.crypto.randomUUID().substring(0, 8);
chrome.storage.local.set({ peerId: newId }, () => {
+9
View File
@@ -286,6 +286,15 @@ function applyConnectionStatus(status) {
elements.connText.textContent = connected ? 'Connected' : (connecting ? 'Connecting...' : (failed ? 'Failed' : 'Disconnected'));
elements.retryBtn.style.display = failed ? 'block' : 'none';
// Update Join Button during auto-transition
if (connecting) {
elements.joinBtn.disabled = true;
elements.joinBtn.textContent = 'Connecting...';
} else if (!connected) {
elements.joinBtn.disabled = false;
elements.joinBtn.textContent = 'Join Room';
}
}
function updateHistory(history) {