From ed133380fbc74ef3b6930d1ea125205ffe2e36fc Mon Sep 17 00:00:00 2001 From: The Arcane Brony Date: Wed, 20 Oct 2021 17:54:54 +0200 Subject: Add plugin & css support, add styling to differentiate from discord.com --- api/client_test/index.html | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'api/client_test') diff --git a/api/client_test/index.html b/api/client_test/index.html index 92499034..2ff0b469 100644 --- a/api/client_test/index.html +++ b/api/client_test/index.html @@ -4,6 +4,10 @@ Discord Test Client + + + + @@ -38,12 +42,33 @@ ALGOLIA_KEY: "aca0d7082e4e63af5ba5917d5e96bed0" }; GLOBAL_ENV.MEDIA_PROXY_ENDPOINT = location.protocol + "//" + GLOBAL_ENV.CDN_HOST; + const localStorage = window.localStorage; + // TODO: remote auth + // window.GLOBAL_ENV.REMOTE_AUTH_ENDPOINT = window.GLOBAL_ENV.GATEWAY_ENDPOINT.replace(/wss?:/, ""); + localStorage.setItem("gatewayURL", window.GLOBAL_ENV.GATEWAY_ENDPOINT); + localStorage.setItem( + "DeveloperOptionsStore", + `{"trace":false,"canary":false,"logGatewayEvents":true,"logOverlayEvents":true,"logAnalyticsEvents":true,"sourceMapsEnabled":false,"axeEnabled":false}` + ); + + + const token = JSON.parse(localStorage.getItem("token")); + if(token) { + document.querySelector("#logincss").remove(); + } + + const settings = JSON.parse(localStorage.getItem("UserSettingsStore")); + if (settings && settings.locale.length <= 2) { + // fix client locale wrong and client not loading at all + settings.locale = "en-US"; + localStorage.setItem("UserSettingsStore", JSON.stringify(settings)); + } - + -- cgit 1.5.1 From 8df80f659ad343b2782abefaabdbe9f8b684c27e Mon Sep 17 00:00:00 2001 From: The Arcane Brony Date: Fri, 22 Oct 2021 09:56:36 +0200 Subject: Attempt to fix auto register --- api/client_test/index.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'api/client_test') diff --git a/api/client_test/index.html b/api/client_test/index.html index 2ff0b469..b19d5f0d 100644 --- a/api/client_test/index.html +++ b/api/client_test/index.html @@ -51,11 +51,12 @@ `{"trace":false,"canary":false,"logGatewayEvents":true,"logOverlayEvents":true,"logAnalyticsEvents":true,"sourceMapsEnabled":false,"axeEnabled":false}` ); - - const token = JSON.parse(localStorage.getItem("token")); - if(token) { - document.querySelector("#logincss").remove(); - } + setInterval(() => { + var token = JSON.parse(localStorage.getItem("token")); + if (token) { + document.querySelector("#logincss").remove(); + } + }, 1000); const settings = JSON.parse(localStorage.getItem("UserSettingsStore")); if (settings && settings.locale.length <= 2) { -- cgit 1.5.1 From a61bba7e27a0d0081d176aac6900c09f7d695428 Mon Sep 17 00:00:00 2001 From: The Arcane Brony Date: Thu, 11 Nov 2021 22:17:21 +0100 Subject: Inline plugin support --- api/client_test/index.html | 6 +++--- api/package-lock.json | 2 ++ api/src/middlewares/TestClient.ts | 11 ++++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'api/client_test') diff --git a/api/client_test/index.html b/api/client_test/index.html index b19d5f0d..0b3a775a 100644 --- a/api/client_test/index.html +++ b/api/client_test/index.html @@ -4,9 +4,9 @@ Discord Test Client - - - + + + diff --git a/api/package-lock.json b/api/package-lock.json index e8ebd5bf..a4ad6b2b 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -84,6 +84,7 @@ "pg": "^8.7.1", "proxy-agent": "^5.0.0", "reflect-metadata": "^0.1.13", + "sqlite3": "^5.0.2", "typeorm": "^0.2.38", "typescript": "^4.4.2", "typescript-json-schema": "^0.50.1" @@ -16162,6 +16163,7 @@ "pg": "^8.7.1", "proxy-agent": "^5.0.0", "reflect-metadata": "^0.1.13", + "sqlite3": "^5.0.2", "ts-node": "^10.2.1", "typeorm": "^0.2.38", "typescript": "^4.4.2", diff --git a/api/src/middlewares/TestClient.ts b/api/src/middlewares/TestClient.ts index 7d981f0c..b50f4e5c 100644 --- a/api/src/middlewares/TestClient.ts +++ b/api/src/middlewares/TestClient.ts @@ -23,10 +23,15 @@ export default function TestClient(app: Application) { if (GATEWAY_ENDPOINT) { html = html.replace(/GATEWAY_ENDPOINT: .+/, `GATEWAY_ENDPOINT: \`${GATEWAY_ENDPOINT}\`,`); } - - //plugins - var files = fs.readdirSync(path.join(__dirname, "..", "..", "assets", "plugins")); + // inline plugins + var files = fs.readdirSync(path.join(__dirname, "..", "..", "assets", "preload-plugins")); var plugins = ""; + files.forEach(x =>{if(x.endsWith(".js")) plugins += `\n`; }); + html = html.replaceAll("", plugins); + + // plugins + files = fs.readdirSync(path.join(__dirname, "..", "..", "assets", "plugins")); + plugins = ""; files.forEach(x =>{if(x.endsWith(".js")) plugins += `\n`; }); html = html.replaceAll("", plugins); //preload plugins -- cgit 1.5.1