Skip to content

Commit

Permalink
filtering/safesearch: Added brave search engine.
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianLang06 committed Jan 6, 2025
1 parent 0b25119 commit 306472b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/filtering/safesearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type SafeSearchConfig struct {
// enabled or disabled.

Bing bool `yaml:"bing" json:"bing"`
Brave bool `yaml:"brave" json:"brave"`
DuckDuckGo bool `yaml:"duckduckgo" json:"duckduckgo"`
Ecosia bool `yaml:"ecosia" json:"ecosia"`
Google bool `yaml:"google" json:"google"`
Expand Down
4 changes: 4 additions & 0 deletions internal/filtering/safesearch/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import _ "embed"
//go:embed rules/bing.txt
var bing string

//go:embed rules/brave.txt
var brave string

//go:embed rules/google.txt
var google string

Expand All @@ -29,6 +32,7 @@ var youtube string
// https://adguardteam.github.io/HostlistsRegistry/assets/youtube_safe_search.txt.
var safeSearchRules = map[Service]string{
Bing: bing,
Brave: brave,
DuckDuckGo: duckduckgo,
Ecosia: ecosia,
Google: google,
Expand Down
1 change: 1 addition & 0 deletions internal/filtering/safesearch/rules/brave.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
|search.brave.com^$dnsrewrite=NOERROR;CNAME;safesearch.brave.com
3 changes: 3 additions & 0 deletions internal/filtering/safesearch/safesearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type Service string
// Service enum members.
const (
Bing Service = "bing"
Brave Service = "brave"
DuckDuckGo Service = "duckduckgo"
Ecosia Service = "ecosia"
Google Service = "google"
Expand All @@ -61,6 +62,8 @@ func isServiceProtected(s filtering.SafeSearchConfig, service Service) (ok bool)
return s.Yandex
case YouTube:
return s.YouTube
case Brave:
return s.Brave
default:
panic(fmt.Errorf("safesearch: invalid sources: not found service %q", service))
}
Expand Down
1 change: 1 addition & 0 deletions internal/home/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ var config = &configuration{

SafeSearchConf: filtering.SafeSearchConfig{
Enabled: false,
Brave: true,
Bing: true,
DuckDuckGo: true,
Ecosia: true,
Expand Down

0 comments on commit 306472b

Please sign in to comment.