From 25bd00c21b4e389ebdbd487f0ecec8e9f2cf9fa3 Mon Sep 17 00:00:00 2001 From: curly Date: Thu, 18 Jul 2024 11:54:08 -0600 Subject: use html base and relative paths --- src/admin/index.html | 10 ++++++---- src/admin/regkeys/index.html | 10 ++++++---- src/favicon.ico | Bin 9662 -> 0 bytes src/index.html | 6 ++++-- src/login/index.html | 12 +++++++----- src/main.js | 26 +++++++++++++------------- src/register/index.html | 12 +++++++----- src/user/index.html | 14 ++++++++------ src/user/transfer/index.html | 14 ++++++++------ src/user/update/index.html | 14 ++++++++------ 10 files changed, 67 insertions(+), 51 deletions(-) delete mode 100644 src/favicon.ico diff --git a/src/admin/index.html b/src/admin/index.html index 16e459f..857838b 100644 --- a/src/admin/index.html +++ b/src/admin/index.html @@ -1,16 +1,18 @@ + - - + + + USER
- + - +
diff --git a/src/admin/regkeys/index.html b/src/admin/regkeys/index.html index 3b4d24b..9a7ca73 100644 --- a/src/admin/regkeys/index.html +++ b/src/admin/regkeys/index.html @@ -1,16 +1,18 @@ + - - + + + REGISTRATION KEYS
- + - +
diff --git a/src/favicon.ico b/src/favicon.ico deleted file mode 100644 index 9efc4f9..0000000 Binary files a/src/favicon.ico and /dev/null differ diff --git a/src/index.html b/src/index.html index 9a38dca..cadf558 100644 --- a/src/index.html +++ b/src/index.html @@ -1,8 +1,10 @@ + - - + + + POKO diff --git a/src/login/index.html b/src/login/index.html index 461b040..6654d61 100644 --- a/src/login/index.html +++ b/src/login/index.html @@ -1,19 +1,21 @@ + - - + + + LOGIN
- + - + - +
diff --git a/src/main.js b/src/main.js index 5dc8244..91e2efb 100644 --- a/src/main.js +++ b/src/main.js @@ -1,6 +1,6 @@ const server = window.location.protocol + "//" + window.location.hostname + ":9050"; -const host = window.location.protocol + "//" + window.location.host; -const client_id = "POKO Web 0.0" +const host = document.getElementsByTagName("base")[0].href; +const client_id = "POKO Web 0.1.0"; async function xhttp_get(url) { try { @@ -71,7 +71,7 @@ async function register() { if (req.status == 201) { await login(req.body.id, password) - window.location.href = host + "/user/" + window.location.href = host + "user/" } else { alert(req.status + ": " + req.body) } @@ -96,7 +96,7 @@ async function login(id, password) { if (req.status == 200) { // Set session cookie set_session(req.body, id) - window.location.href = host + "/user/"; + window.location.href = host + "user/"; } else { alert(req.status + ": " + req.body) } @@ -255,7 +255,7 @@ async function transfer(to_id, color, amount) { if (req.status != 200) { alert(req.status + ":" + req.body) } else if (req.status == 200) { - window.location.href = host + "/user/" + window.location.href = host + "user/" } } } @@ -296,7 +296,7 @@ async function update_password_form() { const req = await xhttp_post(url, body); if (req.status == 200) { - window.location.href = host + "/user/" + window.location.href = host + "user/" } else { alert(req.status + ": " + req.body) } @@ -311,7 +311,7 @@ async function update_name_form() { const req = await xhttp_post(url, body); if (req.status == 200) { - window.location.href = host + "/user/" + window.location.href = host + "user/" } else { alert(req.status + ": " + req.body) } @@ -352,13 +352,13 @@ window.onload = async function() { // and if logged in if (await is_logged_in()) { // move to the user index page - window.location.href = host + "/user/" + window.location.href = host + "user/" } - } else if (window.location.pathname == "/user/") { + } else if (window.location.href == host + "user/") { await user() - } else if (window.location.pathname == "/admin/regkeys/") { + } else if (window.location.href == host + "admin/regkeys/") { await regkeys() - } else if (window.location.pathname == "/user/update/") { + } else if (window.location.href == host + "user/update/") { await update_form_onload() } @@ -366,12 +366,12 @@ window.onload = async function() { const elements = document.getElementsByTagName("header"); for (x in elements) { elements[x].innerHTML += ` - + ` } - } + } } async function regkeys() { diff --git a/src/register/index.html b/src/register/index.html index 8fe1774..0323787 100644 --- a/src/register/index.html +++ b/src/register/index.html @@ -1,19 +1,21 @@ + - - + + + REGISTER
- + - + - +
diff --git a/src/user/index.html b/src/user/index.html index 476f697..0cb0035 100644 --- a/src/user/index.html +++ b/src/user/index.html @@ -1,22 +1,24 @@ + - - + + + USER
- + - + - + - +
diff --git a/src/user/transfer/index.html b/src/user/transfer/index.html index 618b0a0..ec00af2 100644 --- a/src/user/transfer/index.html +++ b/src/user/transfer/index.html @@ -1,22 +1,24 @@ + - - + + + TRANSFER
- + - + - + - +
diff --git a/src/user/update/index.html b/src/user/update/index.html index f7a5e02..f2402ee 100644 --- a/src/user/update/index.html +++ b/src/user/update/index.html @@ -1,22 +1,24 @@ + - - + + + UPDATE INFO
- + - + - + - +
-- cgit v1.2.3