forked from AdguardTeam/AdGuardHome
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes AdguardTeam#2224 Closes AdguardTeam#2401 Squashed commit of the following: commit 8d42209 Merge: 7a8f598 fa33568 Author: Andrey Meshkov <am@adguard.com> Date: Thu Feb 4 17:57:32 2021 +0300 Merge branch 'master' into fix-2224 commit 7a8f598 Author: Andrey Meshkov <am@adguard.com> Date: Thu Feb 4 17:34:53 2021 +0300 Review comments commit 181db86 Author: Andrey Meshkov <am@adguard.com> Date: Thu Feb 4 17:20:20 2021 +0300 fixed review comments commit fd5b081 Author: Ildar Kamalov <ik@adguard.com> Date: Thu Feb 4 16:10:29 2021 +0300 + client: add service icons commit 724e0c2 Author: Andrey Meshkov <am@adguard.com> Date: Thu Feb 4 15:42:53 2021 +0300 Added several blocked services Closes AdguardTeam#2224 Closes AdguardTeam#2401
- Loading branch information
Showing
6 changed files
with
251 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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("];") | ||
} |