toWhitelist gets base domain

master
Bel LaPointe 2018-10-12 11:07:08 -06:00
parent 6ee99fbc5c
commit 35d96e4979
1 changed files with 6 additions and 0 deletions

View File

@ -134,6 +134,12 @@ func fixScheme(u *url.URL) {
func toWhitelist(okay []string, host string) bool {
host = strings.Split(host, ":")[0]
host = strings.Replace(host, "www.", "", -1)
host = strings.Replace(host, "http://", "", -1)
host = strings.Replace(host, "https://", "", -1)
hosts := strings.Split(host, ".")
if len(hosts) > 1 {
host = hosts[len(hosts)-2] + "." + hosts[len(hosts)-1]
}
for i := range okay {
if strings.Contains(okay[i], host) {
return true