mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 19:39:11 +00:00
feat(api): add wildcard fallback host filtering for stage/dev
This commit is contained in:
parent
6edfe7455f
commit
3388e091c1
1 changed files with 9 additions and 1 deletions
|
@ -203,5 +203,13 @@ export const getQuery = (request: Request): { [x: string]: string } => {
|
|||
};
|
||||
|
||||
export const isAllowedCallbackHost = (host: string): boolean => {
|
||||
return host === apiPublicURI || allowedCallbackHosts.includes(host);
|
||||
return (
|
||||
host === apiPublicURI ||
|
||||
allowedCallbackHosts.includes(host) ||
|
||||
allowedCallbackHosts
|
||||
.filter((callbackHost) => callbackHost.includes('*'))
|
||||
.find((wildcard) =>
|
||||
new RegExp(wildcard.replace('*', '[a-z0-9-]+')).test(host)
|
||||
) !== null
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue