aa-sov-timer 2.3.1__tar.gz → 2.3.3__tar.gz

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.
Files changed (87) hide show
  1. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/PKG-INFO +17 -18
  2. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/README.md +16 -17
  3. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/__init__.py +1 -1
  4. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/constants.py +2 -1
  5. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/helper/static_files.py +2 -1
  6. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/cs_CZ/LC_MESSAGES/django.po +1 -1
  7. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/de/LC_MESSAGES/django.po +1 -1
  8. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/django.pot +2 -2
  9. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/es/LC_MESSAGES/django.po +1 -1
  10. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/fr_FR/LC_MESSAGES/django.po +1 -1
  11. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/it_IT/LC_MESSAGES/django.po +1 -1
  12. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/ja/LC_MESSAGES/django.po +1 -1
  13. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/ko_KR/LC_MESSAGES/django.po +1 -1
  14. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/nl_NL/LC_MESSAGES/django.po +1 -1
  15. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/pl_PL/LC_MESSAGES/django.po +1 -1
  16. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/ru/LC_MESSAGES/django.po +1 -1
  17. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/sk/LC_MESSAGES/django.po +1 -1
  18. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/uk/LC_MESSAGES/django.po +1 -1
  19. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/zh_Hans/LC_MESSAGES/django.po +1 -1
  20. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/static/sovtimer/js/aa-sov-timer.js +4 -5
  21. aa_sov_timer-2.3.3/sovtimer/static/sovtimer/js/aa-sov-timer.min.js +2 -0
  22. aa_sov_timer-2.3.3/sovtimer/static/sovtimer/js/aa-sov-timer.min.js.map +1 -0
  23. aa_sov_timer-2.3.3/sovtimer/tasks.py +227 -0
  24. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/templates/sovtimer/base.html +1 -5
  25. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/templatetags/sovtimer.py +10 -5
  26. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/tests/test_templatetags.py +22 -3
  27. aa_sov_timer-2.3.1/sovtimer/static/sovtimer/js/aa-sov-timer.min.js +0 -2
  28. aa_sov_timer-2.3.1/sovtimer/static/sovtimer/js/aa-sov-timer.min.js.map +0 -1
  29. aa_sov_timer-2.3.1/sovtimer/tasks.py +0 -204
  30. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/.gitignore +0 -0
  31. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/LICENSE +0 -0
  32. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/pyproject.toml +0 -0
  33. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/apps.py +0 -0
  34. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/auth_hooks.py +0 -0
  35. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/.gitkeep +0 -0
  36. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
  37. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/de/LC_MESSAGES/django.mo +0 -0
  38. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/es/LC_MESSAGES/django.mo +0 -0
  39. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/fr_FR/LC_MESSAGES/django.mo +0 -0
  40. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/it_IT/LC_MESSAGES/django.mo +0 -0
  41. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/ja/LC_MESSAGES/django.mo +0 -0
  42. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/ko_KR/LC_MESSAGES/django.mo +0 -0
  43. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/nl_NL/LC_MESSAGES/django.mo +0 -0
  44. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/pl_PL/LC_MESSAGES/django.mo +0 -0
  45. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/ru/LC_MESSAGES/django.mo +0 -0
  46. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/sk/LC_MESSAGES/django.mo +0 -0
  47. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/uk/LC_MESSAGES/django.mo +0 -0
  48. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  49. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/management/commands/__init__.py +0 -0
  50. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/management/commands/sovtimer_load_initial_data.py +0 -0
  51. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/migrations/0001_initial.py +0 -0
  52. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/migrations/0002_aasovtimercampaigns_aasovtimerstructures.py +0 -0
  53. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/migrations/0003_auto_20201113_1033.py +0 -0
  54. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/migrations/0004_auto_20201113_1856.py +0 -0
  55. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/migrations/0005_auto_20201114_0720.py +0 -0
  56. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/migrations/0006_rename_models.py +0 -0
  57. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/migrations/0007_cleanup_models.py +0 -0
  58. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/migrations/0008_fix_campaign_attackers_score.py +0 -0
  59. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/migrations/0009_alter_campaign_options_and_more.py +0 -0
  60. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/migrations/0010_alter_campaign_event_type.py +0 -0
  61. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/migrations/__init__.py +0 -0
  62. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/models.py +0 -0
  63. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/providers.py +0 -0
  64. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/static/sovtimer/css/aa-sov-timer.css +0 -0
  65. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/static/sovtimer/css/aa-sov-timer.min.css +0 -0
  66. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/static/sovtimer/css/aa-sov-timer.min.css.map +0 -0
  67. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/static/sovtimer/font/materialicons/v143/MaterialIcons-Regular.woff2 +0 -0
  68. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/static/sovtimer/font/materialicons/v143/README.md +0 -0
  69. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/static/sovtimer/images/zkillboard.png +0 -0
  70. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/templates/sovtimer/bundles/aa-sov-timer-css.html +0 -0
  71. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/templates/sovtimer/bundles/aa-sov-timer-js.html +0 -0
  72. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/templates/sovtimer/dashboard.html +0 -0
  73. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/templates/sovtimer/partials/dashboard/table.html +0 -0
  74. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/templates/sovtimer/partials/footer/app-translation-footer.html +0 -0
  75. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/templates/sovtimer/partials/header/h1.html +0 -0
  76. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/templatetags/__init__.py +0 -0
  77. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/tests/__init__.py +0 -0
  78. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/tests/fixtures/allianceauth.json +0 -0
  79. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/tests/fixtures/load_allianceauth.py +0 -0
  80. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/tests/fixtures/load_sovtimer.py +0 -0
  81. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/tests/fixtures/sovtimer.json +0 -0
  82. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/tests/fixtures/utils.py +0 -0
  83. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/tests/test_ajax_calls.py +0 -0
  84. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/tests/test_integration.py +0 -0
  85. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/tests/utils.py +0 -0
  86. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/urls.py +0 -0
  87. {aa_sov_timer-2.3.1 → aa_sov_timer-2.3.3}/sovtimer/views.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aa-sov-timer
3
- Version: 2.3.1
3
+ Version: 2.3.3
4
4
  Summary: Sov Campaign Timer for Alliance Auth
5
5
  Project-URL: Changelog, https://github.com/ppfeufer/aa-sov-timer/blob/master/CHANGELOG.md
6
6
  Project-URL: Documentation, https://github.com/ppfeufer/aa-sov-timer/blob/master/README.md
@@ -729,22 +729,21 @@ Sovereignty campaign overview for Alliance Auth.
729
729
 
730
730
  ______________________________________________________________________
731
731
 
732
- <!-- mdformat-toc start --slug=github --maxlevel=6 --minlevel=1 -->
733
-
734
- - [AA Sovereignty Timer](#aa-sovereignty-timer)
735
- - [Screenshots](#screenshots)
736
- - [AA Sov Timer Dashboard](#aa-sov-timer-dashboard)
737
- - [Installation](#installation)
738
- - [Step 1: Installing the App](#step-1-installing-the-app)
739
- - [Step 2: Update Your AA Settings](#step-2-update-your-aa-settings)
740
- - [Step 3: Finalizing the Installation](#step-3-finalizing-the-installation)
741
- - [Step 4: Preload Eve Universe Data](#step-4-preload-eve-universe-data)
742
- - [Step 5: Setting up Permission](#step-5-setting-up-permission)
743
- - [Step 6: Keep Campaigns Updated](#step-6-keep-campaigns-updated)
744
- - [Updating](#updating)
745
- - [Changelog](#changelog)
746
- - [Translation Status](#translation-status)
747
- - [Contributing](#contributing)
732
+ <!-- mdformat-toc start --slug=github --maxlevel=6 --minlevel=2 -->
733
+
734
+ - [Screenshots](#screenshots)
735
+ - [AA Sov Timer Dashboard](#aa-sov-timer-dashboard)
736
+ - [Installation](#installation)
737
+ - [Step 1: Installing the App](#step-1-installing-the-app)
738
+ - [Step 2: Update Your AA Settings](#step-2-update-your-aa-settings)
739
+ - [Step 3: Finalizing the Installation](#step-3-finalizing-the-installation)
740
+ - [Step 4: Preload Eve Universe Data](#step-4-preload-eve-universe-data)
741
+ - [Step 5: Setting up Permission](#step-5-setting-up-permission)
742
+ - [Step 6: Keep Campaigns Updated](#step-6-keep-campaigns-updated)
743
+ - [Updating](#updating)
744
+ - [Changelog](#changelog)
745
+ - [Translation Status](#translation-status)
746
+ - [Contributing](#contributing)
748
747
 
749
748
  <!-- mdformat-toc end -->
750
749
 
@@ -789,7 +788,7 @@ pip install aa-sov-timer
789
788
 
790
789
  Configure your AA settings (`local.py`) as follows:
791
790
 
792
- - Add `'eveuniverse',` to `INSTALLED_APPS`
791
+ - Add `'eveuniverse',` to `INSTALLED_APPS` if not already done for another app
793
792
  - Add `'sovtimer',` to `INSTALLED_APPS`
794
793
 
795
794
  Restart your supervisor
@@ -19,22 +19,21 @@ Sovereignty campaign overview for Alliance Auth.
19
19
 
20
20
  ______________________________________________________________________
21
21
 
22
- <!-- mdformat-toc start --slug=github --maxlevel=6 --minlevel=1 -->
23
-
24
- - [AA Sovereignty Timer](#aa-sovereignty-timer)
25
- - [Screenshots](#screenshots)
26
- - [AA Sov Timer Dashboard](#aa-sov-timer-dashboard)
27
- - [Installation](#installation)
28
- - [Step 1: Installing the App](#step-1-installing-the-app)
29
- - [Step 2: Update Your AA Settings](#step-2-update-your-aa-settings)
30
- - [Step 3: Finalizing the Installation](#step-3-finalizing-the-installation)
31
- - [Step 4: Preload Eve Universe Data](#step-4-preload-eve-universe-data)
32
- - [Step 5: Setting up Permission](#step-5-setting-up-permission)
33
- - [Step 6: Keep Campaigns Updated](#step-6-keep-campaigns-updated)
34
- - [Updating](#updating)
35
- - [Changelog](#changelog)
36
- - [Translation Status](#translation-status)
37
- - [Contributing](#contributing)
22
+ <!-- mdformat-toc start --slug=github --maxlevel=6 --minlevel=2 -->
23
+
24
+ - [Screenshots](#screenshots)
25
+ - [AA Sov Timer Dashboard](#aa-sov-timer-dashboard)
26
+ - [Installation](#installation)
27
+ - [Step 1: Installing the App](#step-1-installing-the-app)
28
+ - [Step 2: Update Your AA Settings](#step-2-update-your-aa-settings)
29
+ - [Step 3: Finalizing the Installation](#step-3-finalizing-the-installation)
30
+ - [Step 4: Preload Eve Universe Data](#step-4-preload-eve-universe-data)
31
+ - [Step 5: Setting up Permission](#step-5-setting-up-permission)
32
+ - [Step 6: Keep Campaigns Updated](#step-6-keep-campaigns-updated)
33
+ - [Updating](#updating)
34
+ - [Changelog](#changelog)
35
+ - [Translation Status](#translation-status)
36
+ - [Contributing](#contributing)
38
37
 
39
38
  <!-- mdformat-toc end -->
40
39
 
@@ -79,7 +78,7 @@ pip install aa-sov-timer
79
78
 
80
79
  Configure your AA settings (`local.py`) as follows:
81
80
 
82
- - Add `'eveuniverse',` to `INSTALLED_APPS`
81
+ - Add `'eveuniverse',` to `INSTALLED_APPS` if not already done for another app
83
82
  - Add `'sovtimer',` to `INSTALLED_APPS`
84
83
 
85
84
  Restart your supervisor
@@ -5,5 +5,5 @@ App init
5
5
  # Django
6
6
  from django.utils.translation import gettext_lazy as _
7
7
 
8
- __version__ = "2.3.1"
8
+ __version__ = "2.3.3"
9
9
  __title__ = _("Sovereignty Timers")
@@ -12,13 +12,14 @@ from esi import __version__ as esi_version
12
12
  from sovtimer import __version__
13
13
 
14
14
  APP_NAME = "aa-sov-timer"
15
+ PACKAGE_NAME = "sovtimer"
15
16
  GITHUB_URL = f"https://github.com/ppfeufer/{APP_NAME}"
16
17
  USER_AGENT = f"{APP_NAME}/{__version__} +{GITHUB_URL} via django-esi/{esi_version}"
17
18
 
18
19
  # aa-sov-timer/sovtimer
19
20
  APP_BASE_DIR = os.path.join(os.path.dirname(__file__))
20
21
  # aa-sov-timer/sovtimer/static/sovtimer
21
- APP_STATIC_DIR = os.path.join(APP_BASE_DIR, "static", "sovtimer")
22
+ APP_STATIC_DIR = os.path.join(APP_BASE_DIR, "static", PACKAGE_NAME)
22
23
 
23
24
  # All internal URLs need to start with this prefix
24
25
  INTERNAL_URL_PREFIX = "-"
@@ -26,9 +26,10 @@ logger = LoggerAddTag(my_logger=get_extension_logger(__name__), prefix=__title__
26
26
  def calculate_integrity_hash(relative_file_path: str) -> str:
27
27
  """
28
28
  Calculates the integrity hash for a given static file
29
+
29
30
  :param self:
30
31
  :type self:
31
- :param relative_file_path: The file path relative to the `aa-sov-timer/sovtimer/static/sovtimer` folder
32
+ :param relative_file_path: The file path relative to the `{APP_NAME}/{PACKAGE_NAME}/static/{PACKAGE_NAME}` folder
32
33
  :type relative_file_path: str
33
34
  :return: The integrity hash
34
35
  :rtype: str
@@ -6,7 +6,7 @@ msgid ""
6
6
  msgstr ""
7
7
  "Project-Id-Version: AA Sov Timer 2.2.1\n"
8
8
  "Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-sov-timer/issues\n"
9
- "POT-Creation-Date: 2025-02-26 17:41+0100\n"
9
+ "POT-Creation-Date: 2025-03-04 18:52+0100\n"
10
10
  "PO-Revision-Date: 2024-07-10 14:26+0000\n"
11
11
  "Last-Translator: Dadas Aideron <dadas.aideron@gmail.com>\n"
12
12
  "Language-Team: Czech <https://weblate.ppfeufer.de/projects/alliance-auth-apps/aa-sov-timer/cs/>\n"
@@ -6,7 +6,7 @@ msgid ""
6
6
  msgstr ""
7
7
  "Project-Id-Version: AA Sov Timer 2.2.1\n"
8
8
  "Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-sov-timer/issues\n"
9
- "POT-Creation-Date: 2025-02-26 17:41+0100\n"
9
+ "POT-Creation-Date: 2025-03-04 18:52+0100\n"
10
10
  "PO-Revision-Date: 2024-12-15 10:37+0000\n"
11
11
  "Last-Translator: Peter Pfeufer <info@ppfeufer.de>\n"
12
12
  "Language-Team: German <https://weblate.ppfeufer.de/projects/alliance-auth-apps/aa-sov-timer/de/>\n"
@@ -6,9 +6,9 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: AA Sov Timer 2.3.1\n"
9
+ "Project-Id-Version: AA Sov Timer 2.3.3\n"
10
10
  "Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-sov-timer/issues\n"
11
- "POT-Creation-Date: 2025-02-26 18:42+0100\n"
11
+ "POT-Creation-Date: 2025-03-04 18:52+0100\n"
12
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -7,7 +7,7 @@ msgid ""
7
7
  msgstr ""
8
8
  "Project-Id-Version: AA Sov Timer 2.2.1\n"
9
9
  "Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-sov-timer/issues\n"
10
- "POT-Creation-Date: 2025-02-26 17:41+0100\n"
10
+ "POT-Creation-Date: 2025-03-04 18:52+0100\n"
11
11
  "PO-Revision-Date: 2024-12-15 10:37+0000\n"
12
12
  "Last-Translator: Peter Pfeufer <info@ppfeufer.de>\n"
13
13
  "Language-Team: Spanish <https://weblate.ppfeufer.de/projects/alliance-auth-apps/aa-sov-timer/es/>\n"
@@ -10,7 +10,7 @@ msgid ""
10
10
  msgstr ""
11
11
  "Project-Id-Version: AA Sov Timer 2.2.1\n"
12
12
  "Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-sov-timer/issues\n"
13
- "POT-Creation-Date: 2025-02-26 17:41+0100\n"
13
+ "POT-Creation-Date: 2025-03-04 18:52+0100\n"
14
14
  "PO-Revision-Date: 2024-12-15 10:37+0000\n"
15
15
  "Last-Translator: Peter Pfeufer <info@ppfeufer.de>\n"
16
16
  "Language-Team: French <https://weblate.ppfeufer.de/projects/alliance-auth-apps/aa-sov-timer/fr/>\n"
@@ -6,7 +6,7 @@ msgid ""
6
6
  msgstr ""
7
7
  "Project-Id-Version: AA Sov Timer 2.2.1\n"
8
8
  "Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-sov-timer/issues\n"
9
- "POT-Creation-Date: 2025-02-26 17:41+0100\n"
9
+ "POT-Creation-Date: 2025-03-04 18:52+0100\n"
10
10
  "PO-Revision-Date: 2024-12-22 21:15+0000\n"
11
11
  "Last-Translator: Peter Pfeufer <info@ppfeufer.de>\n"
12
12
  "Language-Team: Italian <https://weblate.ppfeufer.de/projects/alliance-auth-apps/aa-sov-timer/it/>\n"
@@ -7,7 +7,7 @@ msgid ""
7
7
  msgstr ""
8
8
  "Project-Id-Version: AA Sov Timer 2.2.1\n"
9
9
  "Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-sov-timer/issues\n"
10
- "POT-Creation-Date: 2025-02-26 17:41+0100\n"
10
+ "POT-Creation-Date: 2025-03-04 18:52+0100\n"
11
11
  "PO-Revision-Date: 2024-08-06 03:28+0000\n"
12
12
  "Last-Translator: Deleted User <noreply+44@weblate.org>\n"
13
13
  "Language-Team: Japanese <https://weblate.ppfeufer.de/projects/alliance-auth-apps/aa-sov-timer/ja/>\n"
@@ -9,7 +9,7 @@ msgid ""
9
9
  msgstr ""
10
10
  "Project-Id-Version: AA Sov Timer 2.2.1\n"
11
11
  "Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-sov-timer/issues\n"
12
- "POT-Creation-Date: 2025-02-26 17:41+0100\n"
12
+ "POT-Creation-Date: 2025-03-04 18:52+0100\n"
13
13
  "PO-Revision-Date: 2024-12-15 10:37+0000\n"
14
14
  "Last-Translator: Peter Pfeufer <info@ppfeufer.de>\n"
15
15
  "Language-Team: Korean <https://weblate.ppfeufer.de/projects/alliance-auth-apps/aa-sov-timer/ko/>\n"
@@ -7,7 +7,7 @@ msgid ""
7
7
  msgstr ""
8
8
  "Project-Id-Version: AA Sov Timer 2.2.1\n"
9
9
  "Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-sov-timer/issues\n"
10
- "POT-Creation-Date: 2025-02-26 17:41+0100\n"
10
+ "POT-Creation-Date: 2025-03-04 18:52+0100\n"
11
11
  "PO-Revision-Date: 2024-05-10 14:12+0000\n"
12
12
  "Last-Translator: Anonymous <noreply@weblate.org>\n"
13
13
  "Language-Team: Dutch <https://weblate.ppfeufer.de/projects/alliance-auth-apps/aa-sov-timer/nl/>\n"
@@ -6,7 +6,7 @@ msgid ""
6
6
  msgstr ""
7
7
  "Project-Id-Version: AA Sov Timer 2.2.1\n"
8
8
  "Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-sov-timer/issues\n"
9
- "POT-Creation-Date: 2025-02-26 17:41+0100\n"
9
+ "POT-Creation-Date: 2025-03-04 18:52+0100\n"
10
10
  "PO-Revision-Date: 2024-05-10 14:12+0000\n"
11
11
  "Last-Translator: Anonymous <noreply@weblate.org>\n"
12
12
  "Language-Team: Polish <https://weblate.ppfeufer.de/projects/alliance-auth-apps/aa-sov-timer/pl/>\n"
@@ -8,7 +8,7 @@ msgid ""
8
8
  msgstr ""
9
9
  "Project-Id-Version: AA Sov Timer 2.2.1\n"
10
10
  "Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-sov-timer/issues\n"
11
- "POT-Creation-Date: 2025-02-26 17:41+0100\n"
11
+ "POT-Creation-Date: 2025-03-04 18:52+0100\n"
12
12
  "PO-Revision-Date: 2024-12-15 10:37+0000\n"
13
13
  "Last-Translator: Peter Pfeufer <info@ppfeufer.de>\n"
14
14
  "Language-Team: Russian <https://weblate.ppfeufer.de/projects/alliance-auth-apps/aa-sov-timer/ru/>\n"
@@ -7,7 +7,7 @@ msgid ""
7
7
  msgstr ""
8
8
  "Project-Id-Version: AA Sov Timer 2.2.1\n"
9
9
  "Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-sov-timer/issues\n"
10
- "POT-Creation-Date: 2025-02-26 17:41+0100\n"
10
+ "POT-Creation-Date: 2025-03-04 18:52+0100\n"
11
11
  "PO-Revision-Date: 2024-05-10 14:12+0000\n"
12
12
  "Last-Translator: Anonymous <noreply@weblate.org>\n"
13
13
  "Language-Team: Slovak <https://weblate.ppfeufer.de/projects/alliance-auth-apps/aa-sov-timer/sk/>\n"
@@ -8,7 +8,7 @@ msgid ""
8
8
  msgstr ""
9
9
  "Project-Id-Version: AA Sov Timer 2.2.1\n"
10
10
  "Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-sov-timer/issues\n"
11
- "POT-Creation-Date: 2025-02-26 17:41+0100\n"
11
+ "POT-Creation-Date: 2025-03-04 18:52+0100\n"
12
12
  "PO-Revision-Date: 2025-02-24 15:17+0000\n"
13
13
  "Last-Translator: M <skrypets@gmail.com>\n"
14
14
  "Language-Team: Ukrainian <https://weblate.ppfeufer.de/projects/alliance-auth-apps/aa-sov-timer/uk/>\n"
@@ -10,7 +10,7 @@ msgid ""
10
10
  msgstr ""
11
11
  "Project-Id-Version: AA Sov Timer 2.2.1\n"
12
12
  "Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-sov-timer/issues\n"
13
- "POT-Creation-Date: 2025-02-26 17:41+0100\n"
13
+ "POT-Creation-Date: 2025-03-04 18:52+0100\n"
14
14
  "PO-Revision-Date: 2024-05-15 09:21+0000\n"
15
15
  "Last-Translator: SAM_FPS <sam_fps@163.com>\n"
16
16
  "Language-Team: Chinese (Simplified) <https://weblate.ppfeufer.de/projects/alliance-auth-apps/aa-sov-timer/zh_Hans/>\n"
@@ -160,13 +160,12 @@ $(document).ready(() => {
160
160
  data: 'start_time',
161
161
  render: {
162
162
  _: (data) => {
163
- return moment(data)
164
- .locale(sovtimerSettings.language.momentJS)
165
- .utc()
166
- .format(sovtimerSettings.datetimeFormat.datetimeWithSeconds);
163
+ return data === null ? '' : moment(data).utc().format(
164
+ sovtimerSettings.datetimeFormat.datetimeLong
165
+ );
167
166
  },
168
167
  sort: (data) => {
169
- return data;
168
+ return data === null ? '' : data;
170
169
  }
171
170
  }
172
171
  },
@@ -0,0 +1,2 @@
1
+ $(document).ready(()=>{function n(t){return t&&"object"==typeof t&&!Array.isArray(t)&&!(t instanceof Date)}function i(e,...t){return t.length&&t.forEach(t=>{if(n(e)&&n(t))for(var a in t)n(t[a])?"__proto__"!==a&&"constructor"!==a&&"prototype"!==a&&(e[a]&&n(e[a])||(e[a]={}),i(e[a],t[a])):e[a]=t[a]}),e}let m=sovtimerJsSettingsDefaults;"undefined"!=typeof sovtimerJsSettingsOverride&&(m=i(sovtimerJsSettingsDefaults,sovtimerJsSettingsOverride));const l=$(".aa-sovtimer-timers-total"),d=$(".aa-sovtimer-timers-upcoming"),c=$(".aa-sovtimer-timers-active"),r=t=>{let a="",e="aa-sovtimer-remaining";t<0?(e+=" aa-sovtimer-timer-elapsed",a="-",t=Math.abs(t),t++):t--;const n=Math.floor(t/86400);let i=Math.floor(t/3600)%24,r=Math.floor(t/60)%60,s=Math.floor(t)%60;return i<10&&(i="0"+i),r<10&&(r="0"+r),s<10&&(s="0"+s),{countdown:`<span class="${e}">${a}${n}d ${i}h ${r}m ${s}s</span>`,remainingTimeInSeconds:a+t}},s=$(".aa-sovtimer-campaigns").DataTable({language:m.dataTables.language,ajax:{url:m.url.ajaxUpdate,dataSrc:"",cache:!1},columns:[{data:"event_type"},{data:"solar_system_name_html"},{data:"constellation_name_html"},{data:"region_name_html"},{data:"defender_name_html"},{data:"adm"},{data:"start_time",render:{_:t=>null===t?"":moment(t).utc().format(m.datetimeFormat.datetimeLong),sort:t=>null===t?"":t}},{data:"remaining_time"},{data:"campaign_progress"},{data:"remaining_time_in_seconds"},{data:"solar_system_name"},{data:"constellation_name"},{data:"region_name"},{data:"defender_name"},{data:"active_campaign"}],columnDefs:[{visible:!1,targets:[0,9,10,11,12,13,14]},{width:"150px",targets:[8]}],order:[[6,"asc"]],filterDropDown:{columns:[{idx:10,title:m.translation.dtFilter.system},{idx:11,title:m.translation.dtFilter.constellation},{idx:12,title:m.translation.dtFilter.region},{idx:13,title:m.translation.dtFilter.owner},{idx:14,title:m.translation.dtFilter.activeCampaign}],autoSize:!1,bootstrap:!0,bootstrap_version:5},createdRow:(t,a)=>{const e=l.html(),n=parseInt(e)+1;if(l.html(n),a.active_campaign===m.translation.no&&a.remaining_time_in_seconds<=m.upcomingTimerThreshold){$(t).addClass("aa-sovtimer-upcoming-campaign");const i=d.html(),r=parseInt(i)+1;d.html(r)}if(a.active_campaign===m.translation.yes){$(t).addClass("aa-sovtimer-active-campaign");const s=c.html(),o=parseInt(s)+1;c.html(o)}},paging:!1});setInterval(()=>{s.ajax.reload(t=>{l.html("0"),d.html("0"),c.html("0"),$.each(t,(t,a)=>{const e=l.html(),n=parseInt(e)+1;if(l.html(n),a.active_campaign===m.translation.no&&a.remaining_time_in_seconds<=m.upcomingTimerThreshold){const i=d.html(),r=parseInt(i)+1;d.html(r)}if(a.active_campaign===m.translation.yes){const s=c.html(),o=parseInt(s)+1;c.html(o)}})})},3e4),setInterval(()=>{s.rows().every(t=>{const a=s.row(t).data(),e=r(a.remaining_time_in_seconds);a.remaining_time_in_seconds=e.remainingTimeInSeconds,a.remaining_time=e.countdown,s.row(t).data(a)})},1e3)});
2
+ //# sourceMappingURL=aa-sov-timer.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["aa-sov-timer.js"],"names":["$","document","ready","isObject","item","Array","isArray","Date","deepMerge","target","sources","length","forEach","source","key","let","sovtimerSettings","sovtimerJsSettingsDefaults","sovtimerJsSettingsOverride","elementTimerTotal","elementTimerUpcoming","elementTimerActive","secondsToRemainingTime","prefix","spanClasses","secondsRemaining","Math","abs","days","floor","hours","minutes","seconds","countdown","remainingTimeInSeconds","sovCampaignTable","DataTable","language","dataTables","ajax","url","ajaxUpdate","dataSrc","cache","columns","data","render","_","moment","utc","format","datetimeFormat","datetimeLong","sort","columnDefs","visible","targets","width","order","filterDropDown","idx","title","translation","dtFilter","system","constellation","region","owner","activeCampaign","autoSize","bootstrap","bootstrap_version","createdRow","row","currentTotal","html","newTotal","parseInt","active_campaign","no","remaining_time_in_seconds","upcomingTimerThreshold","addClass","currentUpcoming","newUpcoming","yes","currentActive","newActive","paging","setInterval","reload","each","tableData","i","rows","every","element","remaining","remaining_time"],"mappings":"AAEAA,EAAEC,QAAQ,EAAEC,MAAM,KASd,SAASC,EAAUC,GACf,OACIA,GAAwB,UAAhB,OAAOA,GAAqB,CAACC,MAAMC,QAAQF,CAAI,GAAK,EAAEA,aAAgBG,KAEtF,CAYA,SAASC,EAAWC,KAAWC,GA0B3B,OAzBKA,EAAQC,QAKbD,EAAQE,QAAQC,IACZ,GAAIV,EAASM,CAAM,GAAKN,EAASU,CAAM,EACnC,IAAK,IAAMC,KAAOD,EACVV,EAASU,EAAOC,EAAI,EACR,cAARA,GAA+B,gBAARA,GAAiC,cAARA,IAI/CL,EAAOK,IAASX,EAASM,EAAOK,EAAI,IACrCL,EAAOK,GAAO,IAGlBN,EAAUC,EAAOK,GAAMD,EAAOC,EAAI,GAElCL,EAAOK,GAAOD,EAAOC,EAIrC,CAAC,EAEML,CACX,CAGAM,IAAIC,EAAmBC,2BACmB,aAAtC,OAAOC,6BACPF,EAAmBR,EACfS,2BACAC,0BACJ,GAGJ,MAAMC,EAAoBnB,EAAE,2BAA2B,EACjDoB,EAAuBpB,EAAE,8BAA8B,EACvDqB,EAAqBrB,EAAE,4BAA4B,EAQnDsB,EAAyB,IAC3BP,IAAIQ,EAAS,GACTC,EAAc,wBAEdC,EAAmB,GACnBD,GAAe,6BACfD,EAAS,IAETE,EAAmBC,KAAKC,IAAIF,CAAgB,EAE5CA,CAAgB,IAEhBA,CAAgB,GAGpB,MAAMG,EAAOF,KAAKG,MAAMJ,EAAmB,KAAc,EACzDV,IAAIe,EAAQJ,KAAKG,MA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,GAHAvD,EAAkBwD,KAAKC,CAAQ,EAG3BxE,EAAK0E,kBAAoB9D,EAAiB8C,YAAYiB,IAAM3E,EAAK4E,2BAA6BhE,EAAiBiE,uBAAwB,CACvI,MAAME,EAAkB/D,EAAqBuD,KAAK,EAC5CS,EAAcP,SAASM,CAAe,EAAI,EAEhD/D,EAAqBuD,KAAKS,CAAW,CACzC,CAGA,GAAIhF,EAAK0E,kBAAoB9D,EAAiB8C,YAAYuB,IAAK,CAC3D,MAAMC,EAAgBjE,EAAmBsD,KAAK,EACxCY,EAAYV,SAASS,CAAa,EAAI,EAE5CjE,EAAmBsD,KAAKY,CAAS,CACrC,CACJ,CAAC,CACL,CAAC,CACL,EAAG,GAAK,EAKRE,YAAY,KACRtD,EAAiB2D,KAAK,EAAEC,MAAM,IAC1B,MAAMlD,EAAOV,EAAiBsC,IAAIuB,CAAO,EAAEnD,KAAK,EAE1CoD,EAAY3E,EACduB,EAAKmC,yBACT,EAEAnC,EAAKmC,0BAA4BiB,EAAU/D,uBAC3CW,EAAKqD,eAAiBD,EAAUhE,UAEhCE,EAAiBsC,IAAIuB,CAAO,EAAEnD,KAAKA,CAAI,CAC3C,CAAC,CACL,EAAG,GAAI,CACX,CAAC"}
@@ -0,0 +1,227 @@
1
+ """
2
+ The tasks
3
+ """
4
+
5
+ # Third Party
6
+ from celery import shared_task
7
+
8
+ # Django
9
+ from django.core.cache import cache
10
+ from django.db import transaction
11
+
12
+ # Alliance Auth
13
+ from allianceauth.services.hooks import get_extension_logger
14
+ from allianceauth.services.tasks import QueueOnce
15
+
16
+ # Alliance Auth (External Libs)
17
+ from app_utils.logging import LoggerAddTag
18
+ from eveuniverse.core.esitools import is_esi_online
19
+ from eveuniverse.models import EveEntity, EveSolarSystem
20
+
21
+ # AA Sovereignty Timer
22
+ from sovtimer import __title__
23
+ from sovtimer.models import Campaign, SovereigntyStructure
24
+
25
+ logger = LoggerAddTag(my_logger=get_extension_logger(name=__name__), prefix=__title__)
26
+
27
+
28
+ ESI_ERROR_LIMIT = 50
29
+ ESI_TIMEOUT_ONCE_ERROR_LIMIT_REACHED = 60
30
+ ESI_SOV_STRUCTURES_CACHE_KEY = "sov_structures_cache"
31
+ ESI_MAX_RETRIES = 5
32
+
33
+ TASK_TIME_LIMIT = 600 # Stop after 10 minutes
34
+
35
+ # Params for all tasks
36
+ TASK_PRIORITY = 6
37
+ TASK_ONCE_ARGS = {"graceful": True}
38
+ TASK_ONCE = {"base": QueueOnce, "once": TASK_ONCE_ARGS}
39
+
40
+ TASK_DEFAULTS = {
41
+ "time_limit": TASK_TIME_LIMIT,
42
+ "max_retries": ESI_MAX_RETRIES,
43
+ "default_retry_delay": 300,
44
+ }
45
+ TASK_DEFAULTS_ONCE = {**TASK_DEFAULTS, **TASK_ONCE}
46
+
47
+
48
+ @shared_task(**TASK_DEFAULTS_ONCE)
49
+ def run_sov_campaign_updates() -> None:
50
+ """
51
+ Update all sovereignty campaigns and structures
52
+
53
+ This task is used to update all sovereignty campaigns and structures from ESI.
54
+ It should be called by a periodic task, or in your `local.py` settings file via:
55
+
56
+ ```python
57
+ # AA Sovereignty Timer - https://github.com/ppfeufer/aa-sov-timer
58
+ if "sovtimer" in INSTALLED_APPS:
59
+ # Run campaign updates every 30 seconds
60
+ CELERYBEAT_SCHEDULE["sovtimer.tasks.run_sov_campaign_updates"] = {
61
+ "task": "sovtimer.tasks.run_sov_campaign_updates",
62
+ "schedule": 30.0,
63
+ }
64
+ ```
65
+ """
66
+
67
+ if not is_esi_online():
68
+ logger.info(
69
+ msg=(
70
+ "ESI seems to be offline, currently. "
71
+ "Can't start ESI related tasks. Aborting …"
72
+ )
73
+ )
74
+
75
+ return
76
+
77
+ logger.info(msg="Updating sovereignty structures and campaigns from ESI …")
78
+
79
+ update_sov_structures.apply_async(priority=TASK_PRIORITY, once=TASK_ONCE_ARGS)
80
+ update_sov_campaigns.apply_async(priority=TASK_PRIORITY, once=TASK_ONCE_ARGS)
81
+
82
+
83
+ @shared_task(**TASK_DEFAULTS_ONCE)
84
+ def update_sov_campaigns() -> None:
85
+ """
86
+ Update sovereignty campaigns
87
+
88
+ This task is used to update the sovereignty campaigns from ESI.
89
+ """
90
+
91
+ campaigns_from_esi = Campaign.get_sov_campaigns_from_esi()
92
+
93
+ logger.debug(
94
+ msg=f"Number of sovereignty campaigns from ESI: {len(campaigns_from_esi or [])}"
95
+ )
96
+
97
+ if not campaigns_from_esi:
98
+ logger.info(msg="No sovereignty campaigns found, nothing to update.")
99
+
100
+ return
101
+
102
+ logger.debug(msg="Updating sovereignty campaigns …")
103
+
104
+ campaigns = []
105
+ defender_ids = {campaign.get("defender_id") for campaign in campaigns_from_esi}
106
+ existing_campaigns = {c.campaign_id: c for c in Campaign.objects.all()}
107
+
108
+ EveEntity.objects.bulk_create(
109
+ [EveEntity(id=defender_id) for defender_id in defender_ids],
110
+ ignore_conflicts=True,
111
+ )
112
+
113
+ for campaign in campaigns_from_esi:
114
+ campaign_id = campaign.get("campaign_id")
115
+ campaign_current__defender_score = campaign.get("defender_score")
116
+ campaign_current__progress_previous = campaign_current__defender_score
117
+
118
+ if campaign_id in existing_campaigns:
119
+ campaign_previous = existing_campaigns[campaign_id]
120
+ campaign_previous__progress_previous = campaign_previous.progress_previous
121
+ campaign_previous__progress = campaign_previous.defender_score
122
+ campaign_current__progress_previous = campaign_previous__progress
123
+
124
+ if campaign_previous__progress == campaign_current__defender_score:
125
+ campaign_current__progress_previous = (
126
+ campaign_previous__progress_previous
127
+ )
128
+
129
+ campaigns.append(
130
+ Campaign(
131
+ attackers_score=campaign.get("attackers_score"),
132
+ campaign_id=campaign_id,
133
+ defender_score=campaign.get("defender_score"),
134
+ event_type=campaign.get("event_type"),
135
+ start_time=campaign.get("start_time"),
136
+ structure_id=campaign.get("structure_id"),
137
+ progress_current=campaign_current__defender_score,
138
+ progress_previous=campaign_current__progress_previous,
139
+ )
140
+ )
141
+
142
+ Campaign.objects.all().delete()
143
+ Campaign.objects.bulk_create(
144
+ objs=campaigns,
145
+ batch_size=500,
146
+ # ignore_conflicts=True,
147
+ )
148
+ EveEntity.objects.bulk_update_new_esi()
149
+
150
+ logger.info(msg=f"{len(campaigns)} sovereignty campaigns updated from ESI.")
151
+
152
+
153
+ @shared_task(**TASK_DEFAULTS_ONCE)
154
+ def update_sov_structures() -> None:
155
+ """
156
+ Update sovereignty structures
157
+
158
+ This task is used to update the sovereignty structures from ESI.
159
+ """
160
+
161
+ if cache.get(ESI_SOV_STRUCTURES_CACHE_KEY) is None:
162
+ logger.debug(msg="Updating sovereignty structures …")
163
+
164
+ structures_from_esi = SovereigntyStructure.get_sov_structures_from_esi()
165
+
166
+ if structures_from_esi:
167
+ with transaction.atomic():
168
+ esi_structure_ids = set()
169
+ sov_structures = []
170
+
171
+ for structure in structures_from_esi:
172
+ structure_id = structure.get("structure_id")
173
+
174
+ if structure_id not in esi_structure_ids:
175
+ esi_structure_ids.add(structure_id)
176
+
177
+ sov_holder, _ = EveEntity.objects.get_or_create(
178
+ id=structure.get("alliance_id")
179
+ )
180
+
181
+ structure_solar_system = EveSolarSystem.objects.get(
182
+ id=structure.get("solar_system_id")
183
+ )
184
+
185
+ vulnerability_occupancy_level = (
186
+ 1
187
+ if structure.get("vulnerability_occupancy_level") is None
188
+ else structure.get("vulnerability_occupancy_level")
189
+ )
190
+
191
+ vulnerable_end_time = structure.get("vulnerable_end_time")
192
+ vulnerable_start_time = structure.get("vulnerable_start_time")
193
+
194
+ sov_structures.append(
195
+ SovereigntyStructure(
196
+ alliance=sov_holder,
197
+ solar_system=structure_solar_system,
198
+ structure_id=structure_id,
199
+ structure_type_id=structure.get("structure_type_id"),
200
+ vulnerability_occupancy_level=vulnerability_occupancy_level,
201
+ vulnerable_end_time=vulnerable_end_time,
202
+ vulnerable_start_time=vulnerable_start_time,
203
+ )
204
+ )
205
+
206
+ SovereigntyStructure.objects.bulk_create(
207
+ objs=sov_structures,
208
+ batch_size=500,
209
+ update_conflicts=True,
210
+ update_fields=[
211
+ "alliance",
212
+ "solar_system",
213
+ "structure_type_id",
214
+ "vulnerability_occupancy_level",
215
+ "vulnerable_end_time",
216
+ "vulnerable_start_time",
217
+ ],
218
+ )
219
+
220
+ EveEntity.objects.bulk_update_new_esi()
221
+ SovereigntyStructure.objects.exclude(pk__in=esi_structure_ids).delete()
222
+
223
+ cache.set(key=ESI_SOV_STRUCTURES_CACHE_KEY, value=True, timeout=120)
224
+
225
+ logger.info(
226
+ msg=f"{len(sov_structures)} sovereignty structures updated from ESI."
227
+ )
@@ -19,7 +19,6 @@
19
19
 
20
20
  <div class="aa-sovtimer-body">
21
21
  {% get_datatables_language_static LANGUAGE_CODE as DT_LANG_PATH %}
22
- {% get_momentjs_language_code LANGUAGE_CODE as MOMENTJS_LCODE %}
23
22
 
24
23
  <script>
25
24
  const sovtimerJsSettingsDefaults = {
@@ -29,10 +28,7 @@
29
28
  timeWithSeconds: 'LTS',
30
29
  datetime: 'L LT',
31
30
  datetimeWithSeconds: 'L LTS',
32
- },
33
- language: {
34
- django: '{{ LANGUAGE_CODE }}',
35
- momentJS: '{{ MOMENTJS_LCODE }}',
31
+ datetimeLong: 'LL LTS',
36
32
  },
37
33
  dataTables: {
38
34
  paging: true,
@@ -19,6 +19,7 @@ from app_utils.logging import LoggerAddTag
19
19
 
20
20
  # AA Sovereignty Timer
21
21
  from sovtimer import __title__, __version__
22
+ from sovtimer.constants import PACKAGE_NAME
22
23
  from sovtimer.helper.static_files import calculate_integrity_hash
23
24
 
24
25
  logger = LoggerAddTag(my_logger=get_extension_logger(__name__), prefix=__title__)
@@ -29,7 +30,7 @@ def sovtimer_static(relative_file_path: str, script_type: str = None) -> str | N
29
30
  """
30
31
  Versioned static URL
31
32
 
32
- :param relative_file_path: The file path relative to the `aa-sov-timer/sovtimer/static/sovtimer` folder
33
+ :param relative_file_path: The file path relative to the `{APP_NAME}/{PACKAGE_NAME}/static/{PACKAGE_NAME}` folder
33
34
  :type relative_file_path: str
34
35
  :param script_type: The script type
35
36
  :type script_type: str
@@ -47,7 +48,7 @@ def sovtimer_static(relative_file_path: str, script_type: str = None) -> str | N
47
48
  if file_type not in ["css", "js"]:
48
49
  raise ValueError(f"Unsupported file type: {file_type}")
49
50
 
50
- static_file_path = os.path.join("sovtimer", relative_file_path)
51
+ static_file_path = os.path.join(PACKAGE_NAME, relative_file_path)
51
52
  static_url = static(static_file_path)
52
53
 
53
54
  # Integrity hash calculation only for non-debug mode
@@ -66,16 +67,20 @@ def sovtimer_static(relative_file_path: str, script_type: str = None) -> str | N
66
67
  else static_url + "?v=" + __version__
67
68
  )
68
69
 
70
+ return_value = None
71
+
69
72
  # Return the versioned URL with integrity hash for CSS
70
73
  if file_type == "css":
71
- return mark_safe(f'<link rel="stylesheet" href="{versioned_url}"{sri_string}>')
74
+ return_value = mark_safe(
75
+ f'<link rel="stylesheet" href="{versioned_url}"{sri_string}>'
76
+ )
72
77
 
73
78
  # Return the versioned URL with integrity hash for JS files
74
79
  if file_type == "js":
75
80
  js_type = f' type="{script_type}"' if script_type else ""
76
81
 
77
- return mark_safe(
82
+ return_value = mark_safe(
78
83
  f'<script{js_type} src="{versioned_url}"{sri_string}></script>'
79
84
  )
80
85
 
81
- return None
86
+ return return_value
@@ -8,6 +8,7 @@ from django.test import TestCase, override_settings
8
8
 
9
9
  # AA Sovereignty Timer
10
10
  from sovtimer import __version__
11
+ from sovtimer.constants import PACKAGE_NAME
11
12
  from sovtimer.helper.static_files import calculate_integrity_hash
12
13
 
13
14
 
@@ -37,13 +38,13 @@ class TestVersionedStatic(TestCase):
37
38
  rendered_template = template_to_render.render(context=context)
38
39
 
39
40
  expected_static_css_src = (
40
- f'/static/sovtimer/css/aa-sov-timer.min.css?v={context["version"]}'
41
+ f'/static/{PACKAGE_NAME}/css/aa-sov-timer.min.css?v={context["version"]}'
41
42
  )
42
43
  expected_static_css_src_integrity = calculate_integrity_hash(
43
44
  "css/aa-sov-timer.min.css"
44
45
  )
45
46
  expected_static_js_src = (
46
- f'/static/sovtimer/js/aa-sov-timer.min.js?v={context["version"]}'
47
+ f'/static/{PACKAGE_NAME}/js/aa-sov-timer.min.js?v={context["version"]}'
47
48
  )
48
49
  expected_static_js_src_integrity = calculate_integrity_hash(
49
50
  "js/aa-sov-timer.min.js"
@@ -77,8 +78,26 @@ class TestVersionedStatic(TestCase):
77
78
  rendered_template = template_to_render.render(context=context)
78
79
 
79
80
  expected_static_css_src = (
80
- f'/static/sovtimer/css/aa-sov-timer.min.css?v={context["version"]}'
81
+ f'/static/{PACKAGE_NAME}/css/aa-sov-timer.min.css?v={context["version"]}'
81
82
  )
82
83
 
83
84
  self.assertIn(member=expected_static_css_src, container=rendered_template)
84
85
  self.assertNotIn(member="integrity=", container=rendered_template)
86
+
87
+ def test_invalid_file_type(self) -> None:
88
+ """
89
+ Test should raise a ValueError for an invalid file type
90
+
91
+ :return:
92
+ :rtype:
93
+ """
94
+
95
+ context = Context({"version": __version__})
96
+ template_to_render = Template(
97
+ template_string=(
98
+ "{% load sovtimer %}" "{% sovtimer_static 'invalid/invalid.txt' %}"
99
+ )
100
+ )
101
+
102
+ with self.assertRaises(ValueError):
103
+ template_to_render.render(context=context)
@@ -1,2 +0,0 @@
1
- $(document).ready(()=>{function n(t){return t&&"object"==typeof t&&!Array.isArray(t)&&!(t instanceof Date)}function i(e,...t){return t.length&&t.forEach(t=>{if(n(e)&&n(t))for(var a in t)n(t[a])?"__proto__"!==a&&"constructor"!==a&&"prototype"!==a&&(e[a]&&n(e[a])||(e[a]={}),i(e[a],t[a])):e[a]=t[a]}),e}let m=sovtimerJsSettingsDefaults;"undefined"!=typeof sovtimerJsSettingsOverride&&(m=i(sovtimerJsSettingsDefaults,sovtimerJsSettingsOverride));const l=$(".aa-sovtimer-timers-total"),d=$(".aa-sovtimer-timers-upcoming"),c=$(".aa-sovtimer-timers-active"),r=t=>{let a="",e="aa-sovtimer-remaining";t<0?(e+=" aa-sovtimer-timer-elapsed",a="-",t=Math.abs(t),t++):t--;const n=Math.floor(t/86400);let i=Math.floor(t/3600)%24,r=Math.floor(t/60)%60,o=Math.floor(t)%60;return i<10&&(i="0"+i),r<10&&(r="0"+r),o<10&&(o="0"+o),{countdown:`<span class="${e}">${a}${n}d ${i}h ${r}m ${o}s</span>`,remainingTimeInSeconds:a+t}},o=$(".aa-sovtimer-campaigns").DataTable({language:m.dataTables.language,ajax:{url:m.url.ajaxUpdate,dataSrc:"",cache:!1},columns:[{data:"event_type"},{data:"solar_system_name_html"},{data:"constellation_name_html"},{data:"region_name_html"},{data:"defender_name_html"},{data:"adm"},{data:"start_time",render:{_:t=>moment(t).locale(m.language.momentJS).utc().format(m.datetimeFormat.datetimeWithSeconds),sort:t=>t}},{data:"remaining_time"},{data:"campaign_progress"},{data:"remaining_time_in_seconds"},{data:"solar_system_name"},{data:"constellation_name"},{data:"region_name"},{data:"defender_name"},{data:"active_campaign"}],columnDefs:[{visible:!1,targets:[0,9,10,11,12,13,14]},{width:"150px",targets:[8]}],order:[[6,"asc"]],filterDropDown:{columns:[{idx:10,title:m.translation.dtFilter.system},{idx:11,title:m.translation.dtFilter.constellation},{idx:12,title:m.translation.dtFilter.region},{idx:13,title:m.translation.dtFilter.owner},{idx:14,title:m.translation.dtFilter.activeCampaign}],autoSize:!1,bootstrap:!0,bootstrap_version:5},createdRow:(t,a)=>{const e=l.html(),n=parseInt(e)+1;if(l.html(n),a.active_campaign===m.translation.no&&a.remaining_time_in_seconds<=m.upcomingTimerThreshold){$(t).addClass("aa-sovtimer-upcoming-campaign");const i=d.html(),r=parseInt(i)+1;d.html(r)}if(a.active_campaign===m.translation.yes){$(t).addClass("aa-sovtimer-active-campaign");const o=c.html(),s=parseInt(o)+1;c.html(s)}},paging:!1});setInterval(()=>{o.ajax.reload(t=>{l.html("0"),d.html("0"),c.html("0"),$.each(t,(t,a)=>{const e=l.html(),n=parseInt(e)+1;if(l.html(n),a.active_campaign===m.translation.no&&a.remaining_time_in_seconds<=m.upcomingTimerThreshold){const i=d.html(),r=parseInt(i)+1;d.html(r)}if(a.active_campaign===m.translation.yes){const o=c.html(),s=parseInt(o)+1;c.html(s)}})})},3e4),setInterval(()=>{o.rows().every(t=>{const a=o.row(t).data(),e=r(a.remaining_time_in_seconds);a.remaining_time_in_seconds=e.remainingTimeInSeconds,a.remaining_time=e.countdown,o.row(t).data(a)})},1e3)});
2
- //# sourceMappingURL=aa-sov-timer.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["aa-sov-timer.js"],"names":["$","document","ready","isObject","item","Array","isArray","Date","deepMerge","target","sources","length","forEach","source","key","let","sovtimerSettings","sovtimerJsSettingsDefaults","sovtimerJsSettingsOverride","elementTimerTotal","elementTimerUpcoming","elementTimerActive","secondsToRemainingTime","prefix","spanClasses","secondsRemaining","Math","abs","days","floor","hours","minutes","seconds","countdown","remainingTimeInSeconds","sovCampaignTable","DataTable","language","dataTables","ajax","url","ajaxUpdate","dataSrc","cache","columns","data","render","_","moment","locale","momentJS","utc","format","datetimeFormat","datetimeWithSeconds","sort","columnDefs","visible","targets","width","order","filterDropDown","idx","title","translation","dtFilter","system","constellation","region","owner","activeCampaign","autoSize","bootstrap","bootstrap_version","createdRow","row","currentTotal","html","newTotal","parseInt","active_campaign","no","remaining_time_in_seconds","upcomingTimerThreshold","addClass","currentUpcoming","newUpcoming","yes","currentActive","newActive","paging","setInterval","reload","each","tableData","i","rows","every","element","remaining","remaining_time"],"mappings":"AAEAA,EAAEC,QAAQ,EAAEC,MAAM,KASd,SAASC,EAAUC,GACf,OACIA,GAAwB,UAAhB,OAAOA,GAAqB,CAACC,MAAMC,QAAQF,CAAI,GAAK,EAAEA,aAAgBG,KAEtF,CAYA,SAASC,EAAWC,KAAWC,GA0B3B,OAzBKA,EAAQC,QAKbD,EAAQE,QAAQC,IACZ,GAAIV,EAASM,CAAM,GAAKN,EAASU,CAAM,EACnC,IAAK,IAAMC,KAAOD,EACVV,EAASU,EAAOC,EAAI,EACR,cAARA,GAA+B,gBAARA,GAAiC,cAARA,IAI/CL,EAAOK,IAASX,EAASM,EA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uB,CAAO,EAAErD,KAAKA,CAAI,CAC3C,CAAC,CACL,EAAG,GAAI,CACX,CAAC"}
@@ -1,204 +0,0 @@
1
- """
2
- The tasks
3
- """
4
-
5
- # Third Party
6
- from celery import shared_task
7
-
8
- # Django
9
- from django.core.cache import cache
10
- from django.db import transaction
11
-
12
- # Alliance Auth
13
- from allianceauth.services.hooks import get_extension_logger
14
- from allianceauth.services.tasks import QueueOnce
15
-
16
- # Alliance Auth (External Libs)
17
- from app_utils.logging import LoggerAddTag
18
- from eveuniverse.core.esitools import is_esi_online
19
- from eveuniverse.models import EveEntity, EveSolarSystem
20
-
21
- # AA Sovereignty Timer
22
- from sovtimer import __title__
23
- from sovtimer.models import Campaign, SovereigntyStructure
24
-
25
- logger = LoggerAddTag(my_logger=get_extension_logger(name=__name__), prefix=__title__)
26
-
27
-
28
- ESI_ERROR_LIMIT = 50
29
- ESI_TIMEOUT_ONCE_ERROR_LIMIT_REACHED = 60
30
- ESI_SOV_STRUCTURES_CACHE_KEY = "sov_structures_cache"
31
- ESI_MAX_RETRIES = 3
32
-
33
- TASK_TIME_LIMIT = 600 # Stop after 10 minutes
34
-
35
- # Params for all tasks
36
- TASK_PRIORITY = 6
37
- TASK_ONCE_ARGS = {"graceful": True}
38
- TASK_ONCE = {"base": QueueOnce, "once": TASK_ONCE_ARGS}
39
-
40
- TASK_DEFAULTS = {"time_limit": TASK_TIME_LIMIT, "max_retries": ESI_MAX_RETRIES}
41
- TASK_DEFAULTS_ONCE = {**TASK_DEFAULTS, **TASK_ONCE}
42
-
43
-
44
- @shared_task(**TASK_DEFAULTS_ONCE)
45
- def run_sov_campaign_updates() -> None:
46
- """
47
- Update all sov campaigns
48
- """
49
-
50
- if not is_esi_online():
51
- logger.info(
52
- msg=(
53
- "ESI seems to be offline, currently. "
54
- "Can't start ESI related tasks. Aborting …"
55
- )
56
- )
57
-
58
- return
59
-
60
- logger.info(msg="Updating sovereignty structures and campaigns from ESI …")
61
-
62
- update_sov_structures.apply_async(priority=TASK_PRIORITY, once=TASK_ONCE_ARGS)
63
- update_sov_campaigns.apply_async(priority=TASK_PRIORITY, once=TASK_ONCE_ARGS)
64
-
65
-
66
- @shared_task(**TASK_DEFAULTS_ONCE)
67
- def update_sov_campaigns() -> None:
68
- """
69
- Update sov campaigns
70
- """
71
-
72
- campaigns_from_esi = Campaign.get_sov_campaigns_from_esi()
73
-
74
- logger.debug(
75
- msg=f"Number of sovereignty campaigns from ESI: {len(campaigns_from_esi or [])}"
76
- )
77
-
78
- if campaigns_from_esi:
79
- logger.debug(msg="Updating sovereignty campaigns …")
80
-
81
- with transaction.atomic():
82
- campaigns = []
83
-
84
- for campaign in campaigns_from_esi:
85
- EveEntity.objects.get_or_create(id=campaign["defender_id"])
86
-
87
- campaign_current__defender_score = campaign["defender_score"]
88
-
89
- try:
90
- campaign_previous = Campaign.objects.get(
91
- campaign_id=campaign["campaign_id"]
92
- )
93
- except Campaign.DoesNotExist:
94
- campaign_current__progress_previous = (
95
- campaign_current__defender_score
96
- )
97
- else:
98
- campaign_previous__progress_previous = (
99
- campaign_previous.progress_previous
100
- )
101
-
102
- campaign_previous__progress = campaign_previous.defender_score
103
- campaign_current__progress_previous = campaign_previous__progress
104
-
105
- if campaign_previous__progress == campaign_current__defender_score:
106
- campaign_current__progress_previous = (
107
- campaign_previous__progress_previous
108
- )
109
-
110
- campaigns.append(
111
- Campaign(
112
- attackers_score=campaign["attackers_score"],
113
- campaign_id=campaign["campaign_id"],
114
- defender_score=campaign["defender_score"],
115
- event_type=campaign["event_type"],
116
- start_time=campaign["start_time"],
117
- structure_id=campaign["structure_id"],
118
- progress_current=campaign_current__defender_score,
119
- progress_previous=campaign_current__progress_previous,
120
- )
121
- )
122
-
123
- Campaign.objects.all().delete()
124
- Campaign.objects.bulk_create(
125
- objs=campaigns,
126
- batch_size=500,
127
- ignore_conflicts=True,
128
- )
129
-
130
- EveEntity.objects.bulk_update_new_esi()
131
-
132
- logger.info(msg=f"{len(campaigns)} sovereignty campaigns updated from ESI.")
133
-
134
-
135
- @shared_task(**TASK_DEFAULTS_ONCE)
136
- def update_sov_structures() -> None:
137
- """
138
- Update sov structures
139
- """
140
-
141
- if cache.get(ESI_SOV_STRUCTURES_CACHE_KEY) is None:
142
- logger.debug(msg="Updating sovereignty structures …")
143
- structures_from_esi = SovereigntyStructure.get_sov_structures_from_esi()
144
-
145
- if structures_from_esi:
146
- with transaction.atomic():
147
- esi_structure_ids = []
148
- sov_structures = []
149
-
150
- structure_count = 0
151
-
152
- for structure in structures_from_esi:
153
- esi_structure_ids.append(structure["structure_id"])
154
-
155
- structure_alliance, _ = EveEntity.objects.get_or_create(
156
- id=structure["alliance_id"]
157
- )
158
-
159
- structure_solar_system = EveSolarSystem.objects.get(
160
- id=structure["solar_system_id"]
161
- )
162
-
163
- vulnerability_occupancy_level = 1
164
- if structure["vulnerability_occupancy_level"]:
165
- vulnerability_occupancy_level = structure[
166
- "vulnerability_occupancy_level"
167
- ]
168
-
169
- vulnerable_end_time = None
170
- if structure["vulnerable_end_time"]:
171
- vulnerable_end_time = structure["vulnerable_end_time"]
172
-
173
- vulnerable_start_time = None
174
- if structure["vulnerable_start_time"]:
175
- vulnerable_start_time = structure["vulnerable_start_time"]
176
-
177
- sov_structures.append(
178
- SovereigntyStructure(
179
- alliance=structure_alliance,
180
- solar_system=structure_solar_system,
181
- structure_id=structure["structure_id"],
182
- structure_type_id=structure["structure_type_id"],
183
- vulnerability_occupancy_level=vulnerability_occupancy_level,
184
- vulnerable_end_time=vulnerable_end_time,
185
- vulnerable_start_time=vulnerable_start_time,
186
- )
187
- )
188
-
189
- structure_count += 1
190
-
191
- SovereigntyStructure.objects.bulk_create(
192
- objs=sov_structures,
193
- batch_size=500,
194
- ignore_conflicts=True,
195
- )
196
-
197
- EveEntity.objects.bulk_update_new_esi()
198
- SovereigntyStructure.objects.exclude(pk__in=esi_structure_ids).delete()
199
-
200
- cache.set(ESI_SOV_STRUCTURES_CACHE_KEY, True, 120)
201
-
202
- logger.info(
203
- msg=f"{structure_count} sovereignty structures updated from ESI."
204
- )
File without changes
File without changes