From dc53c8b2db92a7a6a0a5c236d2f2b5ab478085f8 Mon Sep 17 00:00:00 2001 From: core Date: Sat, 25 Nov 2023 01:34:00 -0500 Subject: [PATCH] prerelease server warning --- starkingdoms-client/index.html | 61 +++++++++++++++++------------ starkingdoms-client/public/form.css | 17 +++++++- starkingdoms-client/src/config.json | 10 ++--- starkingdoms-client/src/main.ts | 10 ++++- 4 files changed, 64 insertions(+), 34 deletions(-) diff --git a/starkingdoms-client/index.html b/starkingdoms-client/index.html index 77741dbf68a70182bc274b804a85bf7328fcaea1..81736b176ed6ce39429b40eabc252ab03ecc33f9 100644 --- a/starkingdoms-client/index.html +++ b/starkingdoms-client/index.html @@ -1,43 +1,52 @@ - - - - - + + + + + StarKingdoms - - - -
- -
+
+ +
- + - - + + diff --git a/starkingdoms-client/public/form.css b/starkingdoms-client/public/form.css index 052b7ec91474a274d81e54ed3ca6af468fe071a4..96940cfd32577f62290a93c5d936b44e5943e1bd 100644 --- a/starkingdoms-client/public/form.css +++ b/starkingdoms-client/public/form.css @@ -135,4 +135,19 @@ opacity: 1; visibility: visible; /*transform: scaleY(1);*/ -} \ No newline at end of file +} +.server-danger { + display: block; + margin-top: 1vh; + color: var(--error); + font-size: 0.875rem; + line-height: 1.25rem; +} +.server-danger.hidden { + display: none; +} +.server-danger-icon { + height: 1.25rem; + vertical-align: middle; + display: inline-block; +} diff --git a/starkingdoms-client/src/config.json b/starkingdoms-client/src/config.json index d8cf10c2e39b152aaf6deac260875505b45f5fd2..dcedbebcac05e8f7c2cfc7b1e9dd4681fd6f1ed7 100644 --- a/starkingdoms-client/src/config.json +++ b/starkingdoms-client/src/config.json @@ -1,8 +1,8 @@ { "servers": { - "stk-prod": {"name": "StarKingdoms", "url": "wss://starkingdoms.io/", "api": "https://api.starkingdoms.io"}, - "stk-beta": {"name": "StarKingdoms Beta", "url": "wss://beta.starkingdoms.io/", "api": "https://api.beta.starkingdoms.io"}, - "stk-unstable": {"name": "StarKingdoms Unstable", "url": "wss://unstable.starkingdoms.io/", "api": "https://api.unstable.starkingdoms.io"}, - "dev": {"name": "Local", "url": "ws://localhost:3000/", "api": "http://localhost:8080"} + "stk-prod": {"name": "StarKingdoms", "url": "wss://starkingdoms.io/", "api": "https://api.starkingdoms.io", "prod": true}, + "stk-beta": {"name": "StarKingdoms Beta", "url": "wss://beta.starkingdoms.io/", "api": "https://api.beta.starkingdoms.io", "prod": false}, + "stk-unstable": {"name": "StarKingdoms Unstable", "url": "wss://unstable.starkingdoms.io/", "api": "https://api.unstable.starkingdoms.io", "prod": false}, + "dev": {"name": "Local", "url": "ws://localhost:3000/", "api": "http://localhost:8080", "prod": false} } -} \ No newline at end of file +} diff --git a/starkingdoms-client/src/main.ts b/starkingdoms-client/src/main.ts index 3d15cbb30176c595e753ad72f51c8efe11a19457..1cb42cc746624c7fc00f11882e7cdb96180f9850 100644 --- a/starkingdoms-client/src/main.ts +++ b/starkingdoms-client/src/main.ts @@ -69,6 +69,12 @@ options_list.forEach((option) => { selected_value.textContent = this.textContent; custom_select.classList.remove("active"); } + // @ts-ignore + if (!CONFIG.servers[inverse_server_lookup[selected_value.textContent]].prod) { + document.getElementById("server-danger")!.classList.remove("hidden"); + } else { + document.getElementById("server-danger")!.classList.add("hidden"); + } } option.addEventListener("keyup", handler); option.addEventListener("click", handler); @@ -95,11 +101,11 @@ document.getElementById("join-fm")!.addEventListener("submit", async (e) => { logger(`connecting to ${server.url} as ${username} with auth = none`); - global.client = await gateway_connect(server.url); + global.client = await gateway_connect(server.url, username); } catch (e) { setStatus("Connection failed!"); console.error(e); (custom_select_btn).disabled = false; (document.getElementById("username")!).disabled = false; } -}) \ No newline at end of file +})