mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 12:37:20 +00:00
reworked authentication and permission handling
This commit is contained in:
@@ -104,3 +104,14 @@ export function replaceSimplePlaceholders(str: string, vars: Record<string, any>
|
||||
return key in vars ? vars[key] : match;
|
||||
});
|
||||
}
|
||||
|
||||
export function patternMatch(target: string, pattern: RegExp | string): boolean {
|
||||
if (pattern instanceof RegExp) {
|
||||
return pattern.test(target);
|
||||
} else if (typeof pattern === "string" && pattern.startsWith("/")) {
|
||||
return new RegExp(pattern).test(target);
|
||||
} else if (typeof pattern === "string") {
|
||||
return target.startsWith(pattern);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user