summary refs log tree commit diff
path: root/ReferenceClientProxyImplementation/Resources/Pages/index-template.html
diff options
context:
space:
mode:
Diffstat (limited to 'ReferenceClientProxyImplementation/Resources/Pages/index-template.html')
-rw-r--r--ReferenceClientProxyImplementation/Resources/Pages/index-template.html75
1 files changed, 75 insertions, 0 deletions
diff --git a/ReferenceClientProxyImplementation/Resources/Pages/index-template.html b/ReferenceClientProxyImplementation/Resources/Pages/index-template.html
new file mode 100644

index 0000000..ef77e22 --- /dev/null +++ b/ReferenceClientProxyImplementation/Resources/Pages/index-template.html
@@ -0,0 +1,75 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="UTF-8"/> + <meta content="width=device-width, initial-scale=1.0" name="viewport"/> + <title>Discord Test Client</title> + <link href="/assets/fosscord.css" rel="stylesheet"/> + <link href="/assets/fosscord-login.css" id="logincss" rel="stylesheet"/> + <link href="/assets/user.css" id="customcss" rel="stylesheet"/> + <!-- preload plugin marker --> + </head> + + <body> + <div id="app-mount"></div> + <script> + window.__OVERLAY__ = /overlay/.test(location.pathname); + window.__BILLING_STANDALONE__ = /^\/billing/.test(location.pathname); + + var xmlhttp = new XMLHttpRequest(); + var url = "/api/_fosscord/v1/global_env"; + xmlhttp.onreadystatechange = function () { + if (this.readyState == 4 && this.status == 200) { + window.GLOBAL_ENV = JSON.parse(this.responseText); + } + } + + xmlhttp.open("GET", url, false); + xmlhttp.send(); + + + 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", + JSON.stringify({ + trace: false, + canary: true, + logGatewayEvents: true, + logOverlayEvents: true, + logAnalyticsEvents: true, + sourceMapsEnabled: false, + axeEnabled: true, + bugReporterEnabled: true, + idleStatusIndicatorEnabled: false + }) + ); + + setInterval(() => { + var token = JSON.parse(localStorage.getItem("token")); + if (token) { + var logincss = document.querySelector('#logincss'), + canRemove = logincss ? logincss : ""; + if (canRemove !== "") { + document.querySelector("#logincss").remove(); + canRemove = ""; + } + } + }, 1000) + + 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)); + } + </script> + <!--prefetch_script--> + <!--client_css--> + <script src="/assets/checkLocale.js"></script> + <!--client_script--> + <!-- plugin marker --> + </body> +</html>