11import * as coreConfig from '../core/config'
2- import * as grade from '../core/grade'
3- import * as notification from '../core/notification'
4- import * as i18n from '../core/i18n'
52import message from '../core/message'
63import * as http from '../core/http'
74import * as logger from '../core/logger'
85import { Baize } from '../baize/baize'
9- import { getHost } from '../core/utils'
106import { UrlParse } from '../baize/lib/urlparse'
117import { tabsBlockCount , updateBadgeText } from '../background/adguardEngine'
128import * as statistics from '../background/statistics'
139
1410let heuristicsEnabled : boolean = false
1511
12+ let allowList : string [ ] = [ ]
13+
1614let modelVersion = "1.0.0"
1715
1816let modelUrl = `https://cdn.cloudopt.net/baize/${ modelVersion } /baize_model.json`
@@ -21,6 +19,7 @@ let baize = new Baize()
2119
2220async function refreshConfig ( ) : Promise < void > {
2321 const config = await coreConfig . get ( )
22+ allowList = config . allowList
2423 heuristicsEnabled = config . safeHeuristics
2524}
2625
@@ -47,7 +46,10 @@ export async function initialize() {
4746 if ( urlparse . getRootDomain ( ) == "cloudopt.net" ) {
4847 return
4948 }
50- if ( details . initiator && details . initiator . startsWith ( "chrome-extension://" ) ) {
49+ if ( details . initiator && details . initiator . startsWith ( "chrome-extension://" ) ) {
50+ return
51+ }
52+ if ( allowList . indexOf ( new UrlParse ( details . initiator ) . getDomain ( ) ) > - 1 ) {
5153 return
5254 }
5355 let requestThirdParty = 1
0 commit comments