🎨 reformatted
This commit is contained in:
parent
89ff4bc685
commit
b76961657e
@ -36,9 +36,16 @@
|
|||||||
HTML_TIMESTAMP: Date.now(),
|
HTML_TIMESTAMP: Date.now(),
|
||||||
ALGOLIA_KEY: "aca0d7082e4e63af5ba5917d5e96bed0"
|
ALGOLIA_KEY: "aca0d7082e4e63af5ba5917d5e96bed0"
|
||||||
};
|
};
|
||||||
|
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.removeItem("gatewayURL");
|
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}`
|
||||||
|
);
|
||||||
|
|
||||||
|
// Auto register guest account:
|
||||||
const token = JSON.parse(localStorage.getItem("token"));
|
const token = JSON.parse(localStorage.getItem("token"));
|
||||||
if (!token) {
|
if (!token) {
|
||||||
fetch(`${window.GLOBAL_ENV.API_ENDPOINT}/auth/register`, {
|
fetch(`${window.GLOBAL_ENV.API_ENDPOINT}/auth/register`, {
|
||||||
@ -47,13 +54,14 @@
|
|||||||
body: JSON.stringify({ username: "Anonymous", consent: true })
|
body: JSON.stringify({ username: "Anonymous", consent: true })
|
||||||
})
|
})
|
||||||
.then((x) => x.json())
|
.then((x) => x.json())
|
||||||
.then((x) => localStorage.setItem("token", `"${x.token}"`));
|
.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();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
localStorage.setItem(
|
|
||||||
"DeveloperOptionsStore",
|
|
||||||
`{"trace":false,"canary":false,"logGatewayEvents":true,"logOverlayEvents":true,"logAnalyticsEvents":true,"sourceMapsEnabled":false,"axeEnabled":false}`
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
<script src="/assets/479a2f1e7d625dc134b9.js"></script>
|
<script src="/assets/479a2f1e7d625dc134b9.js"></script>
|
||||||
<script src="/assets/a15fd133a1d2d77a2424.js"></script>
|
<script src="/assets/a15fd133a1d2d77a2424.js"></script>
|
||||||
|
@ -13,6 +13,7 @@ import { initRateLimits } from "./middlewares/RateLimit";
|
|||||||
import TestClient from "./middlewares/TestClient";
|
import TestClient from "./middlewares/TestClient";
|
||||||
import { initTranslation } from "./middlewares/Translation";
|
import { initTranslation } from "./middlewares/Translation";
|
||||||
import morgan from "morgan";
|
import morgan from "morgan";
|
||||||
|
import { initInstance } from "./util/Instance";
|
||||||
|
|
||||||
export interface FosscordServerOptions extends ServerOptions {}
|
export interface FosscordServerOptions extends ServerOptions {}
|
||||||
|
|
||||||
@ -37,6 +38,7 @@ export class FosscordServer extends Server {
|
|||||||
await initDatabase();
|
await initDatabase();
|
||||||
await Config.init();
|
await Config.init();
|
||||||
await initEvent();
|
await initEvent();
|
||||||
|
await initInstance();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
DOCUMENTATION: uses LOG_REQUESTS environment variable
|
DOCUMENTATION: uses LOG_REQUESTS environment variable
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Request, Response, Router } from "express";
|
import { Request, Response, Router } from "express";
|
||||||
import { FieldErrors, route } from "@fosscord/api";
|
import { route } from "@fosscord/api";
|
||||||
import bcrypt from "bcrypt";
|
import bcrypt from "bcrypt";
|
||||||
import { Config, User, generateToken, adjustEmail } from "@fosscord/util";
|
import { Config, User, generateToken, adjustEmail, FieldErrors } from "@fosscord/util";
|
||||||
|
|
||||||
const router: Router = Router();
|
const router: Router = Router();
|
||||||
export default router;
|
export default router;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user