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() {
1313 return avai ;
1414}
1515
16+ export const GlobalBlackList = [ "edge://*" , "chrome://*" ] ;
1617export async function checkBlackWhiteList ( script , url = null ) {
1718 if ( ! url ) {
1819 url = await getCurrentURL ( ) ;
@@ -23,12 +24,15 @@ export async function checkBlackWhiteList(script, url = null) {
2324 hasWhiteList = w ?. length > 0 ,
2425 hasBlackList = b ?. length > 0 ,
2526 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 ;
2730
2831 let willRun =
29- ( ! hasWhiteList && ! hasBlackList ) ||
30- ( hasWhiteList && inWhiteList ) ||
31- ( hasBlackList && ! inBlackList ) ;
32+ ! inGlobalBlackList &&
33+ ( ( ! hasWhiteList && ! hasBlackList ) ||
34+ ( hasWhiteList && inWhiteList ) ||
35+ ( hasBlackList && ! inBlackList ) ) ;
3236
3337 return willRun ;
3438}
Original file line number Diff line number Diff line change @@ -2,7 +2,10 @@ import { allScripts } from "../scripts/index.js";
22import { checkForUpdate } from "./helpers/checkForUpdate.js" ;
33import { getFlag , t , toggleLang } from "./helpers/lang.js" ;
44import { viewScriptSource , runScriptInCurrentTab } from "./helpers/utils.js" ;
5- import { checkBlackWhiteList } from "./helpers/scriptHelpers.js" ;
5+ import {
6+ checkBlackWhiteList ,
7+ GlobalBlackList ,
8+ } from "./helpers/scriptHelpers.js" ;
69import { openModal } from "./helpers/modal.js" ;
710import {
811 activeTabIdSaver ,
@@ -242,7 +245,7 @@ async function runScript(script) {
242245 runScriptInCurrentTab ( script . func ) ;
243246 } else {
244247 let w = script . whiteList ?. join ( ", " ) ;
245- let b = script . blackList ?. join ( ", " ) ;
248+ let b = [ ... script . blackList , ... GlobalBlackList ] ?. join ( ", " ) ;
246249
247250 openModal (
248251 t ( {
You can’t perform that action at this time.
0 commit comments