From 3fb9286e47b258458b353688b8e7fd05d1aa300b Mon Sep 17 00:00:00 2001 From: Ajay Date: Fri, 6 Jun 2025 23:46:07 -0400 Subject: [PATCH] Add action type attribute --- src/components/options/AdvancedSkipOptionsComponent.tsx | 6 +++++- src/utils/skipRule.ts | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/options/AdvancedSkipOptionsComponent.tsx b/src/components/options/AdvancedSkipOptionsComponent.tsx index 9011956a..5daf0373 100644 --- a/src/components/options/AdvancedSkipOptionsComponent.tsx +++ b/src/components/options/AdvancedSkipOptionsComponent.tsx @@ -3,7 +3,7 @@ import * as CompileConfig from "../../../config.json"; import Config from "../../config"; import { AdvancedSkipRuleSet, SkipRuleAttribute, SkipRuleOperator } from "../../utils/skipRule"; -import { CategorySkipOption } from "../../types"; +import { ActionType, ActionTypes, CategorySkipOption } from "../../types"; let configSaveTimeout: NodeJS.Timeout | null = null; @@ -140,6 +140,10 @@ function compileConfig(config: string): AdvancedSkipRuleSet[] | null { && operator === SkipRuleOperator.Equal && !CompileConfig.categoryList.includes(value as string)) { return null; // Invalid category value + } else if (attribute === SkipRuleAttribute.ActionType + && operator === SkipRuleOperator.Equal + && !ActionTypes.includes(value as ActionType)) { + return null; // Invalid category value } else if (attribute === SkipRuleAttribute.Source && operator === SkipRuleOperator.Equal && !["local", "youtube", "autogenerated", "server"].includes(value as string)) { diff --git a/src/utils/skipRule.ts b/src/utils/skipRule.ts index a6514ac5..a755349f 100644 --- a/src/utils/skipRule.ts +++ b/src/utils/skipRule.ts @@ -15,6 +15,7 @@ export enum SkipRuleAttribute { EndTimePercent = "endTimePercent", DurationPercent = "durationPercent", Category = "category", + ActionType = "actionType", Description = "description", Source = "source" } @@ -86,6 +87,8 @@ function getSkipRuleValue(segment: SponsorTime | VideoLabelsCacheData, rule: Adv } case SkipRuleAttribute.Category: return segment.category; + case SkipRuleAttribute.ActionType: + return (segment as SponsorTime).actionType; case SkipRuleAttribute.Description: return (segment as SponsorTime).description || ""; case SkipRuleAttribute.Source: