Added several blocked services

Closes #2224
Closes #2401

Squashed commit of the following:

commit 8d422091187d03273393775ddc691bdd2a6913f4
Merge: 7a8f598b fa33568f
Author: Andrey Meshkov <am@adguard.com>
Date:   Thu Feb 4 17:57:32 2021 +0300

    Merge branch 'master' into fix-2224

commit 7a8f598b19a877c19cb1537047c0ae14fa8a0064
Author: Andrey Meshkov <am@adguard.com>
Date:   Thu Feb 4 17:34:53 2021 +0300

    Review comments

commit 181db867fc56d89dd13a4d50a24922604eed4eae
Author: Andrey Meshkov <am@adguard.com>
Date:   Thu Feb 4 17:20:20 2021 +0300

    fixed review comments

commit fd5b0816d63952664c6e89a91494ca09dc4fc52d
Author: Ildar Kamalov <ik@adguard.com>
Date:   Thu Feb 4 16:10:29 2021 +0300

    + client: add service icons

commit 724e0c26691488fdf7cd8215d200867ed3a86198
Author: Andrey Meshkov <am@adguard.com>
Date:   Thu Feb 4 15:42:53 2021 +0300

    Added several blocked services

    Closes #2224
    Closes #2401
This commit is contained in:
Andrey Meshkov
2021-02-04 18:16:01 +03:00
parent fa33568fab
commit 8aec08727c
6 changed files with 271 additions and 67 deletions

View File

@@ -161,7 +161,73 @@ var serviceRulesArray = []svc{
"||douyin.com^",
"||tiktokv.com^",
}},
{"qq", []string{"||qq.com^", "||qqzaixian.com^"}},
{"vimeo", []string{
"||vimeo.com^",
"||vimeocdn.com^",
"*vod-adaptive.akamaized.net^",
}},
{"pinterest", []string{
"||pinterest.*^",
"||pinimg.com^",
}},
{"imgur", []string{
"||imgur.com^",
}},
{"dailymotion", []string{
"||dailymotion.com^",
"||dm-event.net^",
"||dmcdn.net^",
}},
{"qq", []string{
// block qq.com and subdomains excluding WeChat domains
"^(?!weixin|wx)([^.]+\\.)?qq\\.com$",
"||qqzaixian.com^",
}},
{"wechat", []string{
"||wechat.com^",
"||weixin.qq.com^",
"||wx.qq.com^",
}},
{"viber", []string{
"||viber.com^",
}},
{"weibo", []string{
"||weibo.com^",
}},
{"9gag", []string{
"||9cache.com^",
"||gag.com^",
}},
{"telegram", []string{
"||t.me^",
"||telegram.me^",
"||telegram.org^",
}},
{"disneyplus", []string{
"||disney-plus.net^",
"||disneyplus.com^",
}},
{"hulu", []string{
"||hulu.com^",
}},
{"spotify", []string{
"/_spotify-connect._tcp.local/",
"||spotify.com^",
"||scdn.co^",
"||spotify.com.edgesuite.net^",
"||spotify.map.fastly.net^",
"||spotify.map.fastlylb.net^",
"||spotifycdn.net^",
"||audio-ak-spotify-com.akamaized.net^",
"||audio4-ak-spotify-com.akamaized.net^",
"||heads-ak-spotify-com.akamaized.net^",
"||heads4-ak-spotify-com.akamaized.net^",
}},
{"tinder", []string{
"||gotinder.com^",
"||tinder.com^",
"||tindersparks.com^",
}},
}
// convert array to map

View File

@@ -0,0 +1,37 @@
// +build ignore
package dnsfilter
import (
"fmt"
"sort"
"testing"
)
// This is a simple tool that takes a list of services and prints them to the output.
// It is supposed to be used to update:
// client/src/helpers/constants.js
// client/src/components/ui/Icons.js
//
// Usage:
// 1. go run ./internal/dnsfilter/blocked_test.go
// 2. Use the output to replace `SERVICES` array in "client/src/helpers/constants.js".
// 3. You'll need to enter services names manually.
// 4. Don't forget to add missing icons to "client/src/components/ui/Icons.js".
//
// TODO(ameshkov): Rework generator: have a JSON file with all the metadata we need
// then use this JSON file to generate JS and Go code
func TestGenServicesArray(t *testing.T) {
services := make([]svc, len(serviceRulesArray))
copy(services, serviceRulesArray)
sort.Slice(services, func(i, j int) bool {
return services[i].name < services[j].name
})
fmt.Println("export const SERVICES = [")
for _, s := range services {
fmt.Printf(" {\n id: '%s',\n name: '%s',\n },\n", s.name, s.name)
}
fmt.Println("];")
}