From a2eccd50224b7517dccb6c92c9510204edb585bf Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 14:03:03 +0100 Subject: [PATCH] core: use versioned_script for path only (cherry-pick #12003) (#12023) core: use versioned_script for path only (#12003) Signed-off-by: Jens Langhammer Co-authored-by: Jens L. --- authentik/api/templates/api/browser.html | 2 +- authentik/core/templates/base/skeleton.html | 4 ++-- authentik/core/templates/if/admin.html | 2 +- authentik/core/templates/if/user.html | 2 +- authentik/core/templatetags/authentik_core.py | 9 +-------- authentik/enterprise/providers/rac/templates/if/rac.html | 2 +- authentik/flows/templates/if/flow.html | 2 +- 7 files changed, 8 insertions(+), 15 deletions(-) diff --git a/authentik/api/templates/api/browser.html b/authentik/api/templates/api/browser.html index a84ef3cb257d..e753d79f2154 100644 --- a/authentik/api/templates/api/browser.html +++ b/authentik/api/templates/api/browser.html @@ -7,7 +7,7 @@ {% endblock %} {% block head %} -{% versioned_script "dist/standalone/api-browser/index-%v.js" %} + {% endblock %} diff --git a/authentik/core/templates/base/skeleton.html b/authentik/core/templates/base/skeleton.html index 86da52e94904..074fcc15561a 100644 --- a/authentik/core/templates/base/skeleton.html +++ b/authentik/core/templates/base/skeleton.html @@ -15,8 +15,8 @@ {% endblock %} - {% versioned_script "dist/poly-%v.js" %} - {% versioned_script "dist/standalone/loading/index-%v.js" %} + + {% block head %} {% endblock %} diff --git a/authentik/core/templates/if/admin.html b/authentik/core/templates/if/admin.html index 9a548dfd9d73..51d1569dfb38 100644 --- a/authentik/core/templates/if/admin.html +++ b/authentik/core/templates/if/admin.html @@ -3,7 +3,7 @@ {% load authentik_core %} {% block head %} -{% versioned_script "dist/admin/AdminInterface-%v.js" %} + {% include "base/header_js.html" %} diff --git a/authentik/core/templates/if/user.html b/authentik/core/templates/if/user.html index 84d88dac3b24..7ce1714ac765 100644 --- a/authentik/core/templates/if/user.html +++ b/authentik/core/templates/if/user.html @@ -3,7 +3,7 @@ {% load authentik_core %} {% block head %} -{% versioned_script "dist/user/UserInterface-%v.js" %} + {% include "base/header_js.html" %} diff --git a/authentik/core/templatetags/authentik_core.py b/authentik/core/templatetags/authentik_core.py index 7f8a80a5fa71..44ac3a4ffcec 100644 --- a/authentik/core/templatetags/authentik_core.py +++ b/authentik/core/templatetags/authentik_core.py @@ -2,7 +2,6 @@ from django import template from django.templatetags.static import static as static_loader -from django.utils.safestring import mark_safe from authentik import get_full_version @@ -12,10 +11,4 @@ @register.simple_tag() def versioned_script(path: str) -> str: """Wrapper around {% static %} tag that supports setting the version""" - returned_lines = [ - ( - f'' - ), - ] - return mark_safe("".join(returned_lines)) # nosec + return static_loader(path.replace("%v", get_full_version())) diff --git a/authentik/enterprise/providers/rac/templates/if/rac.html b/authentik/enterprise/providers/rac/templates/if/rac.html index ade8bd8b2f3b..fde3f30ad8f3 100644 --- a/authentik/enterprise/providers/rac/templates/if/rac.html +++ b/authentik/enterprise/providers/rac/templates/if/rac.html @@ -3,7 +3,7 @@ {% load authentik_core %} {% block head %} -{% versioned_script "dist/enterprise/rac/index-%v.js" %} + diff --git a/authentik/flows/templates/if/flow.html b/authentik/flows/templates/if/flow.html index a5b3d7f592c5..2cf3246db3ed 100644 --- a/authentik/flows/templates/if/flow.html +++ b/authentik/flows/templates/if/flow.html @@ -18,7 +18,7 @@ {% endblock %} {% block head %} -{% versioned_script "dist/flow/FlowInterface-%v.js" %} +