File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ export async function getAvailableScripts() {
13
13
return avai ;
14
14
}
15
15
16
+ export const GlobalBlackList = [ "edge://*" , "chrome://*" ] ;
16
17
export async function checkBlackWhiteList ( script , url = null ) {
17
18
if ( ! url ) {
18
19
url = await getCurrentURL ( ) ;
@@ -23,12 +24,15 @@ export async function checkBlackWhiteList(script, url = null) {
23
24
hasWhiteList = w ?. length > 0 ,
24
25
hasBlackList = b ?. length > 0 ,
25
26
inWhiteList = w ?. findIndex ( ( _ ) => isUrlMatchPattern ( url , _ ) ) >= 0 ,
26
- inBlackList = b ?. findIndex ( ( _ ) => isUrlMatchPattern ( url , _ ) ) >= 0 ;
27
+ inBlackList = b ?. findIndex ( ( _ ) => isUrlMatchPattern ( url , _ ) ) >= 0 ,
28
+ inGlobalBlackList =
29
+ GlobalBlackList . findIndex ( ( _ ) => isUrlMatchPattern ( url , _ ) ) >= 0 ;
27
30
28
31
let willRun =
29
- ( ! hasWhiteList && ! hasBlackList ) ||
30
- ( hasWhiteList && inWhiteList ) ||
31
- ( hasBlackList && ! inBlackList ) ;
32
+ ! inGlobalBlackList &&
33
+ ( ( ! hasWhiteList && ! hasBlackList ) ||
34
+ ( hasWhiteList && inWhiteList ) ||
35
+ ( hasBlackList && ! inBlackList ) ) ;
32
36
33
37
return willRun ;
34
38
}
Original file line number Diff line number Diff line change @@ -2,7 +2,10 @@ import { allScripts } from "../scripts/index.js";
2
2
import { checkForUpdate } from "./helpers/checkForUpdate.js" ;
3
3
import { getFlag , t , toggleLang } from "./helpers/lang.js" ;
4
4
import { viewScriptSource , runScriptInCurrentTab } from "./helpers/utils.js" ;
5
- import { checkBlackWhiteList } from "./helpers/scriptHelpers.js" ;
5
+ import {
6
+ checkBlackWhiteList ,
7
+ GlobalBlackList ,
8
+ } from "./helpers/scriptHelpers.js" ;
6
9
import { openModal } from "./helpers/modal.js" ;
7
10
import {
8
11
activeTabIdSaver ,
@@ -242,7 +245,7 @@ async function runScript(script) {
242
245
runScriptInCurrentTab ( script . func ) ;
243
246
} else {
244
247
let w = script . whiteList ?. join ( ", " ) ;
245
- let b = script . blackList ?. join ( ", " ) ;
248
+ let b = [ ... script . blackList , ... GlobalBlackList ] ?. join ( ", " ) ;
246
249
247
250
openModal (
248
251
t ( {
You can’t perform that action at this time.
0 commit comments