From 5c49bd60ae4f80f830772182572213483e33c2f9 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Tue, 23 Jan 2024 17:14:27 -0800 Subject: [PATCH 1/2] fix: Don't connect when there is no token --- public/full.js | 9 +++++++-- public/minimal.js | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/public/full.js b/public/full.js index 3d97887..5c1fb71 100644 --- a/public/full.js +++ b/public/full.js @@ -350,7 +350,7 @@ function restoreUI() { } async function getClient() { - if (!client) { + if (!client && _token) { client = await SWire({ host: _host, token: _token, @@ -365,6 +365,8 @@ async function getClient() { * Connect with Relay creating a client and attaching all the event handler. */ window.connect = async () => { + if (!_token) return + const client = await getClient() window.__client = client @@ -373,6 +375,7 @@ window.connect = async () => { // Set a node_id for steering const steeringId = undefined + const call = await client.dial({ to: document.getElementById('destination').value, logLevel: 'debug', @@ -854,7 +857,9 @@ window.seekForwardPlayback = () => { window.ready(async function () { console.log('Ready!') const client = await getClient() - await client.connect() + if (client) { + await client.connect() + } const searchParams = new URLSearchParams(location.search) console.log('Handle inbound?', searchParams.has('inbound')) if (searchParams.has('inbound')) { diff --git a/public/minimal.js b/public/minimal.js index 9692968..20ac2cd 100644 --- a/public/minimal.js +++ b/public/minimal.js @@ -16,6 +16,8 @@ window.ready = (callback) => { } async function connect() { + if (!_token) return + client = await SignalWire.SignalWire({ host: _host, token: _token, From c12cf712f7dbb330459fb059c5943c593d226781 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Tue, 23 Jan 2024 17:15:03 -0800 Subject: [PATCH 2/2] fix: Don't connect when there is no token --- public/full.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/full.js b/public/full.js index 5c1fb71..aafee5b 100644 --- a/public/full.js +++ b/public/full.js @@ -375,7 +375,6 @@ window.connect = async () => { // Set a node_id for steering const steeringId = undefined - const call = await client.dial({ to: document.getElementById('destination').value, logLevel: 'debug',