Break up common functions and small refactor.

This commit is contained in:
2025-01-04 15:31:26 +02:00
parent b78fe00221
commit 4e6fad873b
16 changed files with 259 additions and 177 deletions

View File

@@ -2,6 +2,7 @@ package gemini
import (
"fmt"
"gemini-grc/common"
"os"
"strings"
@@ -39,7 +40,11 @@ func LoadBlacklist() {
}
}
func IsBlacklisted(url URL) bool {
func IsBlacklisted(u string) bool {
url, err := common.ParseURL(u, "")
if err != nil {
return false
}
hostWithPort := fmt.Sprintf("%s:%d", url.Hostname, url.Port)
for _, v := range *Blacklist {
if v == url.Hostname || v == hostWithPort {