Skip to content

Commit c410755

Browse files
author
Andy
committed
feat: Baize no longer blocks websites on the safe allow list
1 parent 89618ab commit c410755

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/background/heuristics.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
import * 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'
52
import message from '../core/message'
63
import * as http from '../core/http'
74
import * as logger from '../core/logger'
85
import { Baize } from '../baize/baize'
9-
import { getHost } from '../core/utils'
106
import { UrlParse } from '../baize/lib/urlparse'
117
import { tabsBlockCount, updateBadgeText } from '../background/adguardEngine'
128
import * as statistics from '../background/statistics'
139

1410
let heuristicsEnabled: boolean = false
1511

12+
let allowList: string[] = []
13+
1614
let modelVersion = "1.0.0"
1715

1816
let modelUrl = `https://cdn.cloudopt.net/baize/${modelVersion}/baize_model.json`
@@ -21,6 +19,7 @@ let baize = new Baize()
2119

2220
async 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

Comments
 (0)