aa-intel-tool 0.0.1a13__py3-none-any.whl → 1.0.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 +4 -1
- aa_intel_tool/app_settings.py +1 -1
- aa_intel_tool/apps.py +1 -1
- aa_intel_tool/constants.py +5 -2
- aa_intel_tool/locale/de/LC_MESSAGES/django.mo +0 -0
- aa_intel_tool/locale/de/LC_MESSAGES/django.po +139 -148
- aa_intel_tool/locale/django.pot +111 -105
- aa_intel_tool/locale/es/LC_MESSAGES/django.mo +0 -0
- aa_intel_tool/locale/es/LC_MESSAGES/django.po +135 -124
- aa_intel_tool/locale/fr_FR/LC_MESSAGES/django.po +111 -105
- aa_intel_tool/locale/it_IT/LC_MESSAGES/django.po +111 -105
- aa_intel_tool/locale/ja/LC_MESSAGES/django.po +111 -105
- aa_intel_tool/locale/ko_KR/LC_MESSAGES/django.mo +0 -0
- aa_intel_tool/locale/ko_KR/LC_MESSAGES/django.po +127 -121
- aa_intel_tool/locale/ru/LC_MESSAGES/django.mo +0 -0
- aa_intel_tool/locale/ru/LC_MESSAGES/django.po +222 -200
- aa_intel_tool/locale/uk/LC_MESSAGES/django.mo +0 -0
- aa_intel_tool/locale/uk/LC_MESSAGES/django.po +121 -117
- aa_intel_tool/locale/zh_Hans/LC_MESSAGES/django.po +111 -105
- aa_intel_tool/migrations/0001_initial.py +70 -15
- aa_intel_tool/models.py +3 -2
- aa_intel_tool/parser/module/chatlist.py +53 -40
- aa_intel_tool/parser/module/fleetcomp.py +130 -34
- aa_intel_tool/scripts/drop_tables.sql +5 -0
- aa_intel_tool/static/aa_intel_tool/css/aa-bootstrap-fix.css +1 -1
- aa_intel_tool/static/aa_intel_tool/css/aa-bootstrap-fix.min.css +2 -1
- aa_intel_tool/static/aa_intel_tool/css/aa-bootstrap-fix.min.css.map +1 -0
- aa_intel_tool/static/aa_intel_tool/css/aa-intel-tool.min.css +2 -1
- aa_intel_tool/static/aa_intel_tool/css/aa-intel-tool.min.css.map +1 -0
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan-highlight.js +24 -24
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan-highlight.min.js +2 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan-highlight.min.js.map +1 -0
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan.js +13 -199
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan.min.js +2 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan.min.js.map +1 -0
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan-highlight.js +26 -26
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan-highlight.min.js +2 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan-highlight.min.js.map +1 -0
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan.js +19 -49
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan.min.js +2 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan.min.js.map +1 -0
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition-highlight.js +148 -0
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition-highlight.min.js +2 -0
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition-highlight.min.js.map +1 -0
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition.js +231 -0
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition.min.js +2 -0
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition.min.js.map +1 -0
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-scan-result-common.js +216 -0
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-scan-result-common.min.js +2 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-scan-result-common.min.js.map +1 -0
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool.min.js +2 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool.min.js.map +1 -0
- aa_intel_tool/templates/aa_intel_tool/base.html +1 -1
- aa_intel_tool/templates/aa_intel_tool/bundles/aa-intel-tool-fleetcomp-js.html +10 -0
- aa_intel_tool/templates/aa_intel_tool/bundles/aa-intel-tool-js-l10n.html +2 -2
- aa_intel_tool/templates/aa_intel_tool/partials/index/form.html +6 -2
- aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/alliances.html +1 -4
- aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/corporations.html +1 -4
- aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html +1 -1
- aa_intel_tool/templates/aa_intel_tool/partials/scan/dscan/interesting-on-grid/items.html +2 -1
- aa_intel_tool/templates/aa_intel_tool/partials/scan/dscan/interesting-on-grid.html +9 -6
- aa_intel_tool/templates/aa_intel_tool/partials/scan/dscan/ships-breakdown/ship-classes.html +5 -1
- aa_intel_tool/templates/aa_intel_tool/partials/scan/dscan/ships-breakdown/ship-types.html +2 -2
- aa_intel_tool/templates/aa_intel_tool/partials/scan/dscan/ships-breakdown.html +7 -4
- aa_intel_tool/templates/aa_intel_tool/partials/scan/dscan/system-information.html +4 -1
- aa_intel_tool/templates/aa_intel_tool/partials/scan/fleetcomp/fleet-details/pilots.html +41 -0
- aa_intel_tool/templates/aa_intel_tool/partials/scan/fleetcomp/fleet-details.html +24 -0
- aa_intel_tool/templates/aa_intel_tool/partials/scan/fleetcomp/participation.html +18 -0
- aa_intel_tool/templates/aa_intel_tool/views/index.html +1 -1
- aa_intel_tool/templates/aa_intel_tool/views/scan/chatlist.html +2 -4
- aa_intel_tool/templates/aa_intel_tool/views/scan/dscan.html +2 -4
- aa_intel_tool/templates/aa_intel_tool/views/scan/fleetcomp.html +47 -0
- aa_intel_tool/tests/test-data/fleetcomp.txt +1 -0
- aa_intel_tool/tests/test_access.py +3 -3
- aa_intel_tool/tests/test_admin.py +86 -0
- aa_intel_tool/tests/test_auth_hooks.py +3 -3
- aa_intel_tool/tests/test_helper_data_structures.py +1 -1
- aa_intel_tool/tests/test_parser.py +17 -16
- aa_intel_tool/tests/test_parser_helper_db.py +60 -0
- aa_intel_tool/tests/utils.py +0 -87
- aa_intel_tool/views/general.py +16 -7
- {aa_intel_tool-0.0.1a13.dist-info → aa_intel_tool-1.0.0.dist-info}/METADATA +28 -20
- aa_intel_tool-1.0.0.dist-info/RECORD +123 -0
- aa_intel_tool/migrations/0002_remove_scan_processed_data_scandata.py +0 -69
- aa_intel_tool/migrations/0003_alter_scandata_scan.py +0 -27
- aa_intel_tool/migrations/0004_alter_scandata_section.py +0 -34
- aa_intel_tool/migrations/0005_alter_scan_options_alter_scandata_options_and_more.py +0 -94
- aa_intel_tool/migrations/0006_alter_scandata_unique_together.py +0 -17
- aa_intel_tool/migrations/0007_alter_scandata_section.py +0 -37
- aa_intel_tool-0.0.1a13.dist-info/RECORD +0 -105
- {aa_intel_tool-0.0.1a13.dist-info → aa_intel_tool-1.0.0.dist-info}/WHEEL +0 -0
- {aa_intel_tool-0.0.1a13.dist-info → aa_intel_tool-1.0.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{% extends "aa_intel_tool/base.html" %}
|
|
2
|
+
|
|
3
|
+
{% load i18n %}
|
|
4
|
+
|
|
5
|
+
{% block page_title %}{{ parser_title|title }} » {% translate "Intel Parser" %}{% endblock %}
|
|
6
|
+
|
|
7
|
+
{% block aa_intel_tool_header %}
|
|
8
|
+
<header>
|
|
9
|
+
<h1>{{ parser_title|title }}</h1>
|
|
10
|
+
</header>
|
|
11
|
+
|
|
12
|
+
{% include "aa_intel_tool/partials/scan/evetime.html" %}
|
|
13
|
+
{% include "aa_intel_tool/partials/scan/buttons.html" %}
|
|
14
|
+
{% endblock %}
|
|
15
|
+
|
|
16
|
+
{% block aa_intel_tool_body %}
|
|
17
|
+
{% include "aa_intel_tool/partials/scan/fleetcomp/fleet-details.html" %}
|
|
18
|
+
|
|
19
|
+
{% if app_settings.INTELTOOL_ENABLE_MODULE_CHATSCAN %}
|
|
20
|
+
{% include "aa_intel_tool/partials/scan/fleetcomp/participation.html" %}
|
|
21
|
+
{% endif %}
|
|
22
|
+
{% endblock %}
|
|
23
|
+
|
|
24
|
+
{% block extra_css %}
|
|
25
|
+
{% include "bundles/datatables-css.html" %}
|
|
26
|
+
{% include "aa_intel_tool/bundles/aa-intel-tool-css.html" %}
|
|
27
|
+
{% endblock %}
|
|
28
|
+
|
|
29
|
+
{% block extra_javascript %}
|
|
30
|
+
<script>
|
|
31
|
+
const aaIntelToolJsOptions = {
|
|
32
|
+
ajax: {
|
|
33
|
+
getShipClasses: '{% url "aa_intel_tool:ajax_get_scan_data" scan_hash scan_data_section.SHIPLIST.value %}',
|
|
34
|
+
getShipTypes: '{% url "aa_intel_tool:ajax_get_scan_data" scan_hash scan_data_section.SHIPTYPES.value %}',
|
|
35
|
+
getFleetComposition: '{% url "aa_intel_tool:ajax_get_scan_data" scan_hash scan_data_section.FLEETCOMPOSITION.value %}',
|
|
36
|
+
getPilotList: '{% url "aa_intel_tool:ajax_get_scan_data" scan_hash scan_data_section.PILOTLIST.value %}',
|
|
37
|
+
getCorporationList: '{% url "aa_intel_tool:ajax_get_scan_data" scan_hash scan_data_section.CORPORATIONLIST.value %}',
|
|
38
|
+
getAllianceList: '{% url "aa_intel_tool:ajax_get_scan_data" scan_hash scan_data_section.ALLIANCELIST.value %}'
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
{% include "bundles/datatables-js.html" %}
|
|
44
|
+
{% include "bundles/clipboard-js.html" %}
|
|
45
|
+
{% include "aa_intel_tool/bundles/aa-intel-tool-js-l10n.html" %}
|
|
46
|
+
{% include "aa_intel_tool/bundles/aa-intel-tool-fleetcomp-js.html" %}
|
|
47
|
+
{% endblock extra_javascript %}
|
|
@@ -9,8 +9,8 @@ from http import HTTPStatus
|
|
|
9
9
|
from django.test import TestCase
|
|
10
10
|
from django.urls import reverse
|
|
11
11
|
|
|
12
|
-
#
|
|
13
|
-
from
|
|
12
|
+
# Alliance Auth (External Libs)
|
|
13
|
+
from app_utils.testing import create_fake_user
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class TestAccess(TestCase):
|
|
@@ -35,7 +35,7 @@ class TestAccess(TestCase):
|
|
|
35
35
|
<li>
|
|
36
36
|
<a class="active" href="{reverse('aa_intel_tool:intel_tool_index')}">
|
|
37
37
|
<i class="fas fa-clipboard-list fa-fw"></i>
|
|
38
|
-
Intel
|
|
38
|
+
Intel Parser
|
|
39
39
|
</a>
|
|
40
40
|
</li>
|
|
41
41
|
"""
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Test for admin.py
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Django
|
|
6
|
+
from django.test import TestCase
|
|
7
|
+
from django.urls import reverse
|
|
8
|
+
|
|
9
|
+
# Alliance Auth (External Libs)
|
|
10
|
+
from app_utils.testing import create_fake_user
|
|
11
|
+
|
|
12
|
+
# AA Intel Tool
|
|
13
|
+
from aa_intel_tool.admin import BaseReadOnlyAdminMixin
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class TestAdmin(TestCase):
|
|
17
|
+
"""
|
|
18
|
+
The tests
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
def setUpClass(cls) -> None:
|
|
23
|
+
"""
|
|
24
|
+
Set up groups and users
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
super().setUpClass()
|
|
28
|
+
|
|
29
|
+
# User
|
|
30
|
+
cls.user_1001 = create_fake_user(
|
|
31
|
+
character_id=1001, character_name="Peter Parker"
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
def test_has_add_permission_returns_false(self):
|
|
35
|
+
"""
|
|
36
|
+
Test if admin.BaseReadOnlyAdminMixin.has_add_permission returns False
|
|
37
|
+
|
|
38
|
+
:return:
|
|
39
|
+
:rtype:
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
self.client.force_login(user=self.user_1001)
|
|
43
|
+
|
|
44
|
+
response = self.client.get(
|
|
45
|
+
path=reverse(viewname="aa_intel_tool:intel_tool_index")
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
has_permission = BaseReadOnlyAdminMixin.has_add_permission(request=response)
|
|
49
|
+
|
|
50
|
+
self.assertFalse(expr=has_permission)
|
|
51
|
+
|
|
52
|
+
def test_has_change_permission_returns_false(self):
|
|
53
|
+
"""
|
|
54
|
+
Test if admin.BaseReadOnlyAdminMixin.has_change_permission returns False
|
|
55
|
+
|
|
56
|
+
:return:
|
|
57
|
+
:rtype:
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
self.client.force_login(user=self.user_1001)
|
|
61
|
+
|
|
62
|
+
response = self.client.get(
|
|
63
|
+
path=reverse(viewname="aa_intel_tool:intel_tool_index")
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
has_permission = BaseReadOnlyAdminMixin.has_change_permission(request=response)
|
|
67
|
+
|
|
68
|
+
self.assertFalse(expr=has_permission)
|
|
69
|
+
|
|
70
|
+
def test_has_delete_permission_returns_false(self):
|
|
71
|
+
"""
|
|
72
|
+
Test if admin.BaseReadOnlyAdminMixin.has_delete_permission returns False
|
|
73
|
+
|
|
74
|
+
:return:
|
|
75
|
+
:rtype:
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
self.client.force_login(user=self.user_1001)
|
|
79
|
+
|
|
80
|
+
response = self.client.get(
|
|
81
|
+
path=reverse(viewname="aa_intel_tool:intel_tool_index")
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
has_permission = BaseReadOnlyAdminMixin.has_delete_permission(request=response)
|
|
85
|
+
|
|
86
|
+
self.assertFalse(expr=has_permission)
|
|
@@ -9,8 +9,8 @@ from http import HTTPStatus
|
|
|
9
9
|
from django.test import TestCase
|
|
10
10
|
from django.urls import reverse
|
|
11
11
|
|
|
12
|
-
#
|
|
13
|
-
from
|
|
12
|
+
# Alliance Auth (External Libs)
|
|
13
|
+
from app_utils.testing import create_fake_user
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class TestHooks(TestCase):
|
|
@@ -35,7 +35,7 @@ class TestHooks(TestCase):
|
|
|
35
35
|
<li>
|
|
36
36
|
<a class href="{reverse('aa_intel_tool:intel_tool_index')}">
|
|
37
37
|
<i class="fas fa-clipboard-list fa-fw"></i>
|
|
38
|
-
Intel
|
|
38
|
+
Intel Parser
|
|
39
39
|
</a>
|
|
40
40
|
</li>
|
|
41
41
|
"""
|
|
@@ -8,8 +8,9 @@ from django.test import TestCase
|
|
|
8
8
|
# AA Intel Tool
|
|
9
9
|
from aa_intel_tool.exceptions import ParserError
|
|
10
10
|
from aa_intel_tool.parser.general import check_intel_type, parse_intel
|
|
11
|
-
from aa_intel_tool.tests.utils import (
|
|
11
|
+
from aa_intel_tool.tests.utils import (
|
|
12
12
|
load_chatscan_faulty_txt,
|
|
13
|
+
load_chatscan_txt,
|
|
13
14
|
load_dscan_txt,
|
|
14
15
|
load_fleetcomp_txt,
|
|
15
16
|
)
|
|
@@ -36,21 +37,21 @@ class TestParserGeneral(TestCase):
|
|
|
36
37
|
|
|
37
38
|
self.assertEqual(first=intel_type, second=expected_intel_type)
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
40
|
+
def test_check_intel_type_chatlist(self):
|
|
41
|
+
"""
|
|
42
|
+
Test should return 'chatlist' as the expected intel type
|
|
43
|
+
|
|
44
|
+
:return:
|
|
45
|
+
:rtype:
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
form_data = load_chatscan_txt()
|
|
49
|
+
scan_data = str(form_data).splitlines()
|
|
50
|
+
|
|
51
|
+
intel_type = check_intel_type(scan_data=scan_data)
|
|
52
|
+
expected_intel_type = "chatlist"
|
|
53
|
+
|
|
54
|
+
self.assertEqual(first=intel_type, second=expected_intel_type)
|
|
54
55
|
|
|
55
56
|
def test_check_intel_type_fleetcomp(self):
|
|
56
57
|
"""
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tests for the parsers' DB helper => aa_intel_tool/parser/helper/db.py
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Django
|
|
6
|
+
from django.test import TestCase
|
|
7
|
+
|
|
8
|
+
# AA Intel Tool
|
|
9
|
+
from aa_intel_tool.models import Scan, ScanData
|
|
10
|
+
from aa_intel_tool.parser.helper.db import safe_scan_to_db
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TestParserHelperDb(TestCase):
|
|
14
|
+
"""
|
|
15
|
+
The tests
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def test_safe_scan_to_db_without_associated_data(self):
|
|
19
|
+
"""
|
|
20
|
+
Test that the scan is successfully saved to the DB
|
|
21
|
+
|
|
22
|
+
:return:
|
|
23
|
+
:rtype:
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
new_scan = safe_scan_to_db(scan_type=Scan.Type.DSCAN, parsed_data={})
|
|
27
|
+
|
|
28
|
+
from_db = Scan.objects.get(pk=new_scan.hash, scan_type__exact=Scan.Type.DSCAN)
|
|
29
|
+
|
|
30
|
+
self.assertEqual(first=new_scan.hash, second=from_db.hash)
|
|
31
|
+
|
|
32
|
+
def test_safe_scan_to_db_with_associated_data(self):
|
|
33
|
+
"""
|
|
34
|
+
Test that the scan is successfully saved to the DB
|
|
35
|
+
|
|
36
|
+
:return:
|
|
37
|
+
:rtype:
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
parsed_data = {
|
|
41
|
+
"foobar": {
|
|
42
|
+
"section": ScanData.Section.PILOTLIST,
|
|
43
|
+
"data": {"name": "William Riker"},
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
new_scan = safe_scan_to_db(scan_type=Scan.Type.DSCAN, parsed_data=parsed_data)
|
|
48
|
+
|
|
49
|
+
scan_from_db = Scan.objects.get(
|
|
50
|
+
pk=new_scan.hash, scan_type__exact=Scan.Type.DSCAN
|
|
51
|
+
)
|
|
52
|
+
scan_data_from_db = ScanData.objects.get(
|
|
53
|
+
scan_id__exact=scan_from_db.hash,
|
|
54
|
+
section__exact=ScanData.Section.PILOTLIST,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
self.assertEqual(first=new_scan.hash, second=scan_from_db.hash)
|
|
58
|
+
self.assertEqual(
|
|
59
|
+
first=scan_data_from_db.processed_data, second=parsed_data["foobar"]["data"]
|
|
60
|
+
)
|
aa_intel_tool/tests/utils.py
CHANGED
|
@@ -3,98 +3,11 @@ Helper for our tests
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
# Standard Library
|
|
6
|
-
import re
|
|
7
6
|
from pathlib import Path
|
|
8
|
-
from typing import List
|
|
9
|
-
|
|
10
|
-
# Third Party
|
|
11
|
-
from faker import Faker
|
|
12
7
|
|
|
13
8
|
# Django
|
|
14
|
-
from django.contrib.auth.models import User
|
|
15
9
|
from django.template import Context, Template
|
|
16
10
|
|
|
17
|
-
# Alliance Auth
|
|
18
|
-
from allianceauth.tests.auth_utils import AuthUtils
|
|
19
|
-
|
|
20
|
-
fake = Faker()
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def create_fake_user( # pylint: disable=too-many-arguments
|
|
24
|
-
character_id: int,
|
|
25
|
-
character_name: str,
|
|
26
|
-
corporation_id: int = None,
|
|
27
|
-
corporation_name: str = None,
|
|
28
|
-
corporation_ticker: str = None,
|
|
29
|
-
permissions: List[str] = None,
|
|
30
|
-
**kwargs,
|
|
31
|
-
) -> User:
|
|
32
|
-
"""
|
|
33
|
-
Create a fake user including its main character and (optional) permissions.
|
|
34
|
-
:param character_id:
|
|
35
|
-
:param character_name:
|
|
36
|
-
:param corporation_id:
|
|
37
|
-
:param corporation_name:
|
|
38
|
-
:param corporation_ticker:
|
|
39
|
-
:param permissions:
|
|
40
|
-
:param kwargs:
|
|
41
|
-
:return:
|
|
42
|
-
"""
|
|
43
|
-
|
|
44
|
-
username = re.sub(pattern=r"[^\w\d@.+-]", repl="_", string=character_name)
|
|
45
|
-
user = AuthUtils.create_user(username=username)
|
|
46
|
-
|
|
47
|
-
if not corporation_id:
|
|
48
|
-
corporation_id = 2001
|
|
49
|
-
corporation_name = "Wayne Technologies Inc."
|
|
50
|
-
corporation_ticker = "WTE"
|
|
51
|
-
|
|
52
|
-
alliance_id = kwargs.get("alliance_id", 3001)
|
|
53
|
-
alliance_name = (
|
|
54
|
-
kwargs.get("alliance_name", "Wayne Enterprises")
|
|
55
|
-
if alliance_id is not None
|
|
56
|
-
else ""
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
AuthUtils.add_main_character_2(
|
|
60
|
-
user=user,
|
|
61
|
-
name=character_name,
|
|
62
|
-
character_id=character_id,
|
|
63
|
-
corp_id=corporation_id,
|
|
64
|
-
corp_name=corporation_name,
|
|
65
|
-
corp_ticker=corporation_ticker,
|
|
66
|
-
alliance_id=alliance_id,
|
|
67
|
-
alliance_name=alliance_name,
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
if permissions:
|
|
71
|
-
perm_objs = [
|
|
72
|
-
AuthUtils.get_permission_by_name(perm=perm) for perm in permissions
|
|
73
|
-
]
|
|
74
|
-
user = AuthUtils.add_permissions_to_user(perms=perm_objs, user=user)
|
|
75
|
-
|
|
76
|
-
return user
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
def get_or_create_fake_user(*args, **kwargs) -> User:
|
|
80
|
-
"""
|
|
81
|
-
Same as create_fake_user but will not fail when user already exists.
|
|
82
|
-
"""
|
|
83
|
-
|
|
84
|
-
if len(args) > 1:
|
|
85
|
-
character_name = args[1]
|
|
86
|
-
elif "character_name" in kwargs:
|
|
87
|
-
character_name = kwargs["character_name"]
|
|
88
|
-
else:
|
|
89
|
-
ValueError("character_name is not defined")
|
|
90
|
-
|
|
91
|
-
username = character_name.replace("'", "").replace(" ", "_")
|
|
92
|
-
|
|
93
|
-
try:
|
|
94
|
-
return User.objects.get(username=username)
|
|
95
|
-
except User.DoesNotExist: # pylint: disable=no-member
|
|
96
|
-
return create_fake_user(*args, **kwargs)
|
|
97
|
-
|
|
98
11
|
|
|
99
12
|
def render_template(string, context=None):
|
|
100
13
|
"""
|
aa_intel_tool/views/general.py
CHANGED
|
@@ -9,13 +9,23 @@ from django.http import HttpResponse
|
|
|
9
9
|
from django.shortcuts import redirect, render
|
|
10
10
|
from django.utils.translation import gettext_lazy as _
|
|
11
11
|
|
|
12
|
+
# Alliance Auth
|
|
13
|
+
from allianceauth.services.hooks import get_extension_logger
|
|
14
|
+
|
|
15
|
+
# Alliance Auth (External Libs)
|
|
16
|
+
from app_utils.logging import LoggerAddTag
|
|
17
|
+
|
|
12
18
|
# AA Intel Tool
|
|
19
|
+
from aa_intel_tool import __title__
|
|
13
20
|
from aa_intel_tool.app_settings import AppSettings
|
|
21
|
+
from aa_intel_tool.constants import SUPPORTED_INTEL_TYPES
|
|
14
22
|
from aa_intel_tool.exceptions import ParserError
|
|
15
23
|
from aa_intel_tool.form import IntelForm
|
|
16
24
|
from aa_intel_tool.models import Scan, ScanData
|
|
17
25
|
from aa_intel_tool.parser.general import parse_intel
|
|
18
26
|
|
|
27
|
+
logger = LoggerAddTag(my_logger=get_extension_logger(name=__name__), prefix=__title__)
|
|
28
|
+
|
|
19
29
|
|
|
20
30
|
def index(request: WSGIRequest) -> HttpResponse:
|
|
21
31
|
"""
|
|
@@ -91,6 +101,8 @@ def scan(request: WSGIRequest, scan_hash: str):
|
|
|
91
101
|
|
|
92
102
|
return redirect(to="aa_intel_tool:intel_tool_index")
|
|
93
103
|
|
|
104
|
+
logger.debug(msg=f"Intel Type: {intel_scan.scan_type}")
|
|
105
|
+
|
|
94
106
|
scan_data = {
|
|
95
107
|
"scan_type": intel_scan.scan_type,
|
|
96
108
|
"created": intel_scan.created,
|
|
@@ -101,17 +113,14 @@ def scan(request: WSGIRequest, scan_hash: str):
|
|
|
101
113
|
"scan_hash": scan_hash,
|
|
102
114
|
"scan": scan_data,
|
|
103
115
|
"scan_data_section": ScanData.Section,
|
|
116
|
+
"parser_title": SUPPORTED_INTEL_TYPES[intel_scan.scan_type]["name"],
|
|
117
|
+
"app_settings": AppSettings,
|
|
104
118
|
}
|
|
105
119
|
|
|
106
|
-
|
|
107
|
-
"chatlist": "aa_intel_tool/views/scan/chatlist.html",
|
|
108
|
-
"dscan": "aa_intel_tool/views/scan/dscan.html",
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if intel_scan.scan_type in scan_type_templates:
|
|
120
|
+
if intel_scan.scan_type in SUPPORTED_INTEL_TYPES:
|
|
112
121
|
return render(
|
|
113
122
|
request=request,
|
|
114
|
-
template_name=
|
|
123
|
+
template_name=SUPPORTED_INTEL_TYPES[intel_scan.scan_type]["template"],
|
|
115
124
|
context=context,
|
|
116
125
|
)
|
|
117
126
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: aa-intel-tool
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: A simple parser for D-Scans and more for Alliance Auth
|
|
5
5
|
Project-URL: Changelog, https://github.com/ppfeufer/aa-intel-tool/blob/master/CHANGELOG.md
|
|
6
6
|
Project-URL: Documentation, https://github.com/ppfeufer/aa-intel-tool/blob/master/README.md
|
|
@@ -692,7 +692,7 @@ Classifier: Intended Audience :: Developers
|
|
|
692
692
|
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
693
693
|
Classifier: Operating System :: OS Independent
|
|
694
694
|
Classifier: Programming Language :: Python
|
|
695
|
-
Classifier: Programming Language :: Python :: 3
|
|
695
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
696
696
|
Classifier: Programming Language :: Python :: 3.8
|
|
697
697
|
Classifier: Programming Language :: Python :: 3.9
|
|
698
698
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -733,6 +733,7 @@ ______________________________________________________________________
|
|
|
733
733
|
- [Screenshots](#screenshots)
|
|
734
734
|
- [Chat Scan](#chat-scan)
|
|
735
735
|
- [D-Scan](#d-scan)
|
|
736
|
+
- [Fleet Composition](#fleet-composition)
|
|
736
737
|
- [Installation](#installation)
|
|
737
738
|
- [Step 1: Install the Package](#step-1-install-the-package)
|
|
738
739
|
- [Step 2: Configure Alliance Auth](#step-2-configure-alliance-auth)
|
|
@@ -746,26 +747,21 @@ ______________________________________________________________________
|
|
|
746
747
|
- [Nginx](#nginx)
|
|
747
748
|
- [Settings](#settings)
|
|
748
749
|
- [Changelog](#changelog)
|
|
750
|
+
- [Translation Status](#translation-status)
|
|
749
751
|
- [Contributing](#contributing)
|
|
750
752
|
|
|
751
753
|
<!-- mdformat-toc end -->
|
|
752
754
|
|
|
753
755
|
______________________________________________________________________
|
|
754
756
|
|
|
755
|
-
> **
|
|
756
|
-
>
|
|
757
|
-
> This app is still in active development and only available as an early alpha
|
|
758
|
-
> version. Do not install this app in your live environment. If you want to test
|
|
759
|
-
> this app, do so in a dedicated test environment. Don't come crying if you wreck
|
|
760
|
-
> your live environment.
|
|
761
|
-
>
|
|
762
|
-
> During the alpha phase, it is highly likely that the DB migrations will be reset a
|
|
763
|
-
> couple of times.
|
|
757
|
+
> **Note**
|
|
764
758
|
>
|
|
765
|
-
>
|
|
766
|
-
>
|
|
759
|
+
> This app makes use of a feature introduced with Alliance Auth v3.6.1, meaning,
|
|
760
|
+
> installing this app will pull in Alliance Auth v3.6.1 unsupervised if you haven't
|
|
761
|
+
> updated yet.
|
|
767
762
|
>
|
|
768
|
-
>
|
|
763
|
+
> **Please make sure to update Allianceauth to version 3.6.1 or higher before you
|
|
764
|
+
> install this app to avoid any complications.**
|
|
769
765
|
|
|
770
766
|
## Overview<a name="overview"></a>
|
|
771
767
|
|
|
@@ -787,6 +783,10 @@ See [Settings](#settings) section for details.
|
|
|
787
783
|
|
|
788
784
|
![Image: D-Scan Module]
|
|
789
785
|
|
|
786
|
+
#### Fleet Composition<a name="fleet-composition"></a>
|
|
787
|
+
|
|
788
|
+
![Image: Fleet Composition Module]
|
|
789
|
+
|
|
790
790
|
## Installation<a name="installation"></a>
|
|
791
791
|
|
|
792
792
|
**Important**: Please make sure you meet all preconditions before you proceed:
|
|
@@ -895,8 +895,8 @@ Open your vhost configuration and add the following 2 lines right after the
|
|
|
895
895
|
`ProxyPreserveHost On` directive:
|
|
896
896
|
|
|
897
897
|
```apache
|
|
898
|
-
Timeout 600
|
|
899
898
|
ProxyTimeout 600
|
|
899
|
+
Timeout 600
|
|
900
900
|
```
|
|
901
901
|
|
|
902
902
|
Restart your Apache2 service.
|
|
@@ -908,8 +908,8 @@ directive:
|
|
|
908
908
|
|
|
909
909
|
```nginx
|
|
910
910
|
proxy_connect_timeout 600;
|
|
911
|
-
proxy_send_timeout 600;
|
|
912
911
|
proxy_read_timeout 600;
|
|
912
|
+
proxy_send_timeout 600;
|
|
913
913
|
send_timeout 600;
|
|
914
914
|
```
|
|
915
915
|
|
|
@@ -947,6 +947,13 @@ your `local.py`.
|
|
|
947
947
|
|
|
948
948
|
See [CHANGELOG.md]
|
|
949
949
|
|
|
950
|
+
## Translation Status<a name="translation-status"></a>
|
|
951
|
+
|
|
952
|
+
[](https://weblate.ppfeufer.de/engage/alliance-auth-apps/)
|
|
953
|
+
|
|
954
|
+
Do you want to help translate this app into your language or improve the existing
|
|
955
|
+
translation? - [Join our team of translators][weblate engage]!
|
|
956
|
+
|
|
950
957
|
## Contributing<a name="contributing"></a>
|
|
951
958
|
|
|
952
959
|
Do you want to contribute to this project? That's cool!
|
|
@@ -959,7 +966,7 @@ Please make sure to read the [Contribution Guidelines]
|
|
|
959
966
|
[aa intel tool license]: https://github.com/ppfeufer/aa-intel-tool/blob/master/LICENSE
|
|
960
967
|
[aa intel tool on codecov]: https://codecov.io/gh/ppfeufer/aa-intel-tool
|
|
961
968
|
[aa intel tool on pypi]: https://pypi.org/project/aa-intel-tool/
|
|
962
|
-
[alliance auth]: https://gitlab.com/allianceauth/allianceauth
|
|
969
|
+
[alliance auth]: https://gitlab.com/allianceauth/allianceauth "Alliance Auth on GitLab"
|
|
963
970
|
[alliance auth installation guide]: https://allianceauth.readthedocs.io/en/latest/installation/allianceauth.html
|
|
964
971
|
[automated tests on github]: https://github.com/ppfeufer/aa-intel-tool/actions/workflows/automated-checks.yml
|
|
965
972
|
[badge: automated tests]: https://github.com/ppfeufer/aa-intel-tool/actions/workflows/automated-checks.yml/badge.svg "Automated Tests"
|
|
@@ -977,10 +984,11 @@ Please make sure to read the [Contribution Guidelines]
|
|
|
977
984
|
[black code formatter documentation]: http://black.readthedocs.io/en/latest/
|
|
978
985
|
[changelog.md]: https://github.com/ppfeufer/aa-intel-tool/blob/master/CHANGELOG.md
|
|
979
986
|
[code of conduct]: https://github.com/ppfeufer/aa-intel-tool/blob/master/CODE_OF_CONDUCT.md
|
|
980
|
-
[contribution guidelines]: https://github.com/ppfeufer/aa-intel-tool/blob/master/CONTRIBUTING.md
|
|
987
|
+
[contribution guidelines]: https://github.com/ppfeufer/aa-intel-tool/blob/master/CONTRIBUTING.md "Contribution Guidelines"
|
|
981
988
|
[eve universe]: https://gitlab.com/ErikKalkoken/django-eveuniverse "Eve Universe"
|
|
982
989
|
[image: chat scan module]: https://raw.githubusercontent.com/ppfeufer/aa-intel-tool/master/docs/images/chat-scan.jpg "Chat Scan Module"
|
|
983
990
|
[image: d-scan module]: https://raw.githubusercontent.com/ppfeufer/aa-intel-tool/master/docs/images/d-scan.jpg "D-Scan Module"
|
|
991
|
+
[image: fleet composition module]: https://raw.githubusercontent.com/ppfeufer/aa-intel-tool/master/docs/images/fleet-composition.jpg "Fleet Composition Module"
|
|
984
992
|
[ppfeufer on ko-fi]: https://ko-fi.com/ppfeufer "Buy Me a Coffee!"
|
|
985
|
-
[support discord]: https://discord.gg/zmh52wnfvM
|
|
986
|
-
[weblate engage]: https://weblate.ppfeufer.de/engage/alliance-auth-apps/
|
|
993
|
+
[support discord]: https://discord.gg/zmh52wnfvM "Alliance Auth Community Apps Support Discord"
|
|
994
|
+
[weblate engage]: https://weblate.ppfeufer.de/engage/alliance-auth-apps/ "Weblate Translations"
|