From 73ab09983c5f35dc61e48e730fda207d5c226951 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Sun, 18 Dec 2022 21:58:46 -0800 Subject: [PATCH] fix goToPage --- scripts/elements.js | 2 +- scripts/index.js | 2 +- scripts/login.js | 2 +- scripts/utils.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/elements.js b/scripts/elements.js index 3ffb592..b9caace 100644 --- a/scripts/elements.js +++ b/scripts/elements.js @@ -125,7 +125,7 @@ class Instance extends HTMLElement { configButton.src = data.status === "running" ? "images/actions/config-inactive.svg" : "images/actions/config-active.svg"; configButton.addEventListener("click", () => { if (!this.actionLock && this.status !== "running") { - goToPage("https://client.tronnet.net/config.html", {type: this.type, vmid: this.vmid}); + goToPage("config.html", {type: this.type, vmid: this.vmid}); } }) } diff --git a/scripts/index.js b/scripts/index.js index bdcd43d..ed95828 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -9,7 +9,7 @@ async function init () { async function populateInstances () { let cookie = document.cookie; if (cookie === "") { - goToPage("https://client.tronnet.net/login.html"); + goToPage("login.html"); } let nodes = await request("/nodes", "GET", null); diff --git a/scripts/login.js b/scripts/login.js index 40e1f22..18701a8 100644 --- a/scripts/login.js +++ b/scripts/login.js @@ -14,7 +14,7 @@ function init (){ status.innerText = "Authenticating..."; let ticket = await requestTicket(formData.get("username"), formData.get("password")); setTicket(ticket.data.ticket, ticket.data.CSRFPreventionToken); - goToPage("https://client.tronnet.net/index.html"); + goToPage("index.html"); } catch (error) { if(error instanceof ResponseError) { // response error is usually 401 auth failed diff --git a/scripts/utils.js b/scripts/utils.js index 5ae8034..dd16159 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -79,7 +79,7 @@ export async function request (path, method, body = null, auth = true) { } export function goToPage (page, data={}) { - let url = new URL(url); + let url = new URL(`https://client.tronnet.net/${page}`); for(let k in data) { url.searchParams.append(k, data[k]); }