mirror of
https://github.com/Shik3i/KoalaSync.git
synced 2026-08-22 08:56:36 +00:00
feat: implement one-click auto-join and self-closing bridge with countdown
This commit is contained in:
@@ -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 }, () => {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user