Change blacklist to comprise domains.

This commit is contained in:
2024-10-22 15:50:28 +03:00
parent cd60c1363b
commit 3c5206ae43
4 changed files with 13 additions and 10 deletions

View File

@@ -1,18 +1,22 @@
package gemini
import "strings"
import "gemini-grc/logging"
var Blacklist *[]string
func InBlacklist(s *Snapshot) bool {
if Blacklist == nil {
data := ReadLines("blacklist.txt")
data := ReadLines("blacklists/domains.txt")
Blacklist = &data
logging.LogInfo("Loaded %d blacklisted domains", len(*Blacklist))
}
for _, l := range *Blacklist {
if strings.HasPrefix(s.URL.String(), l) {
if s.Host == l {
return true
}
// if strings.HasPrefix(s.URL.String(), l) {
// return true
// }
}
return false
}