Removed public disclosures of the lib's version. #154
parent
f3e7fcef33
commit
06069644fd
|
|
@ -56,3 +56,5 @@ docs/_build/
|
|||
target/
|
||||
screenshots
|
||||
TODO.txt
|
||||
|
||||
.idea/
|
||||
|
|
|
|||
|
|
@ -8,13 +8,9 @@
|
|||
|
||||
{% block extrastyle %}
|
||||
{% get_admin_interface_theme as theme %}
|
||||
{% get_admin_interface_version as version %}
|
||||
{% get_admin_interface_nocache as version_md5_cache %}
|
||||
{% get_current_language as current_lang %}
|
||||
<style type="text/css">
|
||||
/*
|
||||
django-admin-interface {{ version }}
|
||||
https://github.com/fabiocaccamo/django-admin-interface
|
||||
*/
|
||||
{% include "admin_interface/css/admin-interface.css" %}
|
||||
{% include "admin_interface/css/admin-interface-fix.css" %}
|
||||
{% include "admin_interface/css/form-controls.css" %}
|
||||
|
|
@ -40,11 +36,11 @@ https://github.com/fabiocaccamo/django-admin-interface
|
|||
{% block blockbots %}
|
||||
{{ block.super }}
|
||||
{% get_admin_interface_theme as theme %}
|
||||
{% get_admin_interface_version as version %}
|
||||
{% get_admin_interface_nocache as version_md5_cache %}
|
||||
{# https://github.com/elky/django-flat-responsive#important-note #}
|
||||
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/responsive.css' %}?v={{ version }}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/responsive_rtl.css' %}?v={{ version }}" />
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/responsive.css' %}?nocache={{ version_md5_cache }}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/responsive_rtl.css' %}?nocache={{ version_md5_cache }}">
|
||||
{% include "admin_interface/favicon.html" %}
|
||||
{% include "admin_interface/foldable-apps.html" %}
|
||||
{% include "admin_interface/related-modal.html" %}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
{% if theme.favicon %}
|
||||
<link rel="icon" href="{{ theme.favicon.url }}">
|
||||
{% if theme.env_visible_in_favicon %}
|
||||
<script type="text/javascript" src="{% static 'admin_interface/favico/favico-0.3.10-patched.min.js' %}?v={{ version }}"></script>
|
||||
<script type="text/javascript" src="{% static 'admin_interface/favico/favico-0.3.10-patched.min.js' %}?nocache={{ version_md5_cache }}"></script>
|
||||
<script type="text/javascript">
|
||||
var favicon = new Favico({
|
||||
type: 'circle',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{% load static %}
|
||||
|
||||
{% if theme.foldable_apps %}
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'admin_interface/foldable-apps/foldable-apps.css' %}?v={{ version }}">
|
||||
<script type="text/javascript" src="{% static 'admin_interface/foldable-apps/foldable-apps.js' %}?v={{ version }}"></script>
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'admin_interface/foldable-apps/foldable-apps.css' %}?nocache={{ version_md5_cache }}">
|
||||
<script type="text/javascript" src="{% static 'admin_interface/foldable-apps/foldable-apps.js' %}?nocache={{ version_md5_cache }}"></script>
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{% load static %}
|
||||
|
||||
{% if theme.related_modal_active %}
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'admin_interface/magnific-popup/magnific-popup.css' %}?v={{ version }}">
|
||||
<script type="text/javascript" src="{% static 'admin_interface/magnific-popup/jquery.magnific-popup.js' %}?v={{ version }}"></script>
|
||||
<script type="text/javascript" src="{% static 'admin_interface/related-modal/related-modal.js' %}?v={{ version }}"></script>
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'admin_interface/magnific-popup/magnific-popup.css' %}?nocache={{ version_md5_cache }}">
|
||||
<script type="text/javascript" src="{% static 'admin_interface/magnific-popup/jquery.magnific-popup.js' %}?nocache={{ version_md5_cache }}"></script>
|
||||
<script type="text/javascript" src="{% static 'admin_interface/related-modal/related-modal.js' %}?nocache={{ version_md5_cache }}"></script>
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
import hashlib
|
||||
import django
|
||||
|
||||
from django import template
|
||||
|
|
@ -11,7 +12,6 @@ from admin_interface.compat import NoReverseMatch, reverse
|
|||
from admin_interface.models import Theme
|
||||
from admin_interface.version import __version__
|
||||
|
||||
import re
|
||||
|
||||
|
||||
register = template.Library()
|
||||
|
|
@ -77,3 +77,14 @@ def get_admin_interface_theme(context):
|
|||
@simple_tag(takes_context=False)
|
||||
def get_admin_interface_version():
|
||||
return __version__
|
||||
|
||||
|
||||
def hash_string(text):
|
||||
hash_object = hashlib.md5(text.encode())
|
||||
md5_hash = hash_object.hexdigest()
|
||||
return md5_hash
|
||||
|
||||
|
||||
@simple_tag(takes_context=False)
|
||||
def get_admin_interface_nocache():
|
||||
return hash_string(__version__)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ from django.template import Context, Template
|
|||
|
||||
from admin_interface.models import Theme
|
||||
from admin_interface.templatetags import admin_interface_tags as templatetags
|
||||
from admin_interface.templatetags.admin_interface_tags import hash_string
|
||||
from admin_interface.version import __version__
|
||||
|
||||
|
||||
|
|
@ -133,3 +134,15 @@ class AdminInterfaceTemplateTagsTestCase(TestCase):
|
|||
"{{ version }}"
|
||||
)
|
||||
self.assertEqual(rendered, __version__)
|
||||
|
||||
def test_get_version_nocache(self):
|
||||
hash_from_tag = templatetags.get_admin_interface_nocache()
|
||||
hash_manual = hash_string(__version__)
|
||||
self.assertEqual(hash_from_tag, hash_manual)
|
||||
|
||||
rendered = self.__render_template(
|
||||
"{% load admin_interface_tags %}"
|
||||
"{% get_admin_interface_nocache as version_md5_hash %}"
|
||||
"{{ version_md5_hash }}"
|
||||
)
|
||||
self.assertEqual(rendered, hash_manual)
|
||||
|
|
|
|||
Loading…
Reference in New Issue