Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Don't connect when there is no token #30

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions public/full.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ function restoreUI() {
}

async function getClient() {
if (!client) {
if (!client && _token) {
client = await SWire({
host: _host,
token: _token,
Expand All @@ -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

Expand Down Expand Up @@ -854,7 +856,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')) {
Expand Down
2 changes: 2 additions & 0 deletions public/minimal.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ window.ready = (callback) => {
}

async function connect() {
if (!_token) return

client = await SignalWire.SignalWire({
host: _host,
token: _token,
Expand Down