From 208cfa8e0ddc0ae54e54e4f3135a5aac5aa47e09 Mon Sep 17 00:00:00 2001 From: Alessandro Pignotti Date: Tue, 15 Oct 2024 17:22:32 +0200 Subject: [PATCH] Network: Do not consider page parameters if not running in the browser In preparation for SSR --- src/lib/network.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/network.js b/src/lib/network.js index f78de86..a5b5a70 100644 --- a/src/lib/network.js +++ b/src/lib/network.js @@ -1,8 +1,14 @@ import { writable } from 'svelte/store'; +import { browser } from '$app/environment' -let params = new URLSearchParams("?"+window.location.hash.substr(1)); -let authKey = params.get("authKey") || undefined; -let controlUrl = params.get("controlUrl") || undefined; +let authKey = undefined; +let controlUrl = undefined; +if(browser) +{ + let params = new URLSearchParams("?"+window.location.hash.substr(1)); + authKey = params.get("authKey"); + controlUrl = params.get("controlUrl"); +} let dashboardUrl = controlUrl ? null : "https://login.tailscale.com/admin/machines"; let resolveLogin = null; let loginPromise = new Promise((f,r) => {