mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Merge 5df969252a into 3761a7cb21
This commit is contained in:
commit
a2a0d32f5e
3 changed files with 23 additions and 7 deletions
|
|
@ -6,7 +6,7 @@ with evennia set up automatically and get the Evennia JS lib and
|
|||
JQuery available.
|
||||
-->
|
||||
|
||||
{% load static %}
|
||||
{% load static cachebuster %}
|
||||
<html dir="ltr" lang="en">
|
||||
<head>
|
||||
<title> {{game_name}} </title>
|
||||
|
|
@ -17,13 +17,13 @@ JQuery available.
|
|||
|
||||
<!-- Bootstrap CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
|
||||
<link rel='stylesheet' type="text/css" media="screen" href={% static "webclient/css/webclient.css" %}>
|
||||
<link rel='stylesheet' type="text/css" media="screen" href={% static "webclient/css/webclient.css" as webclient_css %}{{ webclient_css|cachebust }}>
|
||||
|
||||
{% comment %}
|
||||
Allows for loading custom styles without overriding the base site stylesheet
|
||||
{% endcomment %}
|
||||
<!-- Custom CSS -->
|
||||
<link rel='stylesheet' type="text/css" media="screen" href={% static "webclient/css/custom.css" %}>
|
||||
<link rel='stylesheet' type="text/css" media="screen" href={% static "webclient/css/custom.css" as custom_css %}{{ custom_css|cachebust }}>
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="/static/website/images/evennia_logo.png" />
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ JQuery available.
|
|||
var wsurl = "ws://" + this.location.hostname + ":{{websocket_port}}";
|
||||
{% endif %}
|
||||
</script>
|
||||
<script src={% static "webclient/js/evennia.js" %} language="javascript" type="text/javascript" charset="utf-8"/></script>
|
||||
<script src={% static "webclient/js/evennia.js" as webclient_js %}{{ webclient_js|cachebust }} language="javascript" type="text/javascript" charset="utf-8"/></script>
|
||||
|
||||
<!-- set up splits before loading the GUI -->
|
||||
<!--
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{% load static sekizai_tags %}
|
||||
{% load static sekizai_tags cachebuster %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
|
@ -16,13 +16,13 @@
|
|||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
|
||||
|
||||
<!-- Base CSS -->
|
||||
<link rel="stylesheet" type="text/css" href="{% static "website/css/website.css" %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static "website/css/website.css" as css_url %}{{ css_url|cachebust }}">
|
||||
|
||||
{% comment %}
|
||||
Allows for loading custom styles without overriding the base site styles
|
||||
{% endcomment %}
|
||||
<!-- Custom CSS -->
|
||||
<link rel="stylesheet" type="text/css" href="{% static "website/css/custom.css" %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static "website/css/custom.css" as custom_css %}{{ custom_css|cachebust }}">
|
||||
|
||||
{% block header_ext %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
16
evennia/web/templatetags/cachebuster.py
Normal file
16
evennia/web/templatetags/cachebuster.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from django import template
|
||||
from django.conf import settings
|
||||
from django.contrib.staticfiles import finders
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@register.filter
|
||||
def cachebust(value, digest_size=5):
|
||||
filepath = finders.find(value.removeprefix(settings.STATIC_URL))
|
||||
if not filepath:
|
||||
return value
|
||||
|
||||
with open(filepath, "rb") as f:
|
||||
import hashlib
|
||||
filehash = hashlib.shake_256(f.read()).hexdigest(digest_size)
|
||||
return f"{value}?{filehash}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue