diff options
author | Thesourtimes <cckhmck@gmail.com> | 2021-11-18 22:15:05 +0300 |
---|---|---|
committer | Thesourtimes <cckhmck@gmail.com> | 2021-11-18 22:15:05 +0300 |
commit | 17684a14fda0bb0f066efe31273dc55f3298e7d8 (patch) | |
tree | 2c919b9226c77b3c0cc45cfa93cf51c0e0c37f92 | |
parent | Add image field (diff) | |
download | server-17684a14fda0bb0f066efe31273dc55f3298e7d8.tar.xz |
Fix the minor issues on route
-rw-r--r-- | api/src/middlewares/Authentication.ts | 4 | ||||
-rw-r--r-- | api/src/routes/policies/instance/domains.ts | 14 | ||||
-rw-r--r-- | api/src/routes/policies/instance/index.ts (renamed from api/src/routes/policies/instance/meta.ts) | 6 | ||||
-rw-r--r-- | api/src/routes/policies/instance/limits.ts | 4 | ||||
-rw-r--r-- | util/src/entities/Config.ts | 2 |
5 files changed, 18 insertions, 12 deletions
diff --git a/api/src/middlewares/Authentication.ts b/api/src/middlewares/Authentication.ts index e6df6eeb..8fbdd2b7 100644 --- a/api/src/middlewares/Authentication.ts +++ b/api/src/middlewares/Authentication.ts @@ -11,7 +11,9 @@ export const NO_AUTHORIZATION_ROUTES = [ "/experiments", "/-/readyz", "/-/healthz", - "/policies/instance/", + "/science", + "/track", + "/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 index b68763cc..20cd07ba 100644 --- a/api/src/routes/policies/instance/domains.ts +++ b/api/src/routes/policies/instance/domains.ts @@ -3,14 +3,16 @@ 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) + const { cdn, gateway } = Config.get(); + + const IdentityForm = { + cdn: cdn.endpointPublic || process.env.CDN || "http://localhost:3001", + gateway: gateway.endpointPublic || process.env.GATEWAY || "ws://localhost:3002" + }; + + res.json(IdentityForm); }); export default router; diff --git a/api/src/routes/policies/instance/meta.ts b/api/src/routes/policies/instance/index.ts index 7a998487..e3da014f 100644 --- a/api/src/routes/policies/instance/meta.ts +++ b/api/src/routes/policies/instance/index.ts @@ -1,12 +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) + const { general } = Config.get(); + res.json(general); }); export default router; diff --git a/api/src/routes/policies/instance/limits.ts b/api/src/routes/policies/instance/limits.ts index 912908b7..7de1476b 100644 --- a/api/src/routes/policies/instance/limits.ts +++ b/api/src/routes/policies/instance/limits.ts @@ -2,10 +2,10 @@ 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) + const { limits } = Config.get(); + res.json(limits); }); export default router; diff --git a/util/src/entities/Config.ts b/util/src/entities/Config.ts index 2d4ad252..d277c88c 100644 --- a/util/src/entities/Config.ts +++ b/util/src/entities/Config.ts @@ -52,6 +52,7 @@ export interface ConfigValue { instanceName: string; instanceDescription: string | null; frontPage: string | null; + tosPage: string | null; image: string | null; instanceId: string; }; @@ -187,6 +188,7 @@ export const DefaultConfigOptions: ConfigValue = { instanceName: "Fosscord Instance", instanceDescription: "This is a Fosscord instance made in pre-relase days", frontPage: null, + tosPage: null, image: null, instanceId: Snowflake.generate(), }, |