core: use version in qs for static files to ensure latest are loaded
This commit is contained in:
parent
192dbe05c4
commit
c1fbfc63ab
|
@ -9,14 +9,14 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
<title>{% block title %}{% trans title|default:config.authentik.branding.title %}{% endblock %}</title>
|
<title>{% block title %}{% trans title|default:config.authentik.branding.title %}{% endblock %}</title>
|
||||||
<link rel="icon" type="image/png" href="{% static 'dist/assets/icons/icon.png' %}">
|
<link rel="icon" type="image/png" href="{% static 'dist/assets/icons/icon.png' %}?v={{ ak_version }}">
|
||||||
<link rel="shortcut icon" type="image/png" href="{% static 'dist/assets/icons/icon.png' %}">
|
<link rel="shortcut icon" type="image/png" href="{% static 'dist/assets/icons/icon.png' %}?v={{ ak_version }}">
|
||||||
<link rel="stylesheet" type="text/css" href="{% static 'dist/patternfly.css' %}">
|
<link rel="stylesheet" type="text/css" href="{% static 'dist/patternfly.css' %}?v={{ ak_version }}">
|
||||||
<link rel="stylesheet" type="text/css" href="{% static 'dist/patternfly-addons.css' %}">
|
<link rel="stylesheet" type="text/css" href="{% static 'dist/patternfly-addons.css' %}?v={{ ak_version }}">
|
||||||
<link rel="stylesheet" type="text/css" href="{% static 'dist/fontawesome.min.css' %}">
|
<link rel="stylesheet" type="text/css" href="{% static 'dist/fontawesome.min.css' %}?v={{ ak_version }}">
|
||||||
<link rel="stylesheet" type="text/css" href="{% static 'dist/authentik.css' %}">
|
<link rel="stylesheet" type="text/css" href="{% static 'dist/authentik.css' %}?v={{ ak_version }}">
|
||||||
<script src="{% url 'javascript-catalog' %}"></script>
|
<script src="{% url 'javascript-catalog' %}?v={{ ak_version }}"></script>
|
||||||
<script src="{% static 'dist/main.js' %}" type="module"></script>
|
<script src="{% static 'dist/main.js' %}?v={{ ak_version }}" type="module"></script>
|
||||||
{% block head %}
|
{% block head %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -5,13 +5,15 @@ from contextlib import contextmanager
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from json import dumps
|
from json import dumps
|
||||||
from time import time
|
from time import time
|
||||||
from typing import Any, Dict
|
from typing import Any
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from django.conf import ImproperlyConfigured
|
from django.conf import ImproperlyConfigured
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
|
|
||||||
|
from authentik import __version__
|
||||||
|
|
||||||
SEARCH_PATHS = ["authentik/lib/default.yml", "/etc/authentik/config.yml", ""] + glob(
|
SEARCH_PATHS = ["authentik/lib/default.yml", "/etc/authentik/config.yml", ""] + glob(
|
||||||
"/etc/authentik/config.d/*.yml", recursive=True
|
"/etc/authentik/config.d/*.yml", recursive=True
|
||||||
)
|
)
|
||||||
|
@ -19,10 +21,9 @@ ENV_PREFIX = "AUTHENTIK"
|
||||||
ENVIRONMENT = os.getenv(f"{ENV_PREFIX}_ENV", "local")
|
ENVIRONMENT = os.getenv(f"{ENV_PREFIX}_ENV", "local")
|
||||||
|
|
||||||
|
|
||||||
def context_processor(request: HttpRequest) -> Dict[str, Any]:
|
def context_processor(request: HttpRequest) -> dict[str, Any]:
|
||||||
"""Context Processor that injects config object into every template"""
|
"""Context Processor that injects config object into every template"""
|
||||||
kwargs = {"config": CONFIG.raw}
|
return {"config": CONFIG.raw, "ak_version": __version__}
|
||||||
return kwargs
|
|
||||||
|
|
||||||
|
|
||||||
class ConfigLoader:
|
class ConfigLoader:
|
||||||
|
|
|
@ -34,7 +34,8 @@ export class NotificationDrawer extends LitElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
renderItem(item: Notification): TemplateResult {
|
renderItem(item: Notification): TemplateResult {
|
||||||
const delta = Date.now() - parseInt(item.created, 10);
|
const delta = Date.now() - (parseInt(item.created, 10) * 1000);
|
||||||
|
// TODO: more flexible display, minutes and seconds
|
||||||
const age = `${Math.round(delta / 1000 / 3600)} Hours ago`;
|
const age = `${Math.round(delta / 1000 / 3600)} Hours ago`;
|
||||||
let level = "";
|
let level = "";
|
||||||
switch (item.severity) {
|
switch (item.severity) {
|
||||||
|
@ -60,7 +61,7 @@ export class NotificationDrawer extends LitElement {
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="pf-c-notification-drawer__list-item-description">
|
<div class="pf-c-notification-drawer__list-item-description">
|
||||||
${item.body.substring(0, 75)}
|
${item.body}
|
||||||
</div>
|
</div>
|
||||||
<div class="pf-c-notification-drawer__list-item-timestamp">
|
<div class="pf-c-notification-drawer__list-item-timestamp">
|
||||||
${age}
|
${age}
|
||||||
|
|
Reference in New Issue