diff --git a/server/handler.go b/server/handler.go index 43fc24a..1c92647 100644 --- a/server/handler.go +++ b/server/handler.go @@ -46,7 +46,7 @@ func Handler(mainDomainSuffix, rawDomain string, trimmedHost := utils.TrimHostPort(req.Host) // Add HSTS for RawDomain and MainDomainSuffix - if hsts := GetHSTSHeader(trimmedHost, mainDomainSuffix, rawDomain); hsts != "" { + if hsts := getHSTSHeader(trimmedHost, mainDomainSuffix, rawDomain); hsts != "" { ctx.RespWriter.Header().Set("Strict-Transport-Security", hsts) } @@ -92,6 +92,7 @@ func Handler(mainDomainSuffix, rawDomain string, // tryBranch checks if a branch exists and populates the target variables. If canonicalLink is non-empty, it will // also disallow search indexing and add a Link header to the canonical URL. + // TODO: move into external func to not alert vars indirectly tryBranch := func(log zerolog.Logger, repo, branch string, _path []string, canonicalLink string) bool { if repo == "" { log.Debug().Msg("tryBranch: repo == ''") diff --git a/server/helpers.go b/server/helpers.go index 221bf6e..7c898cd 100644 --- a/server/helpers.go +++ b/server/helpers.go @@ -4,9 +4,9 @@ import ( "strings" ) -// GetHSTSHeader returns a HSTS header with includeSubdomains & preload for MainDomainSuffix and RawDomain, or an empty +// getHSTSHeader returns a HSTS header with includeSubdomains & preload for MainDomainSuffix and RawDomain, or an empty // string for custom domains. -func GetHSTSHeader(host, mainDomainSuffix, rawDomain string) string { +func getHSTSHeader(host, mainDomainSuffix, rawDomain string) string { if strings.HasSuffix(host, mainDomainSuffix) || strings.EqualFold(host, rawDomain) { return "max-age=63072000; includeSubdomains; preload" } else { diff --git a/server/upstream/helper.go b/server/upstream/helper.go index 82393a4..7be783d 100644 --- a/server/upstream/helper.go +++ b/server/upstream/helper.go @@ -18,7 +18,7 @@ func GetBranchTimestamp(giteaClient *gitea.Client, owner, repo, branch string) * log.Err(err).Msg("Could't fetch default branch from repository") return nil } - log.Debug().Msgf("found default branch: %s", defaultBranch) + log.Debug().Msgf("Succesfully fetched default branch '%s' from Gitea", defaultBranch) branch = defaultBranch }