From 68a83b7c03035d3ae9aa34e06eaf88222d5f4aba Mon Sep 17 00:00:00 2001 From: tijl Date: Sun, 17 Nov 2024 21:43:16 +0100 Subject: [PATCH] clean up --- internal/template/functions.go | 10 +--------- internal/urllib/url.go | 10 ---------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/internal/template/functions.go b/internal/template/functions.go index cde5970d8de..3b088d20ca6 100644 --- a/internal/template/functions.go +++ b/internal/template/functions.go @@ -29,14 +29,6 @@ type funcMap struct { router *mux.Router } -func editedDomainFunc(url string) string { - if result := urllib.Domain(url); result != "" { - return result - } else { - return urllib.Protocol(url) - } -} - // Map returns a map of template functions that are compiled during template parsing. func (f *funcMap) Map() template.FuncMap { return template.FuncMap{ @@ -85,7 +77,7 @@ func (f *funcMap) Map() template.FuncMap { "mustBeProxyfied": func(mediaType string) bool { return slices.Contains(config.Opts.MediaProxyResourceTypes(), mediaType) }, - "domain": editedDomainFunc, + "domain": urllib.Domain, "hasPrefix": strings.HasPrefix, "contains": strings.Contains, "replace": func(str, old, new string) string { diff --git a/internal/urllib/url.go b/internal/urllib/url.go index f41f663deb1..55230187af9 100644 --- a/internal/urllib/url.go +++ b/internal/urllib/url.go @@ -80,16 +80,6 @@ func Domain(websiteURL string) string { return parsedURL.Host } -// Protocol returns only the protocol (scheme) part of the given URL. -func Protocol(websiteURL string) string { - parsedURL, err := url.Parse(websiteURL) - if err != nil { - return "" - } - - return parsedURL.Scheme -} - // JoinBaseURLAndPath returns a URL string with the provided path elements joined together. func JoinBaseURLAndPath(baseURL, path string) (string, error) { if baseURL == "" {