Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
github-tijlxyz committed Nov 17, 2024
1 parent e81c26a commit 68a83b7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
10 changes: 1 addition & 9 deletions internal/template/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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 {
Expand Down
10 changes: 0 additions & 10 deletions internal/urllib/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand Down

0 comments on commit 68a83b7

Please sign in to comment.