-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblocklist.js
More file actions
32 lines (30 loc) · 1.91 KB
/
Copy pathblocklist.js
File metadata and controls
32 lines (30 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Bundled default website blocklist for the standalone extension. Mirrors the
// app's default list (src/main/default-blocklist.js). Once the extension is wired
// to the app, the live list will be pushed in and replace this default.
export const BLOCKED_DOMAINS = [
'facebook.com', 'instagram.com', 'twitter.com', 'x.com', 'tiktok.com',
'snapchat.com', 'reddit.com', 'pinterest.com', 'linkedin.com', 'tumblr.com',
'threads.net', 'bsky.app', 'mastodon.social', 'vk.com', 'weibo.com',
'web.whatsapp.com', 'web.telegram.org', 'discord.com', 'messenger.com',
'quora.com', '4chan.org', 'youtube.com', 'netflix.com', 'twitch.tv',
'hulu.com', 'disneyplus.com', 'primevideo.com', 'hotstar.com', 'max.com',
'dailymotion.com', 'vimeo.com', 'peacocktv.com', '9gag.com', 'imgur.com',
'giphy.com', 'tenor.com', 'boredpanda.com', 'theonion.com',
'news.ycombinator.com', 'buzzfeed.com', 'cnn.com', 'foxnews.com', 'bbc.com',
'dailymail.co.uk', 'nytimes.com', 'amazon.com', 'ebay.com', 'aliexpress.com',
'etsy.com', 'flipkart.com', 'myntra.com', 'walmart.com', 'target.com',
'store.steampowered.com', 'epicgames.com', 'roblox.com', 'miniclip.com',
'poki.com', 'addictinggames.com', 'ign.com', 'gamespot.com', 'kongregate.com',
'chess.com', 'lichess.org', 'spotify.com', 'soundcloud.com', 'pandora.com',
'espn.com', 'cricbuzz.com', 'bleacherreport.com', 'pornhub.com',
'xvideos.com', 'xnxx.com', 'xhamster.com', 'redtube.com', 'onlyfans.com'
]
// A hostname is blocked if it equals a listed domain or is a subdomain of one.
// Normalizes case and a trailing dot. Guards against lookalikes
// (notyoutube.com) and suffix tricks (youtube.com.evil.com).
export function isBlocked(hostname, domains = BLOCKED_DOMAINS) {
if (!hostname || !Array.isArray(domains)) return false
const host = String(hostname).trim().toLowerCase().replace(/\.$/, '')
if (!host) return false
return domains.some((d) => host === d || host.endsWith(`.${d}`))
}