diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2023-04-02 10:55:17 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2023-04-02 10:55:17 +1000 |
commit | 218f71b82cca0451cbe20834283100cac234666c (patch) | |
tree | d6052ae996de9fc03884cb4692838eb09da439f2 /src/api/Server.ts | |
parent | prettier (diff) | |
parent | Remove ALL fosscord mentions (diff) | |
download | server-218f71b82cca0451cbe20834283100cac234666c.tar.xz |
Merge branch 'master' into refactor/dev/connections
Diffstat (limited to 'src/api/Server.ts')
-rw-r--r-- | src/api/Server.ts | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/api/Server.ts b/src/api/Server.ts index 30f02e57..472ab1d6 100644 --- a/src/api/Server.ts +++ b/src/api/Server.ts @@ -1,6 +1,6 @@ /* - Fosscord: A FOSS re-implementation and extension of the Discord.com backend. - Copyright (C) 2023 Fosscord and Fosscord Contributors + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2023 Spacebar and Spacebar Contributors This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -27,7 +27,7 @@ import { WebAuthn, ConnectionConfig, ConnectionLoader, -} from "@fosscord/util"; +} from "@spacebar/util"; import { Request, Response, Router } from "express"; import { Server, ServerOptions } from "lambert-server"; import "missing-native-js-functions"; @@ -41,21 +41,29 @@ import { initRateLimits } from "./middlewares/RateLimit"; import { initTranslation } from "./middlewares/Translation"; import { initInstance } from "./util/handlers/Instance"; -export type FosscordServerOptions = ServerOptions; +const PUBLIC_ASSETS_FOLDER = path.join( + __dirname, + "..", + "..", + "assets", + "public", +); + +export type SpacebarServerOptions = ServerOptions; declare global { // eslint-disable-next-line @typescript-eslint/no-namespace namespace Express { interface Request { - server: FosscordServer; + server: SpacebarServer; } } } -export class FosscordServer extends Server { - public declare options: FosscordServerOptions; +export class SpacebarServer extends Server { + public declare options: SpacebarServerOptions; - constructor(opts?: Partial<FosscordServerOptions>) { + constructor(opts?: Partial<SpacebarServerOptions>) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore super({ ...opts, errorHandler: false, jsonBody: false }); @@ -129,6 +137,10 @@ export class FosscordServer extends Server { app.use("/api/v9", api); app.use("/api", api); // allow unversioned requests + app.get("/", (req, res) => + res.sendFile(path.join(PUBLIC_ASSETS_FOLDER, "index.html")), + ); + this.app.use(ErrorHandler); Sentry.errorHandler(this.app); |