mirror of
https://github.com/Viren070/AIOStreams.git
synced 2025-12-01 23:14:04 +01:00
fix: check for allowed regexes during filtering
This commit is contained in:
@@ -86,7 +86,11 @@ class StreamFilterer {
|
||||
};
|
||||
|
||||
const start = Date.now();
|
||||
const isRegexAllowed = FeatureControl.isRegexAllowed(this.userData);
|
||||
const isRegexAllowed = FeatureControl.isRegexAllowed(this.userData, [
|
||||
...(this.userData.excludedRegexPatterns ?? []),
|
||||
...(this.userData.requiredRegexPatterns ?? []),
|
||||
...(this.userData.includedRegexPatterns ?? []),
|
||||
]);
|
||||
|
||||
let requestedMetadata: TMDBMetadataResponse | undefined;
|
||||
if (this.userData.titleMatching?.enabled && TYPES.includes(type as any)) {
|
||||
|
||||
@@ -19,8 +19,12 @@ class StreamPrecomputer {
|
||||
|
||||
public async precompute(streams: ParsedStream[]) {
|
||||
const preferredRegexPatterns =
|
||||
FeatureControl.isRegexAllowed(this.userData) &&
|
||||
this.userData.preferredRegexPatterns
|
||||
FeatureControl.isRegexAllowed(
|
||||
this.userData,
|
||||
this.userData.preferredRegexPatterns?.map(
|
||||
(pattern) => pattern.pattern
|
||||
) ?? []
|
||||
) && this.userData.preferredRegexPatterns
|
||||
? await Promise.all(
|
||||
this.userData.preferredRegexPatterns.map(async (pattern) => {
|
||||
return {
|
||||
|
||||
@@ -66,7 +66,15 @@ export class FeatureControl {
|
||||
return this._allowedRegexPatterns;
|
||||
}
|
||||
|
||||
public static isRegexAllowed(userData: UserData) {
|
||||
public static isRegexAllowed(userData: UserData, regexes?: string[]) {
|
||||
if (regexes && regexes.length > 0) {
|
||||
const areAllRegexesAllowed = regexes.every((regex) =>
|
||||
this.allowedRegexPatterns.patterns.includes(regex)
|
||||
);
|
||||
if (areAllRegexesAllowed) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
switch (this.regexFilterAccess) {
|
||||
case 'trusted':
|
||||
return userData.trusted ?? false;
|
||||
|
||||
Reference in New Issue
Block a user