Apply suggestions from code review

Co-authored-by: Jonathan Barrow <jonbarrow1998@gmail.com>
This commit is contained in:
William Oldham
2024-09-24 11:47:07 +01:00
committed by GitHub
parent bf9041b7b8
commit 8f9b17447b
2 changed files with 6 additions and 5 deletions

View File

@@ -96,7 +96,7 @@ if (process.env.PN_ACT_CONFIG_STRIPE_SECRET_KEY) {
};
}
// Add the old config option for backwards compatibility
// * Add the old config option for backwards compatibility
if (config.cdn.subdomain) {
config.domains.cdn.push(config.cdn.subdomain);
}

View File

@@ -3,10 +3,11 @@ import express from 'express';
export function restrictHostnames<TFn extends express.Router>(
allowedHostnames: string[],
fn: TFn
): (req: express.Request, res: express.Response, next: () => void) => void | TFn {
return (req: express.Request, res: express.Response, next: () => void) => {
if (!allowedHostnames.includes(req.hostname)) {
return fn(req, res, next);
): (request: express.Request, response: express.Response, next: () => void) => void | TFn {
return (request: express.Request, response: express.Response, next: () => void) => {
if (!allowedHostnames.includes(request.hostname)) {
return fn(request, response, next);
}
return next();