From 5cd28ca606bf30d5ea200b6cac7b384c68d02be3 Mon Sep 17 00:00:00 2001 From: Jade Macho Date: Fri, 14 Jan 2022 00:14:09 +0100 Subject: [PATCH] First steps towards a fresh frontend --- .vscode/settings.json | 8 +- .../frontend/assets/avatar_fallback.png | Bin 0 -> 1625 bytes .../Content/frontend/cp/js/components/auth.js | 2 +- .../Content/frontend/cp/js/components/sync.js | 2 +- .../Content/frontend/cp/js/panels/accounts.js | 2 +- .../frontend/cp/js/panels/assemblies.js | 2 +- .../Content/frontend/cp/js/panels/channels.js | 2 +- .../Content/frontend/cp/js/panels/chat.js | 2 +- .../frontend/cp/js/panels/endpoints.js | 2 +- .../Content/frontend/cp/js/panels/exec.js | 2 +- .../Content/frontend/cp/js/panels/notes.js | 2 +- .../Content/frontend/cp/js/panels/players.js | 2 +- .../Content/frontend/cp/js/panels/status.js | 4 +- .../Content/frontend/index.html | 196 ++++++--- .../Content/frontend/main/background.png | Bin 21403 -> 36778 bytes .../Content/frontend/main/cogwheel.png | Bin 15234 -> 14278 bytes .../Content/frontend/main/index.js | 65 ++- .../Content/frontend/main/style.css | 387 ++++++++++-------- .../Content/frontend/overlay/style.css | 2 +- CelesteNet.Server.FrontendModule/Frontend.cs | 23 +- .../FrontendSettings.cs | 5 + .../RCEPs/RCEPControl.cs | 3 +- .../RCEPs/RCEPPublic.cs | 16 +- .../netdata/CelesteNet.node.js | 111 +++-- .../SqliteUserData.cs | 23 ++ CelesteNet.Server/FileSystemUserData.cs | 4 + CelesteNet.Server/UserData.cs | 1 + 27 files changed, 543 insertions(+), 325 deletions(-) create mode 100755 CelesteNet.Server.FrontendModule/Content/frontend/assets/avatar_fallback.png diff --git a/.vscode/settings.json b/.vscode/settings.json index cc6e5bbd..ed4a6019 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,11 @@ { "cmake.configureOnOpen": false, "git.followTagsWhenSync": false, - "git.pullTags": false + "git.pullTags": false, + "liveServer.settings.root": "/CelesteNet.Server.FrontendModule/Content/frontend/", + "liveServer.settings.proxy": { + "enable": true, + "baseUri": "/api", + "proxyUri": "http://127.0.0.1:3821/api" + } } \ No newline at end of file diff --git a/CelesteNet.Server.FrontendModule/Content/frontend/assets/avatar_fallback.png b/CelesteNet.Server.FrontendModule/Content/frontend/assets/avatar_fallback.png new file mode 100755 index 0000000000000000000000000000000000000000..c8512f0b608b46ec4a9d7b7f1c4b840d954a4503 GIT binary patch literal 1625 zcmV-f2B!ImP)+oRTRg6Gdl&^QWyw@0>v$a$3*A`kpvAQVuFB{ ztVG3NHpB>qfDiP8_&^dAX(BaIh=v%63XW+|Gz>PufDs796dI-crr!}}r9r7iTe zTR+US)OM#2x_5Wm{y*;A*?a!~Id|?k_neUs46oal1xy1xfCgj%8Gs5T+rw@H<-ld2 z3@8Qsz+uDG%S75I2_iiU$N^>p*-N0{thCp4JWvK~G)(=Im~)?9C;&DXrhc%qH@fbE{7b+l;C>PZZuL{{Y64N!0Yy<0c(IaNNnT*>kLz` zh?)m@-M&#kF7OJ8kLf_Vrh1A4LI2Gz3t*F92fRS{!4zPyrh1OHCxWX3ZlBxD$Twm# zkfy1g{ehsr)@hL3&Y!FSmePH()aKB653t|%>*@ZOuBo1XoOTCS8~gkwAdQ}Z`!v;a zBoOqU?dTF%1q`R>V7SexeGjn1+gIs%7_X_GU?Au(bPR;-#O7ceWBXX-4l|l3P)dsd z%VR-aPLjx;r!i@&#;}n?>6hG(`nq~nSynNQBs^V%fd5|buRWZ8#{MVPbbe*)NN zc%qK6=r^P<^APtS~cm~3-y@&KU+8xv=aW6)qV;qzJQenhP*nqyYC$(HyUx`Xj)BFAr06=y%64V<(IeVb*K_**>?=7Ae5c zj3JKKsw%DRuCk)aaZE~T3IpB!qit5U*X_%av5FQ#(SLxm@%8of05mi-IF3;ig|zhk zB21emV^wT~qEFvGUAkYACHf>Mi7?HhV3n(c;?OU@aXN4&;?UiB+i^@yO$}E{u8Wxdwu04}5jO#nl9Cvwjcs$xg>#ogO0H~{|=jw@nW3B&T#W3|UuiIB5@=Ty_Y9B_rM-mQ) zS_DE8S1w$Qm-Cevre4+<2<;Uqz@T9Rd1%&y5wBHNR&hYQ6Gp;bxN{^{K<`6AlK^%H zW^pefU)qL#Xf`dA8(Ynb}#=GkC#YzCeq%Ex5kx&~3z-cE;xn(CZ*f+wP1!!_;#fcc^x5UI%RH#^kry9Gv5jwk`&O{#s4- z6a#}1*gzo&TYZN>p@!ET~nP2#oEUINw|rv6!HZt8SF&fXo4V6~f#PoUiXb*HT^svgk78@l~x zb6qOQ27>-VP4)Z$RAV(-q{c9%-3Y8OOnpz6QuSzA)N4PTbr7TXeLUTU7+ECn=kxyo XC@SBQfJ_OP00000NkvXXu0mjfELRQ= literal 0 HcmV?d00001 diff --git a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/components/auth.js b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/components/auth.js index c5f5496c..c3c309bb 100644 --- a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/components/auth.js +++ b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/components/auth.js @@ -27,7 +27,7 @@ export class FrontendAuth { let data; try { - data = await fetch("/auth", { + data = await fetch("/api/auth", { method: "post", body: JSON.stringify(pass) }).then(r => r.json()); diff --git a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/components/sync.js b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/components/sync.js index 60baca0e..6029bbab 100644 --- a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/components/sync.js +++ b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/components/sync.js @@ -107,7 +107,7 @@ export class FrontendSync { if (!this.ws || this.ws.readyState === WebSocket.CLOSED) { this.frontend.snackbar({ text: "Connecting..." }); this.status = "connecting"; - let ws = this.ws = new WebSocket(`${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.host}/ws`); + let ws = this.ws = new WebSocket(localStorage["frontend-ws"] || `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.host}/api/ws`); if (!this.resyncPromiseResolve) this.resyncPromise = new Promise(resolve => this.resyncPromiseResolve = resolve); ws.onopen = this.onopen; diff --git a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/accounts.js b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/accounts.js index 1efc21aa..6beb2ee4 100644 --- a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/accounts.js +++ b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/accounts.js @@ -36,7 +36,7 @@ export class FrontendPlayersPanel extends FrontendBasicPanel { constructor(frontend) { super(frontend); this.header = "Accounts"; - this.ep = "/userinfos?from=0&count=100000"; + this.ep = "/api/userinfos?from=0&count=100000"; /** @type {UserInfo[]} */ this.data = []; diff --git a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/assemblies.js b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/assemblies.js index 56389e8e..a682110f 100644 --- a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/assemblies.js +++ b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/assemblies.js @@ -24,7 +24,7 @@ export class FrontendAssembliesPanel extends FrontendBasicPanel { constructor(frontend) { super(frontend); this.header = "Assemblies"; - this.ep = "/asms"; + this.ep = "/api/asms"; /** @type {AssemblyInfo[]} */ this.data = []; } diff --git a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/channels.js b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/channels.js index 94c8c527..c2a3e8b4 100644 --- a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/channels.js +++ b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/channels.js @@ -26,7 +26,7 @@ export class FrontendChannelsPanel extends FrontendBasicPanel { constructor(frontend) { super(frontend); this.header = "Channels"; - this.ep = "/channels"; + this.ep = "/api/channels"; /** @type {ChannelData[]} */ this.data = []; } diff --git a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/chat.js b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/chat.js index 28d78a4e..c8b2ffd1 100644 --- a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/chat.js +++ b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/chat.js @@ -27,7 +27,7 @@ export class FrontendChatPanel extends FrontendBasicPanel { constructor(frontend) { super(frontend); this.header = "Chat"; - this.ep = "/chatlog"; + this.ep = "/api/chatlog"; /** @type {[string, string, () => void][]} */ this.actions = [ diff --git a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/endpoints.js b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/endpoints.js index 3b81881c..87578e08 100644 --- a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/endpoints.js +++ b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/endpoints.js @@ -16,7 +16,7 @@ export class FrontendEndpointsPanel extends FrontendBasicPanel { constructor(frontend) { super(frontend); this.header = "Endpoints"; - this.ep = "/eps"; + this.ep = "/api/eps"; } async update() { diff --git a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/exec.js b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/exec.js index 8f5c3d24..850838d7 100644 --- a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/exec.js +++ b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/exec.js @@ -17,7 +17,7 @@ export class FrontendExecPanel extends FrontendBasicPanel { constructor(frontend) { super(frontend); this.header = "Run C#"; - this.ep = "/exec"; + this.ep = "/api/exec"; this.data = ""; diff --git a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/notes.js b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/notes.js index 1f327072..146dc5a6 100644 --- a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/notes.js +++ b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/notes.js @@ -16,7 +16,7 @@ export class FrontendNotesPanel extends FrontendBasicPanel { constructor(frontend) { super(frontend); this.header = "Notes"; - this.ep = "/notes"; + this.ep = "/api/notes"; this.data = ""; diff --git a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/players.js b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/players.js index 8a840fac..5e76cab0 100644 --- a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/players.js +++ b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/players.js @@ -32,7 +32,7 @@ export class FrontendPlayersPanel extends FrontendBasicPanel { constructor(frontend) { super(frontend); this.header = "Players"; - this.ep = "/players"; + this.ep = "/api/players"; /** @type {PlayerData[]} */ this.data = []; } diff --git a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/status.js b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/status.js index d7171d6d..b5a8eda5 100644 --- a/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/status.js +++ b/CelesteNet.Server.FrontendModule/Content/frontend/cp/js/panels/status.js @@ -16,8 +16,8 @@ export class FrontendStatusPanel extends FrontendBasicPanel { constructor(frontend) { super(frontend); this.header = "Status"; - this.ep = "/status"; - this.netPlusEp = "/netplus"; + this.ep = "/api/status"; + this.netPlusEp = "/api/netplus"; this.data = { Alive: false, diff --git a/CelesteNet.Server.FrontendModule/Content/frontend/index.html b/CelesteNet.Server.FrontendModule/Content/frontend/index.html index 50946dc7..140effa8 100644 --- a/CelesteNet.Server.FrontendModule/Content/frontend/index.html +++ b/CelesteNet.Server.FrontendModule/Content/frontend/index.html @@ -4,6 +4,7 @@ THIS IS THE DEFAULT WEBSITE. If you're hosting your own CelesteNet server, replace it! Or host it separately, as the built-in HTTP server isn't the best. + Most importantly though, CTRL+F 0x0a.de and replace it all, and maybe adjust / remove the netdata graphs. --> @@ -22,9 +23,9 @@ - - - + + + @@ -32,20 +33,18 @@ -
+
+
+
-
+
- -
- -
- - -
-
+
+
- +
+ +
An online multiplayer mod for Celeste.