rearrange test client's index a bit
This commit is contained in:
parent
ce14760c2b
commit
56444d1942
@ -183,3 +183,8 @@ dbdc2f57ed1a7f2f01a342ab2e6fb032.svg
|
|||||||
9a31e0f65d520cc12d7f42374d59a2d1.svg
|
9a31e0f65d520cc12d7f42374d59a2d1.svg
|
||||||
d759f3acc6286c964cc8118d7f68b374.svg
|
d759f3acc6286c964cc8118d7f68b374.svg
|
||||||
eeacc28d3c62a7cf1154a2bc11968ad8.svg
|
eeacc28d3c62a7cf1154a2bc11968ad8.svg
|
||||||
|
9fa091f676e4451ee5946fed948cb8fe.svg
|
||||||
|
7c010dc6da25c012643ea22c1f002bb4.svg
|
||||||
|
9ea87b934848cd1f5c4bc7f1fcdac803.png
|
||||||
|
626aaed496ac12bbdb68a86b46871a1f.svg
|
||||||
|
66f6c781fe86c346fbaf3390618668fc.svg
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
ALGOLIA_KEY: "aca0d7082e4e63af5ba5917d5e96bed0"
|
ALGOLIA_KEY: "aca0d7082e4e63af5ba5917d5e96bed0"
|
||||||
};
|
};
|
||||||
GLOBAL_ENV.MEDIA_PROXY_ENDPOINT = location.protocol + "//" + GLOBAL_ENV.CDN_HOST;
|
GLOBAL_ENV.MEDIA_PROXY_ENDPOINT = location.protocol + "//" + GLOBAL_ENV.CDN_HOST;
|
||||||
const localStorage = window.localStorage;
|
|
||||||
// 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);
|
localStorage.setItem("gatewayURL", window.GLOBAL_ENV.GATEWAY_ENDPOINT);
|
||||||
|
@ -1,80 +1,78 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
|
||||||
<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>
|
<head>
|
||||||
<div id="app-mount"></div>
|
<meta charset="UTF-8" />
|
||||||
<script>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
window.__OVERLAY__ = /overlay/.test(location.pathname);
|
<title>Discord Test Client</title>
|
||||||
window.__BILLING_STANDALONE__ = /^\/billing/.test(location.pathname);
|
<link rel="stylesheet" href="/assets/fosscord.css" />
|
||||||
window.GLOBAL_ENV = {
|
<link id="logincss" rel="stylesheet" href="/assets/fosscord-login.css" />
|
||||||
API_ENDPOINT: "/api",
|
<link id="customcss" rel="stylesheet" href="/assets/user.css" />
|
||||||
API_VERSION: 9,
|
|
||||||
GATEWAY_ENDPOINT: `${location.protocol === "https:" ? "wss://" : "ws://"}${location.hostname}:3002`,
|
|
||||||
WEBAPP_ENDPOINT: "",
|
|
||||||
CDN_HOST: `${location.hostname}:3003`,
|
|
||||||
ASSET_ENDPOINT: "",
|
|
||||||
MEDIA_PROXY_ENDPOINT: "https://media.discordapp.net",
|
|
||||||
WIDGET_ENDPOINT: `//${location.host}/widget`,
|
|
||||||
INVITE_HOST: `${location.hostname}/invite`,
|
|
||||||
GUILD_TEMPLATE_HOST: "${location.host}",
|
|
||||||
GIFT_CODE_HOST: "${location.hostname}",
|
|
||||||
RELEASE_CHANNEL: "stable",
|
|
||||||
MARKETING_ENDPOINT: "//discord.com",
|
|
||||||
BRAINTREE_KEY: "production_5st77rrc_49pp2rp4phym7387",
|
|
||||||
STRIPE_KEY: "pk_live_CUQtlpQUF0vufWpnpUmQvcdi",
|
|
||||||
NETWORKING_ENDPOINT: "//router.discordapp.net",
|
|
||||||
RTC_LATENCY_ENDPOINT: "//${location.hostname}/rtc",
|
|
||||||
PROJECT_ENV: "production",
|
|
||||||
REMOTE_AUTH_ENDPOINT: "//localhost:3020",
|
|
||||||
SENTRY_TAGS: { buildId: "75e36d9", buildType: "normal" },
|
|
||||||
MIGRATION_SOURCE_ORIGIN: "https://${location.hostname}",
|
|
||||||
MIGRATION_DESTINATION_ORIGIN: "https://${location.hostname}",
|
|
||||||
HTML_TIMESTAMP: Date.now(),
|
|
||||||
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}`
|
|
||||||
);
|
|
||||||
|
|
||||||
setInterval(() => {
|
<script>
|
||||||
var token = JSON.parse(localStorage.getItem("token"));
|
window.__OVERLAY__ = /overlay/.test(location.pathname);
|
||||||
if (token) {
|
window.__BILLING_STANDALONE__ = /^\/billing/.test(location.pathname);
|
||||||
var logincss = document.querySelector('#logincss'),
|
window.GLOBAL_ENV = {
|
||||||
canRemove = logincss ? logincss: "";
|
API_ENDPOINT: "/api",
|
||||||
if(canRemove !== "") {
|
API_VERSION: 9,
|
||||||
document.querySelector("#logincss").remove();
|
GATEWAY_ENDPOINT: `${location.protocol === "https:" ? "wss://" : "ws://"}${location.hostname}:3002`,
|
||||||
canRemove = "";
|
WEBAPP_ENDPOINT: "",
|
||||||
}
|
CDN_HOST: `${location.hostname}:3003`,
|
||||||
|
ASSET_ENDPOINT: "",
|
||||||
|
MEDIA_PROXY_ENDPOINT: "https://media.discordapp.net",
|
||||||
|
WIDGET_ENDPOINT: `//${location.host}/widget`,
|
||||||
|
INVITE_HOST: `${location.hostname}/invite`,
|
||||||
|
GUILD_TEMPLATE_HOST: "${location.host}",
|
||||||
|
GIFT_CODE_HOST: "${location.hostname}",
|
||||||
|
RELEASE_CHANNEL: "stable",
|
||||||
|
MARKETING_ENDPOINT: "//discord.com",
|
||||||
|
BRAINTREE_KEY: "production_5st77rrc_49pp2rp4phym7387",
|
||||||
|
STRIPE_KEY: "pk_live_CUQtlpQUF0vufWpnpUmQvcdi",
|
||||||
|
NETWORKING_ENDPOINT: "//router.discordapp.net",
|
||||||
|
RTC_LATENCY_ENDPOINT: "//${location.hostname}/rtc",
|
||||||
|
PROJECT_ENV: "Slowcord",
|
||||||
|
REMOTE_AUTH_ENDPOINT: "//localhost:3020",
|
||||||
|
SENTRY_TAGS: { buildId: "75e36d9", buildType: "normal" },
|
||||||
|
MIGRATION_SOURCE_ORIGIN: "https://${location.hostname}",
|
||||||
|
MIGRATION_DESTINATION_ORIGIN: "https://${location.hostname}",
|
||||||
|
HTML_TIMESTAMP: Date.now(),
|
||||||
|
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}`
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Not required because slowcord has its own logic server
|
||||||
|
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>
|
}, 1000)
|
||||||
<script src="/assets/checkLocale.js"></script>
|
*/
|
||||||
<script src="/assets/83ace7450e110d16319e.js"></script>
|
</script>
|
||||||
<script src="/assets/e02290aaa8dac5d195c2.js"></script>
|
|
||||||
<script src="/assets/4f3b3c576b879a5f75d1.js"></script>
|
<!-- preload plugin marker -->
|
||||||
<script src="/assets/699456246fdfe7589855.js"></script>
|
</head>
|
||||||
<!-- plugin marker -->
|
|
||||||
</body>
|
<body>
|
||||||
|
<div id="app-mount"></div>
|
||||||
|
<script src="/assets/83ace7450e110d16319e.js"></script>
|
||||||
|
<script src="/assets/e02290aaa8dac5d195c2.js"></script>
|
||||||
|
<script src="/assets/4f3b3c576b879a5f75d1.js"></script>
|
||||||
|
<script src="/assets/699456246fdfe7589855.js"></script>
|
||||||
|
<!-- plugin marker -->
|
||||||
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
@ -1,62 +0,0 @@
|
|||||||
// Auto register guest account:
|
|
||||||
const prefix = [
|
|
||||||
"mysterious",
|
|
||||||
"adventurous",
|
|
||||||
"courageous",
|
|
||||||
"precious",
|
|
||||||
"cynical",
|
|
||||||
"flamer ",
|
|
||||||
"despicable",
|
|
||||||
"suspicious",
|
|
||||||
"gorgeous",
|
|
||||||
"impeccable",
|
|
||||||
"lovely",
|
|
||||||
"stunning",
|
|
||||||
"keyed",
|
|
||||||
"phoned",
|
|
||||||
"glorious",
|
|
||||||
"amazing",
|
|
||||||
"strange",
|
|
||||||
"arcane"
|
|
||||||
];
|
|
||||||
const suffix = [
|
|
||||||
"Anonymous",
|
|
||||||
"Boy",
|
|
||||||
"Lurker",
|
|
||||||
"Keyhitter",
|
|
||||||
"User",
|
|
||||||
"Enjoyer",
|
|
||||||
"Hunk",
|
|
||||||
"Coolstar",
|
|
||||||
"Wrestling",
|
|
||||||
"TylerTheCreator",
|
|
||||||
"Ad",
|
|
||||||
"Gamer",
|
|
||||||
"Games",
|
|
||||||
"Programmer"
|
|
||||||
];
|
|
||||||
|
|
||||||
Array.prototype.random = function () {
|
|
||||||
return this[Math.floor(Math.random() * this.length)];
|
|
||||||
};
|
|
||||||
|
|
||||||
function _generateName() {
|
|
||||||
return `${prefix.random()}${suffix.random()}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
var 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();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
46
assets/preload-plugins/checkLocale.js
Normal file
46
assets/preload-plugins/checkLocale.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// 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 = [
|
||||||
|
"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"
|
||||||
|
];
|
||||||
|
|
||||||
|
const settings = JSON.parse(localStorage.getItem("UserSettingsStore"));
|
||||||
|
if (settings && !supportedLocales.includes(settings.locale)) {
|
||||||
|
// fix client locale wrong and client not loading at all
|
||||||
|
settings.locale = "en-US";
|
||||||
|
localStorage.setItem("UserSettingsStore", JSON.stringify(settings));
|
||||||
|
}
|
@ -1,17 +1,16 @@
|
|||||||
if (window.location.hostname == "127.0.0.1" || window.location.hostname == "localhost")
|
if (window.location.hostname !== "127.0.0.1" && window.location.hostname !== "localhost") {
|
||||||
throw "disabling loginRedirect because localhost";
|
const redirectIfOnLogin = () => {
|
||||||
|
const path = window.location.pathname;
|
||||||
|
if (path == "/login" || path == "/register" || !localStorage.getItem("token")) {
|
||||||
|
window.location.pathname = "/login";
|
||||||
|
//window.location.reload();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const redirectIfOnLogin = () => {
|
const observer = new MutationObserver((mutations) => {
|
||||||
const path = window.location.pathname;
|
redirectIfOnLogin();
|
||||||
if (path == "/login" || path == "/register" || !localStorage.getItem("token")) {
|
});
|
||||||
window.location.pathname = "/login";
|
observer.observe(document, { subtree: true, childList: true });
|
||||||
//window.location.reload();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const observer = new MutationObserver((mutations) => {
|
|
||||||
redirectIfOnLogin();
|
redirectIfOnLogin();
|
||||||
});
|
}
|
||||||
observer.observe(document, { subtree: true, childList: true });
|
|
||||||
|
|
||||||
redirectIfOnLogin();
|
|
@ -1,47 +0,0 @@
|
|||||||
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 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"
|
|
||||||
];
|
|
||||||
|
|
||||||
const settings = JSON.parse(localStorage.getItem("UserSettingsStore"));
|
|
||||||
if (settings && !supportedLocales.includes(settings.locale)) {
|
|
||||||
// fix client locale wrong and client not loading at all
|
|
||||||
settings.locale = "en-US";
|
|
||||||
localStorage.setItem("UserSettingsStore", JSON.stringify(settings));
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user