'localStorage is not defined'?
This commit is contained in:
parent
fdbd150ce3
commit
9d3b5af3e3
@ -1,41 +1,43 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="theme-dark" data-theme="dark">
|
<html class="theme-dark" data-theme="dark">
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no" name="viewport" />
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="/assets/532.03aaeef88460fae60534.css" integrity="" />
|
<head>
|
||||||
<link rel="icon" href="/assets/07dca80a102d4149e9736d4b162cff6f.ico" />
|
<meta charset="utf-8" />
|
||||||
<title>Discord Test Client Developer Portal</title>
|
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no" name="viewport" />
|
||||||
<meta charset="utf-8" data-react-helmet="true" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
<link rel="stylesheet" href="/assets/532.03aaeef88460fae60534.css" integrity="" />
|
||||||
<div id="app-mount"></div>
|
<link rel="icon" href="/assets/07dca80a102d4149e9736d4b162cff6f.ico" />
|
||||||
<script>
|
<title>Discord Test Client Developer Portal</title>
|
||||||
window.GLOBAL_ENV = {
|
<meta charset="utf-8" data-react-helmet="true" />
|
||||||
API_VERSION: 9,
|
</head>
|
||||||
API_ENDPOINT: "/api",
|
|
||||||
WEBAPP_ENDPOINT: "",
|
<body>
|
||||||
CDN_HOST: `${location.hostname}:3003`,
|
<div id="app-mount"></div>
|
||||||
|
<script>
|
||||||
|
window.GLOBAL_ENV = {
|
||||||
|
API_VERSION: 9,
|
||||||
|
API_ENDPOINT: "/api",
|
||||||
|
WEBAPP_ENDPOINT: "",
|
||||||
|
CDN_HOST: `${location.hostname}:3003`,
|
||||||
|
|
||||||
|
BRAINTREE_KEY: "production_5st77rrc_49pp2rp4phym7387",
|
||||||
|
STRIPE_KEY: "pk_live_CUQtlpQUF0vufWpnpUmQvcdi",
|
||||||
|
MARKETING_ENDPOINT: "//discord.com",
|
||||||
|
RELEASE_CHANNEL: "stable",
|
||||||
|
ALGOLIA_KEY: "aca0d7082e4e63af5ba5917d5e96bed0"
|
||||||
|
};
|
||||||
|
GLOBAL_ENV.MEDIA_PROXY_ENDPOINT = location.protocol + "//" + GLOBAL_ENV.CDN_HOST;
|
||||||
|
// TODO: remote auth
|
||||||
|
// window.GLOBAL_ENV.REMOTE_AUTH_ENDPOINT = window.GLOBAL_ENV.GATEWAY_ENDPOINT.replace(/wss?:/, "");
|
||||||
|
window.localStorage.setItem("gatewayURL", window.GLOBAL_ENV.GATEWAY_ENDPOINT);
|
||||||
|
window.localStorage.setItem(
|
||||||
|
"DeveloperOptionsStore",
|
||||||
|
`{"trace":false,"canary":false,"logGatewayEvents":true,"logOverlayEvents":true,"logAnalyticsEvents":true,"sourceMapsEnabled":false,"axeEnabled":false}`
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
<script src="/assets/41fde19fdf180f3d4315.js" integrity=""></script>
|
||||||
|
<script src="/assets/7b04a3ab10e05dd9054e.js" integrity=""></script>
|
||||||
|
<script src="/assets/d1f811da193e5648048b.js" integrity=""></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
BRAINTREE_KEY: "production_5st77rrc_49pp2rp4phym7387",
|
|
||||||
STRIPE_KEY: "pk_live_CUQtlpQUF0vufWpnpUmQvcdi",
|
|
||||||
MARKETING_ENDPOINT: "//discord.com",
|
|
||||||
RELEASE_CHANNEL: "stable",
|
|
||||||
ALGOLIA_KEY: "aca0d7082e4e63af5ba5917d5e96bed0"
|
|
||||||
};
|
|
||||||
GLOBAL_ENV.MEDIA_PROXY_ENDPOINT = location.protocol + "//" + GLOBAL_ENV.CDN_HOST;
|
|
||||||
// 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}`
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
<script src="/assets/41fde19fdf180f3d4315.js" integrity=""></script>
|
|
||||||
<script src="/assets/7b04a3ab10e05dd9054e.js" integrity=""></script>
|
|
||||||
<script src="/assets/d1f811da193e5648048b.js" integrity=""></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
@ -41,8 +41,8 @@
|
|||||||
GLOBAL_ENV.MEDIA_PROXY_ENDPOINT = location.protocol + "//" + GLOBAL_ENV.CDN_HOST;
|
GLOBAL_ENV.MEDIA_PROXY_ENDPOINT = location.protocol + "//" + GLOBAL_ENV.CDN_HOST;
|
||||||
// TODO: remote auth
|
// TODO: remote auth
|
||||||
// window.GLOBAL_ENV.REMOTE_AUTH_ENDPOINT = window.GLOBAL_ENV.GATEWAY_ENDPOINT.replace(/wss?:/, "");
|
// window.GLOBAL_ENV.REMOTE_AUTH_ENDPOINT = window.GLOBAL_ENV.GATEWAY_ENDPOINT.replace(/wss?:/, "");
|
||||||
localStorage.setItem("gatewayURL", window.GLOBAL_ENV.GATEWAY_ENDPOINT);
|
window.localStorage.setItem("gatewayURL", window.GLOBAL_ENV.GATEWAY_ENDPOINT);
|
||||||
localStorage.setItem(
|
window.localStorage.setItem(
|
||||||
"DeveloperOptionsStore",
|
"DeveloperOptionsStore",
|
||||||
`{"trace":false,"canary":false,"logGatewayEvents":true,"logOverlayEvents":true,"logAnalyticsEvents":true,"sourceMapsEnabled":false,"axeEnabled":false}`
|
`{"trace":false,"canary":false,"logGatewayEvents":true,"logOverlayEvents":true,"logAnalyticsEvents":true,"sourceMapsEnabled":false,"axeEnabled":false}`
|
||||||
);
|
);
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
// 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 supportedLocales = [
|
const supportedLocales = [
|
||||||
"bg",
|
"bg",
|
||||||
"cs",
|
"cs",
|
||||||
@ -38,9 +30,9 @@ const supportedLocales = [
|
|||||||
"zh-TW"
|
"zh-TW"
|
||||||
];
|
];
|
||||||
|
|
||||||
const settings = JSON.parse(localStorage.getItem("UserSettingsStore"));
|
const settings = JSON.parse(window.localStorage.getItem("UserSettingsStore"));
|
||||||
if (settings && !supportedLocales.includes(settings.locale)) {
|
if (settings && !supportedLocales.includes(settings.locale)) {
|
||||||
// fix client locale wrong and client not loading at all
|
// fix client locale wrong and client not loading at all
|
||||||
settings.locale = "en-US";
|
settings.locale = "en-US";
|
||||||
localStorage.setItem("UserSettingsStore", JSON.stringify(settings));
|
window.localStorage.setItem("UserSettingsStore", JSON.stringify(settings));
|
||||||
}
|
}
|
@ -1,12 +0,0 @@
|
|||||||
// Remove `<link id="logincss" rel="stylesheet" href="/assets/fosscord-login.css" />` from header when we're not accessing `/login` or `/register`
|
|
||||||
// fosscord-login.css replaces discord's TOS tooltip with something more fitting for fosscord, which when included in the main app, causes other tooltips
|
|
||||||
// to be affected, which is potentially unwanted.
|
|
||||||
//
|
|
||||||
// This script removes fosscord-login.css when a user reloads the page. From testing, it appears fosscord already properly removes
|
|
||||||
// fosscord-login.css after login is successful, but not if you reload the page after logging in. This script is to remove fosscord-login.css in
|
|
||||||
// that specific case.
|
|
||||||
|
|
||||||
var token = JSON.parse(localStorage.getItem("token"));
|
|
||||||
if (!token && location.pathname !== "/login" && location.pathname !== "/register") {
|
|
||||||
document.getElementById("logincss").remove();
|
|
||||||
}
|
|
@ -1,7 +1,7 @@
|
|||||||
if (window.location.hostname !== "127.0.0.1" && window.location.hostname !== "localhost") {
|
if (window.location.hostname !== "127.0.0.1" && window.location.hostname !== "localhost") {
|
||||||
const redirectIfOnLogin = () => {
|
const redirectIfOnLogin = () => {
|
||||||
const path = window.location.pathname;
|
const path = window.location.pathname;
|
||||||
if (path == "/login" || path == "/register" || !localStorage.getItem("token")) {
|
if (path == "/login" || path == "/register" || !window.localStorage.getItem("token")) {
|
||||||
window.location.pathname = "/login";
|
window.location.pathname = "/login";
|
||||||
//window.location.reload();
|
//window.location.reload();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user