From 6a52e65e27d514273a4210dadafbee9692f23354 Mon Sep 17 00:00:00 2001 From: Puyodead1 Date: Thu, 22 Dec 2022 10:47:32 -0500 Subject: adding connection now works --- src/api/Server.ts | 5 +++++ src/api/routes/connections/#connection_name/authorize.ts | 2 +- src/api/routes/connections/#connection_name/callback.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/api') diff --git a/src/api/Server.ts b/src/api/Server.ts index 49229494..dc3b66ef 100644 --- a/src/api/Server.ts +++ b/src/api/Server.ts @@ -25,6 +25,8 @@ import { registerRoutes, Sentry, WebAuthn, + ConnectionConfig, + ConnectionLoader } from "@fosscord/util"; import { Request, Response, Router } from "express"; import { Server, ServerOptions } from "lambert-server"; @@ -64,6 +66,7 @@ export class FosscordServer extends Server { await Config.init(); await initEvent(); await Email.init(); + await ConnectionConfig.init(); await initInstance(); await Sentry.init(this.app); WebAuthn.init(); @@ -130,6 +133,8 @@ export class FosscordServer extends Server { Sentry.errorHandler(this.app); + ConnectionLoader.loadConnections(); + if (logRequests) console.log( red( diff --git a/src/api/routes/connections/#connection_name/authorize.ts b/src/api/routes/connections/#connection_name/authorize.ts index 8e640a69..5ce420cf 100644 --- a/src/api/routes/connections/#connection_name/authorize.ts +++ b/src/api/routes/connections/#connection_name/authorize.ts @@ -6,7 +6,7 @@ import { route } from "../../../util"; const router = Router(); router.get("/", route({}), async (req: Request, res: Response) => { - const { connection_id: connection_name } = req.params; + const { connection_name } = req.params; const connection = ConnectionStore.connections.get(connection_name); if (!connection) throw FieldErrors({ diff --git a/src/api/routes/connections/#connection_name/callback.ts b/src/api/routes/connections/#connection_name/callback.ts index f158a037..80a5b784 100644 --- a/src/api/routes/connections/#connection_name/callback.ts +++ b/src/api/routes/connections/#connection_name/callback.ts @@ -13,7 +13,7 @@ router.post( "/", route({ body: "ConnectionCallbackSchema" }), async (req: Request, res: Response) => { - const { connection_id: connection_name } = req.params; + const { connection_name } = req.params; const connection = ConnectionStore.connections.get(connection_name); if (!connection) throw FieldErrors({ -- cgit 1.5.1