Skip to content

Commit

Permalink
core: use versioned_script for path only (cherry-pick #12003) (#12023)
Browse files Browse the repository at this point in the history
core: use versioned_script for path only (#12003)

Signed-off-by: Jens Langhammer <[email protected]>
Co-authored-by: Jens L. <[email protected]>
  • Loading branch information
gcp-cherry-pick-bot[bot] and BeryJu authored Nov 14, 2024
1 parent 31aeaa2 commit a2eccd5
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion authentik/api/templates/api/browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% endblock %}

{% block head %}
{% versioned_script "dist/standalone/api-browser/index-%v.js" %}
<script src="{% versioned_script 'dist/standalone/api-browser/index-%v.js' %}" type="module"></script>
<meta name="theme-color" content="#151515" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#151515" media="(prefers-color-scheme: dark)">
{% endblock %}
Expand Down
4 changes: 2 additions & 2 deletions authentik/core/templates/base/skeleton.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
{% endblock %}
<link rel="stylesheet" type="text/css" href="{% static 'dist/authentik.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'dist/custom.css' %}" data-inject>
{% versioned_script "dist/poly-%v.js" %}
{% versioned_script "dist/standalone/loading/index-%v.js" %}
<script src="{% versioned_script 'dist/poly-%v.js' %}" type="module"></script>
<script src="{% versioned_script 'dist/standalone/loading/index-%v.js' %}" type="module"></script>
{% block head %}
{% endblock %}
<meta name="sentry-trace" content="{{ sentry_trace }}" />
Expand Down
2 changes: 1 addition & 1 deletion authentik/core/templates/if/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% load authentik_core %}

{% block head %}
{% versioned_script "dist/admin/AdminInterface-%v.js" %}
<script src="{% versioned_script 'dist/admin/AdminInterface-%v.js' %}" type="module"></script>
<meta name="theme-color" content="#18191a" media="(prefers-color-scheme: dark)">
<meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)">
{% include "base/header_js.html" %}
Expand Down
2 changes: 1 addition & 1 deletion authentik/core/templates/if/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% load authentik_core %}

{% block head %}
{% versioned_script "dist/user/UserInterface-%v.js" %}
<script src="{% versioned_script 'dist/user/UserInterface-%v.js' %}" type="module"></script>
<meta name="theme-color" content="#1c1e21" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#1c1e21" media="(prefers-color-scheme: dark)">
{% include "base/header_js.html" %}
Expand Down
9 changes: 1 addition & 8 deletions authentik/core/templatetags/authentik_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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'<script src="{static_loader(path.replace("%v", get_full_version()))}'
'" type="module"></script>'
),
]
return mark_safe("".join(returned_lines)) # nosec
return static_loader(path.replace("%v", get_full_version()))
2 changes: 1 addition & 1 deletion authentik/enterprise/providers/rac/templates/if/rac.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% load authentik_core %}

{% block head %}
{% versioned_script "dist/enterprise/rac/index-%v.js" %}
<script src="{% versioned_script 'dist/enterprise/rac/index-%v.js' %}" type="module"></script>
<meta name="theme-color" content="#18191a" media="(prefers-color-scheme: dark)">
<meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)">
<link rel="icon" href="{{ tenant.branding_favicon }}">
Expand Down
2 changes: 1 addition & 1 deletion authentik/flows/templates/if/flow.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{% endblock %}

{% block head %}
{% versioned_script "dist/flow/FlowInterface-%v.js" %}
<script src="{% versioned_script 'dist/flow/FlowInterface-%v.js' %}" type="module"></script>
<style>
:root {
--ak-flow-background: url("{{ flow.background_url }}");
Expand Down

0 comments on commit a2eccd5

Please sign in to comment.