summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcurly <curly@infernal.garden>2024-07-18 11:54:08 -0600
committercurly <curly@infernal.garden>2024-07-18 11:54:08 -0600
commit25bd00c21b4e389ebdbd487f0ecec8e9f2cf9fa3 (patch)
treefdeaaed284e639a5eb18f6041ed226aa9e9b337f /src
parentbb7cff0016a1bb95bd987b69b586c505418c1aeb (diff)
downloadpoko_web-25bd00c21b4e389ebdbd487f0ecec8e9f2cf9fa3.tar.gz
poko_web-25bd00c21b4e389ebdbd487f0ecec8e9f2cf9fa3.tar.bz2
poko_web-25bd00c21b4e389ebdbd487f0ecec8e9f2cf9fa3.zip
use html base and relative paths
Diffstat (limited to 'src')
-rw-r--r--src/admin/index.html10
-rw-r--r--src/admin/regkeys/index.html10
-rw-r--r--src/favicon.icobin9662 -> 0 bytes
-rw-r--r--src/index.html6
-rw-r--r--src/login/index.html12
-rw-r--r--src/main.js26
-rw-r--r--src/register/index.html12
-rw-r--r--src/user/index.html14
-rw-r--r--src/user/transfer/index.html14
-rw-r--r--src/user/update/index.html14
10 files changed, 67 insertions, 51 deletions
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 @@
<!DOCTYPE html>
<head>
+ <base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="/main.css">
- <script src="/main.js" defer></script>
+ <link rel="stylesheet" href="main.css">
+ <script src="main.js" defer></script>
+ <link rel="icon" href="favicon.svg" type="image/svg">
<title>USER</title>
</head>
<body>
<header>
- <a href="/user/">
+ <a href="user/">
<center class="button navbutton">USER</center>
</a>
- <a href="/admin/regkeys/">
+ <a href="admin/regkeys/">
<center class="button navbutton">REGISTRATION KEYS</center>
</a>
</header>
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 @@
<!DOCTYPE html>
<head>
+ <base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="/main.css">
- <script src="/main.js" defer></script>
+ <link rel="stylesheet" href="main.css">
+ <script src="main.js" defer></script>
+ <link rel="icon" href="favicon.svg" type="image/svg">
<title>REGISTRATION KEYS</title>
</head>
<body onload="update_form_onload()">
<header>
- <a href="/user/">
+ <a href="user/">
<center class="button navbutton">USER</center>
</a>
- <a href="/admin/regkeys/">
+ <a href="admin/regkeys/">
<center class="button navbutton">REGISTRATION KEYS</center>
</a>
</header>
diff --git a/src/favicon.ico b/src/favicon.ico
deleted file mode 100644
index 9efc4f9..0000000
--- a/src/favicon.ico
+++ /dev/null
Binary files 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 @@
<!DOCTYPE html>
<head>
+ <base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="/main.css">
- <script src="/main.js" defer></script>
+ <link rel="stylesheet" href="main.css">
+ <script src="main.js" defer></script>
+ <link rel="icon" href="favicon.svg" type="image/svg">
<title>POKO</title>
</head>
<body>
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 @@
<!DOCTYPE html>
<head>
+ <base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="/main.css">
- <script src="/main.js" defer></script>
+ <link rel="stylesheet" href="main.css">
+ <script src="main.js" defer></script>
+ <link rel="icon" href="favicon.svg" type="image/svg">
<title>LOGIN</title>
</head>
<body>
<header>
- <a href="/">
+ <a href="">
<center class="button navbutton">HOME</center>
</a>
- <a href="/login/">
+ <a href="login/">
<center class="button navbutton">LOGIN</center>
</a>
- <a href="/register/">
+ <a href="register/">
<center class="button navbutton">REGISTER</center>
</a>
</header>
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 += `
- <a href="/admin/">
+ <a href="admin/">
<center class="button navbutton">ADMIN</center>
</a>
`
}
- }
+ }
}
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 @@
<!DOCTYPE html>
<head>
+ <base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="/main.css">
- <script src="/main.js" defer></script>
+ <link rel="stylesheet" href="main.css">
+ <script src="main.js" defer></script>
+ <link rel="icon" href="favicon.svg" type="image/svg">
<title>REGISTER</title>
</head>
<body>
<header>
- <a href="/">
+ <a href="">
<center class="button navbutton">HOME</center>
</a>
- <a href="/login/">
+ <a href="login/">
<center class="button navbutton">LOGIN</center>
</a>
- <a href="/register/">
+ <a href="register/">
<center class="button navbutton">REGISTER</center>
</a>
</header>
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 @@
<!DOCTYPE html>
<head>
+ <base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="/main.css">
- <script src="/main.js" defer></script>
+ <link rel="stylesheet" href="main.css">
+ <script src="main.js" defer></script>
+ <link rel="icon" href="favicon.svg" type="image/svg">
<title>USER</title>
</head>
<body>
<header>
- <a href="/user/">
+ <a href="user/">
<center class="button navbutton">USER</center>
</a>
- <a href="/user/transfer/">
+ <a href="user/transfer/">
<center class="button navbutton">TRANSFER</center>
</a>
- <a href="/user/update/">
+ <a href="user/update/">
<center class="button navbutton">UPDATE INFO</center>
</a>
- <a href="#" onclick="logout()">
+ <a href="user/#" onclick="logout()">
<center class="button navbutton">LOGOUT</center>
</a>
</header>
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 @@
<!DOCTYPE html>
<head>
+ <base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="/main.css">
- <script src="/main.js" defer></script>
+ <link rel="stylesheet" href="main.css">
+ <script src="main.js" defer></script>
+ <link rel="icon" href="favicon.svg" type="image/svg">
<title>TRANSFER</title>
</head>
<body>
<header>
- <a href="/user/">
+ <a href="user/">
<center class="button navbutton">USER</center>
</a>
- <a href="/user/transfer/">
+ <a href="user/transfer/">
<center class="button navbutton">TRANSFER</center>
</a>
- <a href="/user/update/">
+ <a href="user/update/">
<center class="button navbutton">UPDATE INFO</center>
</a>
- <a href="#" onclick="logout()">
+ <a href="user/#" onclick="logout()">
<center class="button navbutton">LOGOUT</center>
</a>
</header>
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 @@
<!DOCTYPE html>
<head>
+ <base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="/main.css">
- <script src="/main.js" defer></script>
+ <link rel="stylesheet" href="main.css">
+ <script src="main.js" defer></script>
+ <link rel="icon" href="favicon.svg" type="image/svg">
<title>UPDATE INFO</title>
</head>
<body>
<header>
- <a href="/user/">
+ <a href="user/">
<center class="button navbutton">USER</center>
</a>
- <a href="/user/transfer/">
+ <a href="user/transfer/">
<center class="button navbutton">TRANSFER</center>
</a>
- <a href="/user/update/">
+ <a href="user/update/">
<center class="button navbutton">UPDATE INFO</center>
</a>
- <a href="#" onclick="logout()">
+ <a href="user/#" onclick="logout()">
<center class="button navbutton">LOGOUT</center>
</a>
</header>