diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-07 16:46:53 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-07 16:46:53 +0200 |
commit | c24e921b28f9de6d5b5f5fa4ec58acfcaf553251 (patch) | |
tree | 3f6d2dcec40119e9360d626dec09f696ebbf6197 /src | |
parent | npm i @fosscord/server-util@1.3.37 (diff) | |
download | server-c24e921b28f9de6d5b5f5fa4ec58acfcaf553251.tar.xz |
:bug: fix gateway endpoint
Diffstat (limited to 'src')
-rw-r--r-- | src/Server.ts | 5 | ||||
-rw-r--r-- | src/middlewares/RateLimit.ts | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/Server.ts b/src/Server.ts index aa66b5b6..49bb2398 100644 --- a/src/Server.ts +++ b/src/Server.ts @@ -165,7 +165,10 @@ export class FosscordServer extends Server { /CDN_HOST: ".+"/, `CDN_HOST: "${(Config.get().cdn.endpoint || "http://localhost:3003").replace(/https?:/, "")}"` ) - .replace(/GATEWAY_ENDPOINT: ".+"/, `GATEWAY_ENDPOINT: "${Config.get().gateway.endpoint || "ws://localhost:3002"}"`) + .replace( + /GATEWAY_ENDPOINT: ".+"/, + `GATEWAY_ENDPOINT: "${Config.get().gateway.endpoint || process.env.GATEWAY || "ws://localhost:3002"}"` + ) ); }); return super.start(); diff --git a/src/middlewares/RateLimit.ts b/src/middlewares/RateLimit.ts index 89e002df..088c3161 100644 --- a/src/middlewares/RateLimit.ts +++ b/src/middlewares/RateLimit.ts @@ -1,5 +1,5 @@ import { db, MongooseCache, Bucket } from "@fosscord/server-util"; -import { NextFunction, Request, Response } from "express"; +import { IRouterHandler, NextFunction, Request, Response } from "express"; import { getIpAdress } from "../util/ipAddress"; import { API_PREFIX_TRAILING_SLASH } from "./Authentication"; @@ -43,10 +43,10 @@ export default function RateLimit(opts: { error?: boolean; success?: boolean; onylIp?: boolean; -}) { +}): any { Cache.init(); // will only initalize it once - return async (req: Request, res: Response, next: NextFunction) => { + return async (req: Request, res: Response, next: NextFunction): Promise<any> => { const bucket_id = opts.bucket || req.originalUrl.replace(API_PREFIX_TRAILING_SLASH, ""); var user_id = getIpAdress(req); if (!opts.onylIp && req.user_id) user_id = req.user_id; |