mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-14 09:22:09 +00:00
fix: caching of assets (correct headers and versioned avatar and variables.css url) (#4118)
* fix: caching of assets (correct headers and versioned avatar url) * serve variables.css versioned and extend shared max age of assets * fix TestCommandSide_AddHumanAvatar * refactor: const types * refactor: return values Co-authored-by: Fabi <38692350+hifabienne@users.noreply.github.com> Co-authored-by: adlerhurst <silvan.reusser@gmail.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"net/http"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/csrf"
|
||||
"github.com/zitadel/logging"
|
||||
@@ -84,19 +85,13 @@ func CreateRenderer(pathPrefix string, staticDir http.FileSystem, staticStorage
|
||||
return path.Join(r.pathPrefix, EndpointResources, "themes", theme, file)
|
||||
},
|
||||
"hasCustomPolicy": func(policy *domain.LabelPolicy) bool {
|
||||
if policy != nil {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return policy != nil
|
||||
},
|
||||
"hasWatermark": func(policy *domain.LabelPolicy) bool {
|
||||
if policy != nil && policy.DisableWatermark {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
return policy == nil || !policy.DisableWatermark
|
||||
},
|
||||
"variablesCssFileUrl": func(orgID string, policy *domain.LabelPolicy) string {
|
||||
cssFile := domain.CssPath + "/" + domain.CssVariablesFileName
|
||||
cssFile := domain.CssPath + "/" + domain.CssVariablesFileName + "?v=" + policy.ChangeDate.Format(time.RFC3339)
|
||||
return path.Join(r.pathPrefix, fmt.Sprintf("%s?%s=%s&%s=%v&%s=%s", EndpointDynamicResources, "orgId", orgID, "default-policy", policy.Default, "filename", cssFile))
|
||||
},
|
||||
"customLogoResource": func(orgID string, policy *domain.LabelPolicy, darkMode bool) string {
|
||||
|
||||
Reference in New Issue
Block a user