diff options
author | uurgothat <cckhmck@gmail.com> | 2021-11-17 22:28:22 +0300 |
---|---|---|
committer | uurgothat <cckhmck@gmail.com> | 2021-11-17 22:28:22 +0300 |
commit | 39aebb2cfc053c1cf8837738ac4154a454e44ff1 (patch) | |
tree | c39ffd799cad1f68ac954c8870d04169949854bc /api/src | |
parent | Merge pull request #496 from fosscord/translation (diff) | |
download | server-39aebb2cfc053c1cf8837738ac4154a454e44ff1.tar.xz |
Add instance route
Diffstat (limited to 'api/src')
-rw-r--r-- | api/src/middlewares/Authentication.ts | 1 | ||||
-rw-r--r-- | api/src/routes/policies/instance/domains.ts | 16 | ||||
-rw-r--r-- | api/src/routes/policies/instance/limits.ts | 11 | ||||
-rw-r--r-- | api/src/routes/policies/instance/meta.ts | 12 |
4 files changed, 40 insertions, 0 deletions
diff --git a/api/src/middlewares/Authentication.ts b/api/src/middlewares/Authentication.ts index 59a181e6..e6df6eeb 100644 --- a/api/src/middlewares/Authentication.ts +++ b/api/src/middlewares/Authentication.ts @@ -11,6 +11,7 @@ export const NO_AUTHORIZATION_ROUTES = [ "/experiments", "/-/readyz", "/-/healthz", + "/policies/instance/", /\/guilds\/\d+\/widget\.(json|png)/ ]; diff --git a/api/src/routes/policies/instance/domains.ts b/api/src/routes/policies/instance/domains.ts new file mode 100644 index 00000000..b68763cc --- /dev/null +++ b/api/src/routes/policies/instance/domains.ts @@ -0,0 +1,16 @@ +import { Router, Request, Response } from "express"; +import { route } from "@fosscord/api"; +import { Config } from "@fosscord/util"; +import { config } from "dotenv" +const router = Router(); +const { cdn } = Config.get(); + +const IdentityForm = { + cdn: cdn.endpointPublic || process.env.CDN || "http://localhost:3001", +} + +router.get("/",route({}), async (req: Request, res: Response) => { + res.json(IdentityForm) +}); + +export default router; diff --git a/api/src/routes/policies/instance/limits.ts b/api/src/routes/policies/instance/limits.ts new file mode 100644 index 00000000..912908b7 --- /dev/null +++ b/api/src/routes/policies/instance/limits.ts @@ -0,0 +1,11 @@ +import { Router, Request, Response } from "express"; +import { route } from "@fosscord/api"; +import { Config } from "@fosscord/util"; +const router = Router(); +const { limits } = Config.get(); + +router.get("/",route({}), async (req: Request, res: Response) => { + res.json(limits) +}); + +export default router; diff --git a/api/src/routes/policies/instance/meta.ts b/api/src/routes/policies/instance/meta.ts new file mode 100644 index 00000000..7a998487 --- /dev/null +++ b/api/src/routes/policies/instance/meta.ts @@ -0,0 +1,12 @@ +import { Router, Request, Response } from "express"; +import { route } from "@fosscord/api"; +import { Config } from "@fosscord/util"; + +const router = Router(); +const { general } = Config.get(); + +router.get("/",route({}), async (req: Request, res: Response) => { + res.json(general) +}); + +export default router; |