summary refs log tree commit diff
path: root/src/api/Server.ts
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-04-01 19:04:22 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-04-01 19:04:22 +1100
commit13dedb6d251593054de6a64487f0b053060afd5c (patch)
treec829b67068133911cbecdab1057e0d8a0fea09f3 /src/api/Server.ts
parentgatewayresponse?? (diff)
parentRemove ALL fosscord mentions (diff)
downloadserver-13dedb6d251593054de6a64487f0b053060afd5c.tar.xz
Merge branch 'master' into feat/refactorIdentify
Diffstat (limited to 'src/api/Server.ts')
-rw-r--r--src/api/Server.ts28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/api/Server.ts b/src/api/Server.ts

index 49229494..447a4802 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 @@ -25,7 +25,7 @@ import { registerRoutes, Sentry, WebAuthn, -} from "@fosscord/util"; +} from "@spacebar/util"; import { Request, Response, Router } from "express"; import { Server, ServerOptions } from "lambert-server"; import "missing-native-js-functions"; @@ -39,21 +39,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 }); @@ -126,6 +134,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);