Skip to content

重写UrlMatch#637

Merged
CodFrm merged 76 commits intoscriptscat:mainfrom
cyfung1031:urlmatcher01a
Aug 23, 2025
Merged

重写UrlMatch#637
CodFrm merged 76 commits intoscriptscat:mainfrom
cyfung1031:urlmatcher01a

Conversation

@cyfung1031
Copy link
Copy Markdown
Collaborator

@cyfung1031 cyfung1031 commented Aug 18, 2025

重写了
现在不用依赖 RegEx
能够更直接利用 UserScript API 做注入
当然机制上还是会跑 getPageScriptUuidByUrl

测试都加多很多
不会有问题的
也考虑了很多过往版本没考虑的部份

TM的 @include 只支持 glob 的 *
这个是按照UserScript API的设计,不但支持 glob *, 还支持 glob ?

详细看这个
https://developer.chrome.com/docs/extensions/reference/manifest/content-scripts?hl=en

(注意: 不要搞乱 @match@include 跟 "matches"和"include_globs" 。 不能把网页的范例直接抄到单元测试跑。 getApiMatchesAndGlobs 就是处理这个)


glob 的部份本来就是为 GM TM 而加的
应尽量利用,不需要用RegEx.
但MV3的设计,除了glob *, 还有glob ?
这个需要留意。根据TM文档,glob ? 没有提及
可视作新功能

https://developer.chrome.com/docs/extensions/reference/manifest/content-scripts?hl=zh-CN#match-urls

Screenshot 2025-08-18 at 20 51 23

checkUrlMatch

  • 检查@match @include @exclude 是否按照MV3的 match pattern
  • https://www.google.com/* 会分析成 "https", "www.google.com", "*"
  • *://*.google.com/ 会分析成 "*", ".google.com", ""

globSplit

  • *hello****world* 会变成 *hello*world*
  • *hello****?????world* 会变成 *hello*world* (理论上MV3的处理可支持这个*?,但脚本的代码部份复杂,不考虑)

metaUMatchAnalyze

  • 核心部份。跟以往不同,直接把 ["@match xxxx", "@include xxxx", "@exclude xxxx"] 做拆件
  • 会解析出 ruleType 1 2 3 4 5 6
  • ruleType 1 3 5 是 MV3 match pattern, MV3 includeGlob pattern, TM RegEx pattern (@include)
  • ruleType 2 4 6 是 MV3 exclude_match pattern, MV3 excludeGlob pattern, TM RegEx pattern (@exlcude)

isUrlMatch

  • 根据 ruleType 呼叫 isUrlMatchPattern, isUrlMatchGlob, isUrlMatchRegEx
  • 裡面有一个简单cache. 堆到512个就会清空再cache. 只是为了效能提升

isUrlMatchPattern

  • 依据 MV3文档 写成
  • 部份细节没有实现(不需要实现)

isUrlMatchGlob

  • 不呼叫 new URL, RegEx. 完全使用基础函数, 高效能

isUrlMatchRegEx

  • 最慢,呼叫RegEx

addMatchesToGlobs

  • 因为 MV3 的 match 和 includeGlob 设计问题,如果使用glob的话,match要全匹配,因为match的部份会转为glob
  • 例如本来5个match 跟 5个glob, 就会转成 1个match *://*/* 跟 10个glob

isAllUrlsRequired

  • 如果glob需要匹配file, *://*/* 要转成 <all_urls>

getApiMatchesAndGlobs

  • 针对 @match @include 转化为 MV3 的 match 和 includeGlob

注意点

参考: https://www.tampermonkey.net/documentation.php?locale=en
参考: https://wiki.greasespot.net/Include_and_exclude_rules

@include@excludecase-insensitive

  • TM / GM文档没有指明 @include@exclude 中,glob pattern和regex pattern 的case-insensitive 的行为。
  • 为了更好利用MV3 API, 不会视之为标準
  • (同时也不鼓励使用者过份利用@include @exclude) 这会与TM有差异。
  • SC旧版,VM,GM的glob pattern也是case-sensitive. 改成regex的话无法利用原生API注入
  • 与 SC旧版 保持一致

@include 自动对应成 @match

  • TM 文档写得很瞹昧,@include 的实际行为既非match pattern也非glob pattern
  • GM 没有提及对应
  • 这个PR处理是,如果可以匹配成 match pattern 就会当作 match pattern 处理。( match pattern 是推荐的, include 不是)
  • 大小写转换以外,*.developer.chrome.com 等写法会因为视作match pattern而能匹配 developer.chrome.com 而 TM只当作glob pattern 因此不会匹配 developer.chrome.com
  • 更正:PR已修正,避免与TM有差异

match pattern的port问题

  • MDN 文档清楚列明不会视port为match pattern
  • Chrome 文档 有提及 You can also use http://*:*/* to match localhost, IP addresses, and any port. 但没有清楚写出 port 的部份
  • 这个PR处理是,按MDN定义,不包含port, 而转用 glob pattern 来做 @include @exclude
  • 因此SC的话不能放在 @match, 而要放在 @include。这会与TM有差异。
  • 更正:PR已修正,避免与TM有差异

scheme 不对应 about

scheme 不对应 unmht

不对应 tld ( .tld/ 会改为 .??*/ )

支持glob ?

  • 由於这是基於MV3而写,故跟API处理一样支持glob ?
  • 反过来 @include@exclude? 不会被视为 query ?

regex pattern 支持 flag

  • @include /^https?://*GOOGLE*$/i 这个写法可以
  • 但不会跟 TM 一样预设 case-insensitive
  • 更正:PR已修正,避免与TM有差异 (预设case-insensitive, 除非 /^https?://*GOOGLE*$/m 这样宣告 )

与VM的差异

  • https://violentmonkey.github.io/api/matching/
  • 没有 @exclude-match. SC自动检查@exclude对应. 由於是排除,不用像@match那样做严格控制
  • @match 不支持 http*:// (在match pattern 定义裡, http*://等价於 *://* )
  • @match 不支持 www.google.* (支持的话其实是违反@match原意)
  • @match 不支持 . tld (支持的话其实是违反@match原意)
  • * 严格跟随 glob 原则,如要至少一个,需要?*。因此按照MV3标準, https://www.google.com/* 会匹对 https://www.google.com/。此和TM一致
  • 更正:PR已修正,避免与TM&VM有差异

往后应该可以在脚本猫的界面显示出,转化后的 match pattern, glob pattern, 和 regex. 这样用家在使用/开发时就能清晰些

Comment thread src/app/service/service_worker/runtime.ts Outdated
Comment thread src/app/service/service_worker/runtime.ts Outdated
Comment thread src/app/service/service_worker/runtime.ts Outdated
Comment thread src/app/service/service_worker/runtime.ts Outdated
Comment thread src/app/service/service_worker/types.ts Outdated
Comment thread src/pkg/utils/url_matcher.ts Outdated
Comment thread src/pkg/utils/url_matcher.ts Outdated
Comment thread src/pkg/utils/url_matcher.ts Outdated
Comment thread src/pkg/utils/match.test.ts
Comment thread src/pkg/utils/url_matcher.ts
@CodFrm
Copy link
Copy Markdown
Member

CodFrm commented Aug 18, 2025

我将原来的单元测试补充了过来,似乎有很多特殊的情况没有支持

Comment thread src/pkg/utils/match.test.ts Outdated
@CodFrm
Copy link
Copy Markdown
Member

CodFrm commented Aug 18, 2025

与TM产生差异是不能接受的,因为大部分开发者是使用TM进行开发,如果不能包容TM,那么总会有用户来询问为什么无法使用XX脚本,虽然我的期待也是能够让开发者们遵循 Match patterns与 globs 的规范,但是历史我们无法改变,只能慢慢纠正,至少在脚本猫没有成为绝对的主流之前,我们无能为力

@cyfung1031
Copy link
Copy Markdown
Collaborator Author

cyfung1031 commented Aug 18, 2025

与TM产生差异是不能接受的,因为大部分开发者是使用TM进行开发,如果不能包容TM,那么总会有用户来询问为什么无法使用XX脚本,虽然我的期待也是能够让开发者们遵循 Match patterns与 globs 的规范,但是历史我们无法改变,只能慢慢纠正,至少在脚本猫没有成为绝对的主流之前,我们无能为力

有差異,但兼容

写法都是参考TM文档
你可以看一下哪些脚本有神奇写法
然后放进测试,我再改一下吧

@CodFrm
Copy link
Copy Markdown
Member

CodFrm commented Aug 18, 2025

我已经修改了单元测试,很多写法没有文档写明,但是总会有神奇脚本来与我反馈,能查到这么多资料,也是辛苦你了

另外我增加了一个addMatch用于区分 match 和 include

@cyfung1031
Copy link
Copy Markdown
Collaborator Author

cyfung1031 commented Aug 18, 2025

@CodFrm

#637 (comment)_

已測試,TM不支持 @match *
為何SC要支持?

@cyfung1031
Copy link
Copy Markdown
Collaborator Author

CustomSequencer 是為了讓 regex_to_glob.test.ts 的測試跑在 url_matcher.test.ts

@CodFrm
Copy link
Copy Markdown
Member

CodFrm commented Aug 21, 2025

@cyfung1031 单元测试的顺序会有什么影响吗?按理来说应该是独立的

@cyfung1031
Copy link
Copy Markdown
Collaborator Author

@cyfung1031 单元测试的顺序会有什么影响吗?按理来说应该是独立的

没有。只是我在修改 regex_to_glob 时,发现他会影响 url_matcher
所以在想如果 单元测试是 regex_to_glob 放前,就可以先看到 regex_to_glob 的问题
基本上先 regex_to_glob 没问题后,才看 url_matcher 的单元测试吧

其他单元测试不清楚。不过我相信也有这种依存的关係吧


不做这个 CustomSequencer 也可以的。完全对这个PR没影响

@CodFrm
Copy link
Copy Markdown
Member

CodFrm commented Aug 21, 2025

@cyfung1031 如果不需要就移除吧

@cyfung1031
Copy link
Copy Markdown
Collaborator Author

@cyfung1031 如果不需要就移除吧

移除了
有需要再另外PR

@cyfung1031
Copy link
Copy Markdown
Collaborator Author

@CodFrm 你新加的 react/jsx-no-literals lint我不在這處理了

/home/runner/work/scriptcat/scriptcat/src/pages/components/GMApiSetting/index.tsx
[16](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:17)
Warning:   39:20  warning  Missing JSX expression container around literal string: "CAT_fileStorage"  react/jsx-no-literals
[17](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:18)

[18](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:19)
/home/runner/work/scriptcat/scriptcat/src/pages/components/LogLabel/index.tsx
[19](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:20)
Warning:   51:34  warning  Missing JSX expression container around literal string: "="   react/jsx-no-literals
[20](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:21)
Warning:   52:35  warning  Missing JSX expression container around literal string: "=~"  react/jsx-no-literals
[21](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:22)
Warning:   53:35  warning  Missing JSX expression container around literal string: "!="  react/jsx-no-literals
[22](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:23)
Warning:   54:35  warning  Missing JSX expression container around literal string: "!~"  react/jsx-no-literals
[23](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:24)

[24](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:25)
/home/runner/work/scriptcat/scriptcat/src/pages/components/layout/MainLayout.tsx
[25](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:26)
Warning:    70:37  warning  Missing JSX expression container around literal string: ":"          react/jsx-no-literals
[26](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:27)
Warning:   213:60  warning  Missing JSX expression container around literal string: "ScriptCat"  react/jsx-no-literals
[27](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:28)
Warning:   278:36  warning  Missing JSX expression container around literal string: "Light"      react/jsx-no-literals
[28](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:29)
Warning:   281:37  warning  Missing JSX expression container around literal string: "Dark"       react/jsx-no-literals
[29](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:30)

[30](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:31)
/home/runner/work/scriptcat/scriptcat/src/pages/components/layout/Sider.tsx
[31](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:32)
Warning:   127:35  warning  Missing JSX expression container around literal string: "GitHub"  react/jsx-no-literals
[32](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:33)

[33](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:34)
/home/runner/work/scriptcat/scriptcat/src/pages/confirm/App.tsx
[34](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:35)
Warning:   68:18  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[35](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:36)
Warning:   74:26  warning  Missing JSX expression container around literal string: "("  react/jsx-no-literals
[36](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:37)
Warning:   74:36  warning  Missing JSX expression container around literal string: ")"  react/jsx-no-literals
[37](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:38)

[38](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:39)
/home/runner/work/scriptcat/scriptcat/src/pages/import/App.tsx
[39](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:40)
Warning:    44:26  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[40](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:41)
Warning:    47:31  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[41](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:42)
Warning:    50:26  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[42](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:43)
Warning:    53:29  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[43](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:44)
Warning:   284:44  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[44](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:45)
Warning:   289:42  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[45](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:46)
Warning:   289:59  warning  Missing JSX expression container around literal string: "/"  react/jsx-no-literals
[46](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:47)
Warning:   292:47  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[47](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:48)
Warning:   297:45  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[48](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:49)
Warning:   297:62  warning  Missing JSX expression container around literal string: "/"  react/jsx-no-literals
[49](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:50)

[50](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:51)
/home/runner/work/scriptcat/scriptcat/src/pages/install/App.tsx
[51](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:52)
Warning:   470:30  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[52](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:53)
Warning:   484:30  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[53](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:54)

[54](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:55)
/home/runner/work/scriptcat/scriptcat/src/pages/options/routes/ScriptList.tsx
[55](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:56)
Warning:   463:47  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[56](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:57)
Warning:   498:39  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[57](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:58)
Warning:   808:59  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[58](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:59)
Warning:   953:62  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[59](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:60)

[60](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:61)
/home/runner/work/scriptcat/scriptcat/src/pages/options/routes/SubscribeList.tsx
[61](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:62)
Warning:   186:37  warning  Missing JSX expression container around literal string: ":"  react/jsx-no-literals
[62](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:63)

[63](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:64)
/home/runner/work/scriptcat/scriptcat/src/pages/popup/App.tsx
[64](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:65)
Warning:   277:39  warning  Missing JSX expression container around literal string: "ScriptCat"  react/jsx-no-literals
[65](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:66)
Warning:   317:55  warning  Missing JSX expression container around literal string: "GitHub"     react/jsx-no-literals
[66](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:67)

[70](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:71)
/home/runner/work/scriptcat/scriptcat/tests/pages/options/MainLayout.test.tsx
[71](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:72)
Warning:   17:43  warning  Missing JSX expression container around literal string: "Options Content"  react/jsx-no-literals
[72](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:73)
Warning:   59:51  warning  Missing JSX expression container around literal string: "Test Content"     react/jsx-no-literals
[73](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:74)
Warning:   83:51  warning  Missing JSX expression container around literal string: "Content"          react/jsx-no-literals
[74](https://github.com/scriptscat/scriptcat/actions/runs/17143000557/job/48633926436?pr=637#step:6:75)
Warning:   94:63  warning  Missing JSX expression container around literal string: "Content"          react/jsx-no-literals

@CodFrm
Copy link
Copy Markdown
Member

CodFrm commented Aug 22, 2025

@cyfung1031 lint问题我处理好了

@cyfung1031
Copy link
Copy Markdown
Collaborator Author

有没有需要我修改的部份?
我明白 regexToGlob 是有点复杂。也只是用来做中间处理。复杂的还是会退回 *://*/*
regexToGlob 的单元测试都很齐存了。反正 UserScriptAPI 能使用的 glob 就只有 * 和 ?
呼叫 regexToGlob 前,已经做了 new RegExp 所以实际上 regexToGlob 连异常处理都不用

@CodFrm
Copy link
Copy Markdown
Member

CodFrm commented Aug 22, 2025

我还没有重新review,已经全部好了吗?

@cyfung1031
Copy link
Copy Markdown
Collaborator Author

cyfung1031 commented Aug 22, 2025

我还没有重新review,已经全部好了吗?

全部好了呀。暂时先这样。不然单一PR内容会过多
(比如说,我想把脚本代码转pattern的结果都储存起来。这样每次打开瀏览器就不用再跑一堆转换。但先不搞这个啦。至少这个PR完了再搞)
(比如说,我想把脚本代码转pattern的结果都显示在设定页面,这样就知道每个脚本实际转出来是什麼。用户清楚,开发除错容易。但先不搞这个啦。至少这个PR完了再搞)
这个PR需要的部份都全写了呀。连注释什麼都写满了

我已经是在build了实际使用我那200个脚本
我连这个都安装了测试。都能配对没问题
https://greasyfork.org/zh-CN/scripts/395575-b%E7%AB%99%E5%B0%81%E9%9D%A2%E8%8E%B7%E5%8F%96/code

当然没有实际用logger 去看每一个脚本是不是根据 mv3 userscript api 的 pattern 做注入再做urlMatch,还是都fallback了到全部页面再做urlMatch
但跑起来的话肯定是没问题

@cyfung1031
Copy link
Copy Markdown
Collaborator Author

cyfung1031 commented Aug 22, 2025

自定义排除那个没显示在popup.
找到原因再commit. 不过你可以先review吧


找到了
因為用 exclude 加到 scriptCustomizeMatch 而不是 include.
所以 const excludeScriptUuid = this.scriptCustomizeMatch.urlMatch(url!); 匹配不到

我看看到底怎樣改較好吧


selfMetadata 的代碼設計有問題。會針對這個改

@CodFrm CodFrm requested a review from Copilot August 23, 2025 07:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR rewrites the URL matching system by replacing the regex-based UrlMatch implementation with a new one based on MV3 UserScript API patterns. The changes provide better compatibility with browser extension APIs and improve support for glob patterns while maintaining consistency with TamperMonkey behavior.

  • Implements a new URL matcher that supports MV3 match patterns, glob patterns (including ? wildcards), and regex patterns
  • Adds comprehensive regex-to-glob conversion functionality with support for complex patterns like alternations and quantifiers
  • Replaces the old regex-based matching system with rule-based matching that properly handles inclusion/exclusion logic

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/pkg/utils/url_matcher.ts Core URL matching implementation with support for MV3 patterns, globs, and regex
src/pkg/utils/regex_to_glob.ts Comprehensive regex-to-glob conversion utility with support for complex patterns
src/pkg/utils/match.ts Simplified URL matching class using the new rule-based system
src/pkg/utils/url_matcher.test.ts Extensive test suite for URL pattern matching functionality
src/pkg/utils/regex_to_glob.test.ts Comprehensive test coverage for regex-to-glob conversion
src/pkg/utils/match.test.ts Updated tests for the new URL matching system
src/pkg/utils/utils.ts Added utility functions for blacklist handling and random number generation
src/pages/options/routes/Setting.tsx Updated blacklist validation to use new matching system
src/pages/components/layout/MainLayout.tsx Fixed file URL pattern format
src/pages/components/ScriptMenuList/index.tsx Updated exclude logic to use new rule-based matching

Comment thread src/pkg/utils/url_matcher.ts
Comment thread src/pkg/utils/match.ts
@CodFrm CodFrm merged commit 5b01c10 into scriptscat:main Aug 23, 2025
3 checks passed
@cyfung1031
Copy link
Copy Markdown
Collaborator Author

cyfung1031 commented Aug 23, 2025

呀,merge了
不过也好
因为我正在烦恼应该如何提PR
我用issue形式提交就好了

之後提PR解決
#652

@cyfung1031 cyfung1031 deleted the urlmatcher01a branch October 4, 2025 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants