From 754d8dbf64fc242edca3696bf5627e83c150f2bb Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Sat, 14 Jan 2023 19:55:19 +0100 Subject: Add basic info in ping Signed-off-by: TheArcaneBrony --- src/api/routes/ping.ts | 8 +++++++- src/util/config/types/ApiConfiguration.ts | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/api/routes/ping.ts b/src/api/routes/ping.ts index 3c1da2c3..ff79399c 100644 --- a/src/api/routes/ping.ts +++ b/src/api/routes/ping.ts @@ -5,7 +5,7 @@ import { Config } from "@fosscord/util"; const router = Router(); router.get("/", route({}), (req: Request, res: Response) => { - const { general } = Config.get(); + const { general, api, cdn, gateway } = Config.get(); res.send({ ping: "pong!", instance: { @@ -19,6 +19,12 @@ router.get("/", route({}), (req: Request, res: Response) => { frontPage: general.frontPage, tosPage: general.tosPage, + endpoints: { + defaultApiVersion: api.defaultVersion ?? 9, + apiEndpoint: api.endpointPublic ?? "/api", + cdnEndpoint: cdn.endpointPublic ?? "/", + gatewayEndpoint: gateway.endpointPublic ?? "/", + }, }, }); }); diff --git a/src/util/config/types/ApiConfiguration.ts b/src/util/config/types/ApiConfiguration.ts index 442a5986..64d9e6d7 100644 --- a/src/util/config/types/ApiConfiguration.ts +++ b/src/util/config/types/ApiConfiguration.ts @@ -2,4 +2,5 @@ export class ApiConfiguration { defaultVersion: string = "9"; activeVersions: string[] = ["6", "7", "8", "9"]; useFosscordEnhancements: boolean = true; + endpointPublic: string = "/api"; } -- cgit 1.4.1 From 1d27e610291b0637b3f6f1b40282f69cf4840213 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Sat, 14 Jan 2023 23:34:33 +0100 Subject: Fix some default value Signed-off-by: TheArcaneBrony --- src/api/routes/ping.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/api/routes/ping.ts b/src/api/routes/ping.ts index ff79399c..9bf8c243 100644 --- a/src/api/routes/ping.ts +++ b/src/api/routes/ping.ts @@ -23,7 +23,8 @@ router.get("/", route({}), (req: Request, res: Response) => { defaultApiVersion: api.defaultVersion ?? 9, apiEndpoint: api.endpointPublic ?? "/api", cdnEndpoint: cdn.endpointPublic ?? "/", - gatewayEndpoint: gateway.endpointPublic ?? "/", + gatewayEndpoint: + gateway.endpointPublic ?? "ws://localhost:3001", }, }, }); -- cgit 1.4.1 From 8a23ac19f832f9fa4b97126ecae6e7553ce82c47 Mon Sep 17 00:00:00 2001 From: Chris Chrome Date: Sun, 15 Jan 2023 19:46:41 -0700 Subject: Move endpoints from ping -> policies/instance/domains (#933) --- src/api/routes/ping.ts | 9 +-------- src/api/routes/policies/instance/domains.ts | 4 +++- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/api/routes/ping.ts b/src/api/routes/ping.ts index 9bf8c243..3c1da2c3 100644 --- a/src/api/routes/ping.ts +++ b/src/api/routes/ping.ts @@ -5,7 +5,7 @@ import { Config } from "@fosscord/util"; const router = Router(); router.get("/", route({}), (req: Request, res: Response) => { - const { general, api, cdn, gateway } = Config.get(); + const { general } = Config.get(); res.send({ ping: "pong!", instance: { @@ -19,13 +19,6 @@ router.get("/", route({}), (req: Request, res: Response) => { frontPage: general.frontPage, tosPage: general.tosPage, - endpoints: { - defaultApiVersion: api.defaultVersion ?? 9, - apiEndpoint: api.endpointPublic ?? "/api", - cdnEndpoint: cdn.endpointPublic ?? "/", - gatewayEndpoint: - gateway.endpointPublic ?? "ws://localhost:3001", - }, }, }); }); diff --git a/src/api/routes/policies/instance/domains.ts b/src/api/routes/policies/instance/domains.ts index f22eac17..0acecb9a 100644 --- a/src/api/routes/policies/instance/domains.ts +++ b/src/api/routes/policies/instance/domains.ts @@ -5,7 +5,7 @@ import { config } from "dotenv"; const router = Router(); router.get("/", route({}), async (req: Request, res: Response) => { - const { cdn, gateway } = Config.get(); + const { cdn, gateway, api } = Config.get(); const IdentityForm = { cdn: cdn.endpointPublic || process.env.CDN || "http://localhost:3001", @@ -13,6 +13,8 @@ router.get("/", route({}), async (req: Request, res: Response) => { gateway.endpointPublic || process.env.GATEWAY || "ws://localhost:3002", + defaultApiVersion: api.defaultVersion ?? 9, + apiEndpoint: api.endpointPublic ?? "/api", }; res.json(IdentityForm); -- cgit 1.4.1