Skip to content

Commit 5d8fdcf

Browse files
committed
feat: add checking func to discard all CDN domains owned by Ad-Shield
1 parent 57f8f26 commit 5d8fdcf

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

builder/source/references/filterslists/ADG.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { HTTPS2Request } from '@typescriptprime/securereq'
22
import * as AGTree from '@adguard/agtree'
3+
import { AdShieldCDNDomains } from './keywords.js'
34

45
const AGBaseFilterListSpecificURL = 'https://adguardteam.github.io/AdguardFilters/BaseFilter/sections/specific.txt'
56
const AGBaseFilterListAdShieldKeys = {
@@ -43,7 +44,7 @@ export async function IndexAdShieldDomainsFromAG(): Promise<Set<string>> {
4344
} catch {
4445
return false
4546
}
46-
return true
47+
return !AdShieldCDNDomains.has(Domain)
4748
})
4849

4950
return new Set(FilteredDomains)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { HTTPS2Request } from '@typescriptprime/securereq'
2+
3+
export const AdShieldCDNDomains: Set<string> = new Set([
4+
'html-load.com',
5+
'css-load.com',
6+
'ads.adthrive.com'
7+
])
8+
9+
export async function IsAdShieldCDNDomain(Domain: string): Promise<boolean> {
10+
const AdShieldCDNCheckResponse = await HTTPS2Request(new URL(`https://${Domain}/`), { ExpectedAs: 'String' }).catch(() => false)
11+
return typeof AdShieldCDNCheckResponse !== 'boolean' && AdShieldCDNCheckResponse.StatusCode === 200 &&
12+
AdShieldCDNCheckResponse.Body.includes('This domain is a part of the <a href="https://www.ad-shield.io/">Ad-Shield</a> (ad-shield.io) platform,')
13+
}

0 commit comments

Comments
 (0)