summary refs log tree commit diff
path: root/api/client_test
diff options
context:
space:
mode:
authorFeatyre <88265031+Featyre@users.noreply.github.com>2021-11-22 21:44:26 +0800
committerGitHub <noreply@github.com>2021-11-22 21:44:26 +0800
commit17fed6a4b60335ff7b4506ebe7880606d99a3568 (patch)
tree2ac2f9338e01c76fb810d552b6d78507d597ce45 /api/client_test
parentUpdate Identify.ts (diff)
parentMerge pull request #491 from TheArcaneBrony/master (diff)
downloadserver-17fed6a4b60335ff7b4506ebe7880606d99a3568.tar.xz
Merge branch 'fosscord:master' into master
Diffstat (limited to 'api/client_test')
-rw-r--r--api/client_test/index.html103
1 files changed, 13 insertions, 90 deletions
diff --git a/api/client_test/index.html b/api/client_test/index.html

index a68b191a..0b3a775a 100644 --- a/api/client_test/index.html +++ b/api/client_test/index.html
@@ -4,6 +4,10 @@ <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Discord Test Client</title> + <link rel="stylesheet" href="/assets/fosscord.css" /> + <link id="logincss" rel="stylesheet" href="/assets/fosscord-login.css" /> + <link id="customcss" rel="stylesheet" href="/assets/user.css" /> + <!-- preload plugin marker --> </head> <body> @@ -47,106 +51,25 @@ `{"trace":false,"canary":false,"logGatewayEvents":true,"logOverlayEvents":true,"logAnalyticsEvents":true,"sourceMapsEnabled":false,"axeEnabled":false}` ); - // Auto register guest account: - const prefix = [ - "mysterious", - "adventurous", - "courageous", - "precious", - "cynical", - "despicable", - "suspicious", - "gorgeous", - "lovely", - "stunning", - "based", - "keyed", - "ratioed", - "twink", - "phoned" - ]; - const suffix = [ - "Anonymous", - "Lurker", - "User", - "Enjoyer", - "Hunk", - "Top", - "Bottom", - "Sub", - "Coolstar", - "Wrestling", - "TylerTheCreator", - "Ad" - ]; - - Array.prototype.random = function () { - return this[Math.floor(Math.random() * this.length)]; - }; - - function _generateName() { - return `${prefix.random()}${suffix.random()}`; - } - - const token = JSON.parse(localStorage.getItem("token")); - if (!token && location.pathname !== "/login" && location.pathname !== "/register") { - fetch(`${window.GLOBAL_ENV.API_ENDPOINT}/auth/register`, { - method: "POST", - headers: { "content-type": "application/json" }, - body: JSON.stringify({ username: `${_generateName()}`, consent: true }) //${Date.now().toString().slice(-4)} - }) - .then((x) => x.json()) - .then((x) => { - localStorage.setItem("token", `"${x.token}"`); - if (!window.localStorage) { - // client already loaded -> need to reload to apply the newly registered user token - location.reload(); - } - }); - } - - const supportedLocales = [ - "bg", - "cs", - "da", - "de", - "el", - "en-GB", - "es-ES", - "fi", - "fr", - "hi", - "hr", - "hu", - "it", - "ja", - "ko", - "lt", - "nl", - "no", - "pl", - "pt-BR", - "ro", - "ru", - "sv-SE", - "th", - "tr", - "uk", - "vi", - "zh-CN", - "zh-TW" - ]; + setInterval(() => { + var token = JSON.parse(localStorage.getItem("token")); + if (token) { + document.querySelector("#logincss").remove(); + } + }, 1000); const settings = JSON.parse(localStorage.getItem("UserSettingsStore")); - if (settings && !supportedLocales.includes(settings.locale)) { + 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)); } </script> + <script src="/assets/checkLocale.js"></script> <script src="/assets/479a2f1e7d625dc134b9.js"></script> <script src="/assets/a15fd133a1d2d77a2424.js"></script> <script src="/assets/97e6fa22aa08ee4daa5e.js"></script> <script src="/assets/9b2b7f0632acd0c5e781.js"></script> + <!-- plugin marker --> </body> </html>