From c7a8883201ca4d9966a34125b3698a9c284c227f Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Thu, 18 Aug 2022 14:56:13 +0300 Subject: [PATCH] cherry-pick: 4795-bilibili Updates #4795. * commit 'e6ebb8efef4430c48b06469ba566349bba3d9856': filtering: fmt filtering: add Bilibili and Weibo domains filtering: add Bilibili service --- CHANGELOG.md | 5 ++ client/src/components/ui/Icons.js | 4 ++ client/src/helpers/constants.js | 4 ++ internal/filtering/blocked.go | 96 ++++++++++++++++++++++++------- 4 files changed, 89 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12118439..0587a04b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,11 +20,16 @@ and this project adheres to - Weaker cipher suites that use the CBC (cipher block chaining) mode of operation have been disabled ([#2993]). +### Added + +- Bilibili service blocking ([#4795]). + ### Deprecated - Go 1.18 support. v0.109.0 will require at least Go 1.19 to build. [#2993]: https://github.com/AdguardTeam/AdGuardHome/issues/2993 +[#4795]: https://github.com/AdguardTeam/AdGuardHome/issues/4795 diff --git a/client/src/components/ui/Icons.js b/client/src/components/ui/Icons.js index e2186529..47e71f59 100644 --- a/client/src/components/ui/Icons.js +++ b/client/src/components/ui/Icons.js @@ -408,6 +408,10 @@ const Icons = () => ( + + + + ); diff --git a/client/src/helpers/constants.js b/client/src/helpers/constants.js index 5e9e6ce8..a5c1d2ee 100644 --- a/client/src/helpers/constants.js +++ b/client/src/helpers/constants.js @@ -211,6 +211,10 @@ export const SERVICES = [ id: 'amazon', name: 'Amazon', }, + { + id: 'bilibili', + name: 'Bilibili', + }, { id: 'cloudflare', name: 'CloudFlare', diff --git a/internal/filtering/blocked.go b/internal/filtering/blocked.go index 48996a6d..665b62d4 100644 --- a/internal/filtering/blocked.go +++ b/internal/filtering/blocked.go @@ -20,8 +20,11 @@ type svc struct { // client/src/helpers/constants.js // client/src/components/ui/Icons.js var serviceRulesArray = []svc{{ - name: "whatsapp", - rules: []string{"||whatsapp.net^", "||whatsapp.com^"}, + name: "whatsapp", + rules: []string{ + "||whatsapp.com^", + "||whatsapp.net^", + }, }, { name: "facebook", rules: []string{ @@ -38,8 +41,13 @@ var serviceRulesArray = []svc{{ "||fb.watch^", }, }, { - name: "twitter", - rules: []string{"||twitter.com^", "||twttr.com^", "||t.co^", "||twimg.com^"}, + name: "twitter", + rules: []string{ + "||t.co^", + "||twimg.com^", + "||twitter.com^", + "||twttr.com^", + }, }, { name: "youtube", rules: []string{ @@ -53,8 +61,13 @@ var serviceRulesArray = []svc{{ "||ytimg.com^", }, }, { - name: "twitch", - rules: []string{"||twitch.tv^", "||ttvnw.net^", "||jtvnw.net^", "||twitchcdn.net^"}, + name: "twitch", + rules: []string{ + "||jtvnw.net^", + "||ttvnw.net^", + "||twitch.tv^", + "||twitchcdn.net^", + }, }, { name: "netflix", rules: []string{ @@ -216,41 +229,73 @@ var serviceRulesArray = []svc{{ "||bytedance.map.fastly.net^", "||douyin.com^", "||tiktokv.com^", + "||toutiaovod.com^", + "||douyincdn.com^", }, }, { - name: "vimeo", - rules: []string{"||vimeo.com^", "||vimeocdn.com^", "*vod-adaptive.akamaized.net^"}, + name: "vimeo", + rules: []string{ + "*vod-adaptive.akamaized.net^", + "||vimeo.com^", + "||vimeocdn.com^", + }, }, { - name: "pinterest", - rules: []string{"||pinterest.*^", "||pinimg.com^"}, + name: "pinterest", + rules: []string{ + "||pinimg.com^", + "||pinterest.*^", + }, }, { name: "imgur", rules: []string{"||imgur.com^"}, }, { - name: "dailymotion", - rules: []string{"||dailymotion.com^", "||dm-event.net^", "||dmcdn.net^"}, + name: "dailymotion", + rules: []string{ + "||dailymotion.com^", + "||dm-event.net^", + "||dmcdn.net^", + }, }, { name: "qq", rules: []string{ // Block qq.com and subdomains excluding WeChat's domains. "||qq.com^$denyallow=wx.qq.com|weixin.qq.com", "||qqzaixian.com^", + "||qq-video.cdn-go.cn^", + "||url.cn^", }, }, { - name: "wechat", - rules: []string{"||wechat.com^", "||weixin.qq.com^", "||wx.qq.com^"}, + name: "wechat", + rules: []string{ + "||wechat.com^", + "||weixin.qq.com.cn^", + "||weixin.qq.com^", + "||weixinbridge.com^", + "||wx.qq.com^", + }, }, { name: "viber", rules: []string{"||viber.com^"}, }, { - name: "weibo", - rules: []string{"||weibo.com^"}, + name: "weibo", + rules: []string{ + "||weibo.cn^", + "||weibo.com^", + "||weibocdn.com^", + }, }, { - name: "9gag", - rules: []string{"||9cache.com^", "||9gag.com^"}, + name: "9gag", + rules: []string{ + "||9cache.com^", + "||9gag.com^", + }, }, { - name: "telegram", - rules: []string{"||t.me^", "||telegram.me^", "||telegram.org^"}, + name: "telegram", + rules: []string{ + "||t.me^", + "||telegram.me^", + "||telegram.org^", + }, }, { name: "disneyplus", rules: []string{ @@ -284,6 +329,17 @@ var serviceRulesArray = []svc{{ "||tinder.com^", "||tindersparks.com^", }, +}, { + name: "bilibili", + rules: []string{ + "||biliapi.net^", + "||bilibili.com^", + "||biligame.com^", + "||bilivideo.cn^", + "||bilivideo.com^", + "||dreamcast.hk^", + "||hdslb.com^", + }, }} // convert array to map