aa-intel-tool 2.6.2__py3-none-any.whl → 2.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aa_intel_tool/__init__.py +1 -1
- aa_intel_tool/locale/cs_CZ/LC_MESSAGES/django.po +22 -22
- aa_intel_tool/locale/de/LC_MESSAGES/django.mo +0 -0
- aa_intel_tool/locale/de/LC_MESSAGES/django.po +26 -26
- aa_intel_tool/locale/django.pot +23 -23
- aa_intel_tool/locale/es/LC_MESSAGES/django.po +24 -22
- aa_intel_tool/locale/fr_FR/LC_MESSAGES/django.po +26 -22
- aa_intel_tool/locale/it_IT/LC_MESSAGES/django.po +22 -22
- aa_intel_tool/locale/ja/LC_MESSAGES/django.po +22 -22
- aa_intel_tool/locale/ko_KR/LC_MESSAGES/django.mo +0 -0
- aa_intel_tool/locale/ko_KR/LC_MESSAGES/django.po +31 -26
- aa_intel_tool/locale/nl_NL/LC_MESSAGES/django.po +22 -22
- aa_intel_tool/locale/pl_PL/LC_MESSAGES/django.po +22 -22
- aa_intel_tool/locale/ru/LC_MESSAGES/django.po +26 -22
- aa_intel_tool/locale/sk/LC_MESSAGES/django.po +22 -22
- aa_intel_tool/locale/uk/LC_MESSAGES/django.mo +0 -0
- aa_intel_tool/locale/uk/LC_MESSAGES/django.po +114 -113
- aa_intel_tool/locale/zh_Hans/LC_MESSAGES/django.po +24 -22
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan-highlight.js +2 -2
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan-highlight.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan-highlight.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan.js +57 -57
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan-highlight.js +2 -2
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan-highlight.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan-highlight.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan.js +115 -98
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition-highlight.js +2 -2
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition-highlight.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition-highlight.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition.js +60 -56
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-scan-result-common.js +2 -2
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-scan-result-common.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-scan-result-common.min.js.map +1 -1
- aa_intel_tool/templates/aa_intel_tool/base.html +4 -2
- aa_intel_tool/templates/aa_intel_tool/bundles/aa-intel-tool-chatscan-highlight-js.html +2 -2
- aa_intel_tool/templates/aa_intel_tool/bundles/aa-intel-tool-chatscan-js.html +2 -2
- aa_intel_tool/templates/aa_intel_tool/bundles/aa-intel-tool-css.html +2 -2
- aa_intel_tool/templates/aa_intel_tool/bundles/aa-intel-tool-dscan-highlight-js.html +2 -2
- aa_intel_tool/templates/aa_intel_tool/bundles/aa-intel-tool-dscan-js.html +2 -2
- aa_intel_tool/templates/aa_intel_tool/bundles/aa-intel-tool-fleetcomp-js.html +2 -2
- aa_intel_tool/templates/aa_intel_tool/bundles/aa-intel-tool-fleetcomposition-highlight-js.html +2 -2
- aa_intel_tool/templates/aa_intel_tool/bundles/aa-intel-tool-js.html +2 -2
- aa_intel_tool/templates/aa_intel_tool/bundles/aa-intel-tool-scan-result-common-js.html +2 -2
- aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/alliances.html +0 -2
- aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/corporations.html +0 -2
- aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html +0 -2
- aa_intel_tool/templates/aa_intel_tool/views/index.html +0 -7
- aa_intel_tool/tests/test_access.py +1 -7
- aa_intel_tool/tests/test_auth_hooks.py +1 -7
- {aa_intel_tool-2.6.2.dist-info → aa_intel_tool-2.7.0.dist-info}/METADATA +4 -4
- {aa_intel_tool-2.6.2.dist-info → aa_intel_tool-2.7.0.dist-info}/RECORD +59 -63
- aa_intel_tool/helper/static_files.py +0 -42
- aa_intel_tool/templatetags/__init__.py +0 -3
- aa_intel_tool/templatetags/aa_intel_tool.py +0 -88
- aa_intel_tool/tests/test_templatetags.py +0 -103
- {aa_intel_tool-2.6.2.dist-info → aa_intel_tool-2.7.0.dist-info}/WHEEL +0 -0
- {aa_intel_tool-2.6.2.dist-info → aa_intel_tool-2.7.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Versioned static URLs to break browser caches when changing the app version
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
# Standard Library
|
|
6
|
-
import os
|
|
7
|
-
|
|
8
|
-
# Django
|
|
9
|
-
from django.template.defaulttags import register
|
|
10
|
-
from django.templatetags.static import static
|
|
11
|
-
from django.utils.safestring import mark_safe
|
|
12
|
-
|
|
13
|
-
# Alliance Auth
|
|
14
|
-
from allianceauth.services.hooks import get_extension_logger
|
|
15
|
-
|
|
16
|
-
# Alliance Auth (External Libs)
|
|
17
|
-
from app_utils.logging import LoggerAddTag
|
|
18
|
-
|
|
19
|
-
# AA Intel Tool
|
|
20
|
-
from aa_intel_tool import __title__, __version__
|
|
21
|
-
from aa_intel_tool.app_settings import debug_enabled
|
|
22
|
-
from aa_intel_tool.constants import PACKAGE_NAME
|
|
23
|
-
from aa_intel_tool.helper.static_files import calculate_integrity_hash
|
|
24
|
-
|
|
25
|
-
logger = LoggerAddTag(my_logger=get_extension_logger(__name__), prefix=__title__)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
@register.simple_tag
|
|
29
|
-
def aa_intel_tool_static(
|
|
30
|
-
relative_file_path: str, script_type: str = None
|
|
31
|
-
) -> str | None:
|
|
32
|
-
"""
|
|
33
|
-
Versioned static URL
|
|
34
|
-
|
|
35
|
-
:param relative_file_path: The file path relative to the `{APP_NAME}/{PACKAGE_NAME}/static/{PACKAGE_NAME}` folder
|
|
36
|
-
:type relative_file_path: str
|
|
37
|
-
:param script_type: The script type
|
|
38
|
-
:type script_type: str
|
|
39
|
-
:return: Versioned static URL
|
|
40
|
-
:rtype: str
|
|
41
|
-
"""
|
|
42
|
-
|
|
43
|
-
logger.debug(f"Getting versioned static URL for: {relative_file_path}")
|
|
44
|
-
|
|
45
|
-
file_type = os.path.splitext(relative_file_path)[1][1:]
|
|
46
|
-
|
|
47
|
-
logger.debug(f"File extension: {file_type}")
|
|
48
|
-
|
|
49
|
-
# Only support CSS and JS files
|
|
50
|
-
if file_type not in ["css", "js"]:
|
|
51
|
-
raise ValueError(f"Unsupported file type: {file_type}")
|
|
52
|
-
|
|
53
|
-
static_file_path = os.path.join(PACKAGE_NAME, relative_file_path)
|
|
54
|
-
static_url = static(static_file_path)
|
|
55
|
-
|
|
56
|
-
# Integrity hash calculation only for non-debug mode
|
|
57
|
-
sri_string = (
|
|
58
|
-
f' integrity="{calculate_integrity_hash(relative_file_path)}" crossorigin="anonymous"'
|
|
59
|
-
if not debug_enabled()
|
|
60
|
-
else ""
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
# Versioned URL for CSS and JS files
|
|
64
|
-
# Add version query parameter to break browser caches when changing the app version
|
|
65
|
-
# Do not add version query parameter for libs as they are already versioned through their file path
|
|
66
|
-
versioned_url = (
|
|
67
|
-
static_url
|
|
68
|
-
if relative_file_path.startswith("libs/")
|
|
69
|
-
else static_url + "?v=" + __version__
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
return_value = None
|
|
73
|
-
|
|
74
|
-
# Return the versioned URL with integrity hash for CSS
|
|
75
|
-
if file_type == "css":
|
|
76
|
-
return_value = mark_safe(
|
|
77
|
-
f'<link rel="stylesheet" href="{versioned_url}"{sri_string}>'
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
# Return the versioned URL with integrity hash for JS files
|
|
81
|
-
if file_type == "js":
|
|
82
|
-
js_type = f' type="{script_type}"' if script_type else ""
|
|
83
|
-
|
|
84
|
-
return_value = mark_safe(
|
|
85
|
-
f'<script{js_type} src="{versioned_url}"{sri_string}></script>'
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
return return_value
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Tests for the template tags
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
# Django
|
|
6
|
-
from django.template import Context, Template
|
|
7
|
-
from django.test import TestCase, override_settings
|
|
8
|
-
|
|
9
|
-
# AA Intel Tool
|
|
10
|
-
from aa_intel_tool import __version__
|
|
11
|
-
from aa_intel_tool.constants import PACKAGE_NAME
|
|
12
|
-
from aa_intel_tool.helper.static_files import calculate_integrity_hash
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class TestVersionedStatic(TestCase):
|
|
16
|
-
"""
|
|
17
|
-
Tests for aa_intel_tool template tag
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
@override_settings(DEBUG=False)
|
|
21
|
-
def test_versioned_static(self):
|
|
22
|
-
"""
|
|
23
|
-
Test should return static URL string with a version
|
|
24
|
-
:return:
|
|
25
|
-
"""
|
|
26
|
-
|
|
27
|
-
context = Context(dict_={"version": __version__})
|
|
28
|
-
|
|
29
|
-
template_to_render = Template(
|
|
30
|
-
template_string=(
|
|
31
|
-
"{% load aa_intel_tool %}"
|
|
32
|
-
"{% aa_intel_tool_static 'css/aa-intel-tool.min.css' %}"
|
|
33
|
-
"{% aa_intel_tool_static 'javascript/aa-intel-tool.min.js' %}"
|
|
34
|
-
)
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
rendered_template = template_to_render.render(context=context)
|
|
38
|
-
|
|
39
|
-
expected_static_css_src = (
|
|
40
|
-
f'/static/{PACKAGE_NAME}/css/aa-intel-tool.min.css?v={context["version"]}'
|
|
41
|
-
)
|
|
42
|
-
expected_static_css_src_integrity = calculate_integrity_hash(
|
|
43
|
-
"css/aa-intel-tool.min.css"
|
|
44
|
-
)
|
|
45
|
-
expected_static_js_src = f'/static/{PACKAGE_NAME}/javascript/aa-intel-tool.min.js?v={context["version"]}'
|
|
46
|
-
expected_static_js_src_integrity = calculate_integrity_hash(
|
|
47
|
-
"javascript/aa-intel-tool.min.js"
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
self.assertIn(member=expected_static_css_src, container=rendered_template)
|
|
51
|
-
self.assertIn(
|
|
52
|
-
member=expected_static_css_src_integrity, container=rendered_template
|
|
53
|
-
)
|
|
54
|
-
self.assertIn(member=expected_static_js_src, container=rendered_template)
|
|
55
|
-
self.assertIn(
|
|
56
|
-
member=expected_static_js_src_integrity, container=rendered_template
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
@override_settings(DEBUG=True)
|
|
60
|
-
def test_versioned_static_with_debug_enabled(self) -> None:
|
|
61
|
-
"""
|
|
62
|
-
Test versioned static template tag with DEBUG enabled
|
|
63
|
-
|
|
64
|
-
:return:
|
|
65
|
-
:rtype:
|
|
66
|
-
"""
|
|
67
|
-
|
|
68
|
-
context = Context({"version": __version__})
|
|
69
|
-
template_to_render = Template(
|
|
70
|
-
template_string=(
|
|
71
|
-
"{% load aa_intel_tool %}"
|
|
72
|
-
"{% aa_intel_tool_static 'css/aa-intel-tool.min.css' %}"
|
|
73
|
-
)
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
rendered_template = template_to_render.render(context=context)
|
|
77
|
-
|
|
78
|
-
expected_static_css_src = (
|
|
79
|
-
f'/static/{PACKAGE_NAME}/css/aa-intel-tool.min.css?v={context["version"]}'
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
self.assertIn(member=expected_static_css_src, container=rendered_template)
|
|
83
|
-
self.assertNotIn(member="integrity=", container=rendered_template)
|
|
84
|
-
|
|
85
|
-
@override_settings(DEBUG=False)
|
|
86
|
-
def test_invalid_file_type(self) -> None:
|
|
87
|
-
"""
|
|
88
|
-
Test should raise a ValueError for an invalid file type
|
|
89
|
-
|
|
90
|
-
:return:
|
|
91
|
-
:rtype:
|
|
92
|
-
"""
|
|
93
|
-
|
|
94
|
-
context = Context({"version": __version__})
|
|
95
|
-
template_to_render = Template(
|
|
96
|
-
template_string=(
|
|
97
|
-
"{% load aa_intel_tool %}"
|
|
98
|
-
"{% aa_intel_tool_static 'invalid/invalid.txt' %}"
|
|
99
|
-
)
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
with self.assertRaises(ValueError):
|
|
103
|
-
template_to_render.render(context=context)
|
|
File without changes
|
|
File without changes
|