Compare commits

..

30 Commits

Author SHA1 Message Date
Ariel Rin
71c9faaf28 Version Bump 3.0.0b2 2022-07-07 18:15:37 +10:00
Ariel Rin
236c70316c Merge branch 'master' of https://gitlab.com/allianceauth/allianceauth into v3.x 2022-07-07 18:07:49 +10:00
Ariel Rin
0d0686f58a Merge branch 'allianceauth-prefix-static-files-directory' into v3.x 2022-07-07 18:01:12 +10:00
Ariel Rin
3706a1aedf Merge branch 'improve-autodocs-for-models' into 'master'
Improve autodocs for models & more

See merge request allianceauth/allianceauth!1435
2022-07-07 07:38:58 +00:00
Ariel Rin
47f1b77320 Merge branch 'consolidate-redis-client-access' into 'master'
Ensure backwards compatibility when fetching a redis client

See merge request allianceauth/allianceauth!1428
2022-07-07 07:37:21 +00:00
Erik Kalkoken
8dec242a93 Ensure backwards compatibility when fetching a redis client 2022-07-07 07:37:21 +00:00
Ariel Rin
6b934060dd Merge branch 'remove-old-unused-templates' into 'v3.x'
Remove unused templates

See merge request allianceauth/allianceauth!1431
2022-07-07 07:36:21 +00:00
Ariel Rin
ff88a16163 Merge branch 'smf-2.1-compatibility' into 'v3.x'
SMF 2.1 compatibility

See merge request allianceauth/allianceauth!1432
2022-07-07 07:35:58 +00:00
Ariel Rin
e81a66b74b Merge branch 'setup.cfg-vs-manifest-part-2' into 'v3.x'
setup.cfg vs MANIFEST.in (Round 2)

See merge request allianceauth/allianceauth!1434
2022-07-07 07:34:17 +00:00
ErikKalkoken
2ff200c566 Refer to django-esi docs 2022-06-27 13:43:45 +02:00
ErikKalkoken
091a2637ea Add extension to improve autodocs for Django models & enable source links 2022-06-27 13:41:15 +02:00
Peter Pfeufer
6c7729308c Should be find_namespace 2022-06-27 05:39:45 +02:00
Peter Pfeufer
0195ef23d5 Attempt to remove MANIFEST.in file (Part 2) 2022-06-27 05:38:31 +02:00
Peter Pfeufer
a7afa4a0c3 Background for login page fixed 2022-06-25 14:44:28 +02:00
Peter Pfeufer
004100091f Moved authentication and services into allianceauth folder 2022-06-25 14:01:32 +02:00
Peter Pfeufer
20231ce198 Load static files from their new place 2022-06-25 13:51:46 +02:00
Peter Pfeufer
0851a6d085 [Cleanup] Removed {% load static %} when no static files are loaded 2022-06-25 13:51:10 +02:00
Peter Pfeufer
0cd36ad5bc Moved SSO button from "root" to "authentication" 2022-06-25 13:46:56 +02:00
Peter Pfeufer
7618dd0f91 Removed obsolete attribute 2022-06-25 13:31:12 +02:00
Peter Pfeufer
cf49a2cb65 Moved static files to their own directory 2022-06-25 13:30:32 +02:00
Peter Pfeufer
cbdce18633 Use regex to determine the SMF version (thanks @colcrunch) 2022-06-24 23:01:16 +02:00
Peter Pfeufer
a0d14eb1d3 SQL queries need to be different depending on SMF version
It's not a work of art, but it does the job. If anyone has a better idea, hit the comments ...
2022-06-24 22:40:04 +02:00
Peter Pfeufer
53ce4d2453 f-strings in log messages
Easier to read and modernized the code
2022-06-24 21:09:32 +02:00
Peter Pfeufer
1ddb041d6d Add Exception messages to exception logging 2022-06-24 21:00:54 +02:00
Peter Pfeufer
43cbfd1c47 Stop usage of deprecated logger functions 2022-06-24 20:57:58 +02:00
Peter Pfeufer
b9a8495a43 Add exception message to log output 2022-06-24 20:56:38 +02:00
Peter Pfeufer
e296477880 Use pwhash instead of passwd
This way we ensure that the initial password actually works and the user doesn't have to set a new one right away.
2022-06-24 20:55:04 +02:00
Peter Pfeufer
bd5c2d8cbc Removed non existent table columns from SQL query 2022-06-24 20:54:05 +02:00
Peter Pfeufer
ccd40d5c68 Remove unused templates 2022-06-23 21:26:13 +02:00
Ariel Rin
113977b19f Version Bump 2.13.0 2022-06-18 13:07:36 +10:00
109 changed files with 234 additions and 213 deletions

View File

@@ -25,7 +25,7 @@ repos:
rev: 2.4.0 rev: 2.4.0
hooks: hooks:
- id: editorconfig-checker - id: editorconfig-checker
exclude: ^(LICENSE|allianceauth\/static\/css\/themes\/bootstrap-locals.less|allianceauth\/eveonline\/swagger.json|(.*.po)|(.*.mo)) exclude: ^(LICENSE|allianceauth\/static\/allianceauth\/css\/themes\/bootstrap-locals.less|allianceauth\/eveonline\/swagger.json|(.*.po)|(.*.mo))
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v2.34.0 rev: v2.34.0

View File

@@ -1,7 +0,0 @@
include LICENSE
include README.md
include MANIFEST.in
graft allianceauth
global-exclude __pycache__
global-exclude *.py[co]

View File

@@ -1,7 +1,7 @@
# This will make sure the app is always imported when # This will make sure the app is always imported when
# Django starts so that shared_task will use this app. # Django starts so that shared_task will use this app.
__version__ = '3.0.0b1' __version__ = '3.0.0b2'
__title__ = 'Alliance Auth' __title__ = 'Alliance Auth'
__url__ = 'https://gitlab.com/allianceauth/allianceauth' __url__ = 'https://gitlab.com/allianceauth/allianceauth'
NAME = f'{__title__} v{__version__}' NAME = f'{__title__} v{__version__}'

View File

@@ -322,7 +322,7 @@ class UserAdmin(BaseUserAdmin):
class Media: class Media:
css = { css = {
"all": ("authentication/css/admin.css",) "all": ("allianceauth/authentication/css/admin.css",)
} }
def get_queryset(self, request): def get_queryset(self, request):
@@ -542,7 +542,7 @@ class BaseOwnershipAdmin(admin.ModelAdmin):
class Media: class Media:
css = { css = {
"all": ("authentication/css/admin.css",) "all": ("allianceauth/authentication/css/admin.css",)
} }
def get_readonly_fields(self, request, obj=None): def get_readonly_fields(self, request, obj=None):

View File

@@ -5,7 +5,7 @@ from typing import List, Optional
from pytz import utc from pytz import utc
from redis import Redis, RedisError from redis import Redis, RedisError
from django_redis import get_redis_connection from allianceauth.utils.cache import get_redis_client
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -39,7 +39,7 @@ class EventSeries:
_ROOT_KEY = "ALLIANCEAUTH_EVENT_SERIES" _ROOT_KEY = "ALLIANCEAUTH_EVENT_SERIES"
def __init__(self, key_id: str, redis: Redis = None) -> None: def __init__(self, key_id: str, redis: Redis = None) -> None:
self._redis = get_redis_connection("default") if not redis else redis self._redis = get_redis_client() if not redis else redis
try: try:
if not self._redis.ping(): if not self._redis.ping():
raise RuntimeError() raise RuntimeError()

View File

@@ -18,7 +18,7 @@ MODULE_PATH = "allianceauth.authentication.task_statistics.event_series"
class TestEventSeries(TestCase): class TestEventSeries(TestCase):
def test_should_abort_without_redis_client(self): def test_should_abort_without_redis_client(self):
# when # when
with patch(MODULE_PATH + ".get_redis_connection") as mock: with patch(MODULE_PATH + ".get_redis_client") as mock:
mock.return_value = None mock.return_value = None
events = EventSeries("dummy") events = EventSeries("dummy")
# then # then
@@ -27,8 +27,8 @@ class TestEventSeries(TestCase):
def test_should_disable_itself_if_redis_not_available_1(self): def test_should_disable_itself_if_redis_not_available_1(self):
# when # when
with patch(MODULE_PATH + ".get_redis_connection") as mock_get_redis_connection: with patch(MODULE_PATH + ".get_redis_client") as mock_get_master_client:
mock_get_redis_connection.return_value.ping.side_effect = RedisError mock_get_master_client.return_value.ping.side_effect = RedisError
events = EventSeries("dummy") events = EventSeries("dummy")
# then # then
self.assertIsInstance(events._redis, _RedisStub) self.assertIsInstance(events._redis, _RedisStub)
@@ -36,8 +36,8 @@ class TestEventSeries(TestCase):
def test_should_disable_itself_if_redis_not_available_2(self): def test_should_disable_itself_if_redis_not_available_2(self):
# when # when
with patch(MODULE_PATH + ".get_redis_connection") as mock_get_redis_connection: with patch(MODULE_PATH + ".get_redis_client") as mock_get_master_client:
mock_get_redis_connection.return_value.ping.return_value = False mock_get_master_client.return_value.ping.return_value = False
events = EventSeries("dummy") events = EventSeries("dummy")
# then # then
self.assertIsInstance(events._redis, _RedisStub) self.assertIsInstance(events._redis, _RedisStub)

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Dashboard" %}{% endblock %} {% block page_title %}{% translate "Dashboard" %}{% endblock %}
@@ -28,7 +27,7 @@
<table class="table"> <table class="table">
<tr> <tr>
<td class="text-center"> <td class="text-center">
<img class="ra-avatar"src="{{ main.portrait_url_128 }}"> <img class="ra-avatar" src="{{ main.portrait_url_128 }}">
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -40,7 +39,7 @@
<table class="table"> <table class="table">
<tr> <tr>
<td class="text-center"> <td class="text-center">
<img class="ra-avatar"src="{{ main.corporation_logo_url_128 }}"> <img class="ra-avatar" src="{{ main.corporation_logo_url_128 }}">
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -53,7 +52,7 @@
<table class="table"> <table class="table">
<tr> <tr>
<td class="text-center"> <td class="text-center">
<img class="ra-avatar"src="{{ main.alliance_logo_url_128 }}"> <img class="ra-avatar" src="{{ main.alliance_logo_url_128 }}">
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -64,7 +63,7 @@
<table class="table"> <table class="table">
<tr> <tr>
<td class="text-center"> <td class="text-center">
<img class="ra-avatar"src="{{ main.faction_logo_url_128 }}"> <img class="ra-avatar" src="{{ main.faction_logo_url_128 }}">
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@@ -7,7 +7,7 @@
<meta name="description" content=""> <meta name="description" content="">
<meta name="author" content=""> <meta name="author" content="">
<meta property="og:title" content="{{ SITE_NAME }}"> <meta property="og:title" content="{{ SITE_NAME }}">
<meta property="og:image" content="{{ request.scheme }}://{{ request.get_host }}{% static 'icons/apple-touch-icon.png' %}"> <meta property="og:image" content="{{ request.scheme }}://{{ request.get_host }}{% static 'allianceauth/icons/apple-touch-icon.png' %}">
<meta property="og:description" content="Alliance Auth - An auth system for EVE Online to help in-game organizations manage online service access."> <meta property="og:description" content="Alliance Auth - An auth system for EVE Online to help in-game organizations manage online service access.">
{% include 'allianceauth/icons.html' %} {% include 'allianceauth/icons.html' %}
@@ -21,7 +21,7 @@
<style> <style>
body { body {
background: url('{% static 'authentication/img/background.jpg' %}') no-repeat center center fixed; background: url('{% static 'allianceauth/authentication/img/background.jpg' %}') no-repeat center center fixed;
-webkit-background-size: cover; -webkit-background-size: cover;
-moz-background-size: cover; -moz-background-size: cover;
-o-background-size: cover; -o-background-size: cover;

View File

@@ -7,6 +7,6 @@
{% block middle_box_content %} {% block middle_box_content %}
<a href="{% url 'auth_sso_login' %}{% if request.GET.next %}?next={{request.GET.next}}{%endif%}"> <a href="{% url 'auth_sso_login' %}{% if request.GET.next %}?next={{request.GET.next}}{%endif%}">
<img class="img-responsive center-block" src="{% static 'img/sso/EVE_SSO_Login_Buttons_Large_Black.png' %}" border=0> <img class="img-responsive center-block" src="{% static 'allianceauth/authentication/img/sso/EVE_SSO_Login_Buttons_Large_Black.png' %}">
</a> </a>
{% endblock %} {% endblock %}

View File

@@ -1,5 +1,4 @@
{% extends 'public/base.html' %} {% extends 'public/base.html' %}
{% load static %}
{% block content %} {% block content %}
<div class="col-md-4 col-md-offset-4"> <div class="col-md-4 col-md-offset-4">
{% if messages %} {% if messages %}

View File

@@ -1,6 +1,5 @@
{% extends 'public/base.html' %} {% extends 'public/base.html' %}
{% load static %}
{% load bootstrap %} {% load bootstrap %}
{% load i18n %} {% load i18n %}

View File

@@ -1,15 +0,0 @@
{% load i18n %}{% autoescape off %}
{% blocktrans trimmed %}You're receiving this email because you requested a password reset for your
user account.{% endblocktrans %}
{% translate "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{domain}}{% url 'password_reset_confirm' uidb64=uid token=token %}
{% endblock %}
{% translate "Your username, in case you've forgotten:" %} {{ user.get_username }}
{% translate "Thanks for using our site!" %}
{% blocktrans %}Your IT Team{% endblocktrans %}
{% endautoescape %}

View File

@@ -1,14 +0,0 @@
{% extends 'public/middle_box.html' %}
{% load bootstrap %}
{% load i18n %}
{% load static %}
{% block page_title %}{% translate "Register" %}{% endblock %}
{% block middle_box_content %}
<form class="form-signin" role="form" action="" method="POST">
{% csrf_token %}
{{ form|bootstrap }}
<br>
<button class="btn btn-lg btn-primary btn-block" type="submit">{% translate "Submit" %}</button>
<br>
</form>
{% endblock %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Create Fatlink" %}{% endblock page_title %} {% block page_title %}{% translate "Create Fatlink" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Fatlink view" %}{% endblock page_title %} {% block page_title %}{% translate "Fatlink view" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Personal fatlink statistics" %}{% endblock page_title %} {% block page_title %}{% translate "Personal fatlink statistics" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Personal fatlink statistics" %}{% endblock page_title %} {% block page_title %}{% translate "Personal fatlink statistics" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Fatlink Corp Statistics" %}{% endblock page_title %} {% block page_title %}{% translate "Fatlink Corp Statistics" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Fatlink statistics" %}{% endblock page_title %} {% block page_title %}{% translate "Fatlink statistics" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Fatlink view" %}{% endblock page_title %} {% block page_title %}{% translate "Fatlink view" %}{% endblock page_title %}

View File

@@ -74,7 +74,7 @@
{% block extra_javascript %} {% block extra_javascript %}
{% include 'bundles/datatables-js.html' %} {% include 'bundles/datatables-js.html' %}
{% include 'bundles/moment-js.html' with locale=True %} {% include 'bundles/moment-js.html' with locale=True %}
<script type="application/javascript" src="{% static 'js/filterDropDown/filterDropDown.min.js' %}"></script> <script type="application/javascript" src="{% static 'allianceauth/js/filterDropDown/filterDropDown.min.js' %}"></script>
{% endblock %} {% endblock %}
{% block extra_css %} {% block extra_css %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %} {% load i18n %}
{% load evelinks %} {% load evelinks %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Groups Membership" %}{% endblock page_title %} {% block page_title %}{% translate "Groups Membership" %}{% endblock page_title %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Available Groups" %}{% endblock page_title %} {% block page_title %}{% translate "Available Groups" %}{% endblock page_title %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %} {% load i18n %}
{% load evelinks %} {% load evelinks %}

View File

@@ -1,4 +1,3 @@
{% load static %}
{% load i18n %} {% load i18n %}
{% load navactive %} {% load navactive %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Choose a Corp" %}{% endblock page_title %} {% block page_title %}{% translate "Choose a Corp" %}{% endblock page_title %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Apply To" %} {{ corp.corporation_name }}{% endblock page_title %} {% block page_title %}{% translate "Apply To" %} {{ corp.corporation_name }}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "HR Application Management" %}{% endblock page_title %} {% block page_title %}{% translate "HR Application Management" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "HR Application Management" %}{% endblock page_title %} {% block page_title %}{% translate "HR Application Management" %}{% endblock page_title %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load static %}
{% load bootstrap %} {% load bootstrap %}
{% load i18n %} {% load i18n %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Notifications" %}{% endblock %} {% block page_title %}{% translate "Notifications" %}{% endblock %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "View Notification" %}{% endblock page_title %} {% block page_title %}{% translate "View Notification" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% get_current_language as LANGUAGE_CODE %} {% get_current_language as LANGUAGE_CODE %}

View File

@@ -40,7 +40,7 @@
</div> </div>
{% include 'bundles/moment-js.html' with locale=True %} {% include 'bundles/moment-js.html' with locale=True %}
<script src="{% static 'js/timers.js' %}"></script> <script src="{% static 'allianceauth/js/timers.js' %}"></script>
<script type="application/javascript"> <script type="application/javascript">
// Data // Data

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% get_current_language as LANGUAGE_CODE %} {% get_current_language as LANGUAGE_CODE %}

View File

@@ -47,7 +47,7 @@
{% block extra_javascript %} {% block extra_javascript %}
{% include 'bundles/datatables-js.html' %} {% include 'bundles/datatables-js.html' %}
<script type="application/javascript" src="{% static 'js/filterDropDown/filterDropDown.min.js' %}"></script> <script type="application/javascript" src="{% static 'allianceauth/js/filterDropDown/filterDropDown.min.js' %}"></script>
{% endblock %} {% endblock %}
{% block extra_css %} {% block extra_css %}

View File

@@ -80,7 +80,7 @@
{% block extra_javascript %} {% block extra_javascript %}
{% include 'bundles/datatables-js.html' %} {% include 'bundles/datatables-js.html' %}
<script type="application/javascript" src="{% static 'js/filterDropDown/filterDropDown.min.js' %}"></script> <script type="application/javascript" src="{% static 'allianceauth/js/filterDropDown/filterDropDown.min.js' %}"></script>
{% endblock %} {% endblock %}
{% block extra_css %} {% block extra_css %}

View File

@@ -17,7 +17,7 @@ class ServicesUserAdmin(admin.ModelAdmin):
"""Parent class for UserAdmin classes for all services""" """Parent class for UserAdmin classes for all services"""
class Media: class Media:
css = { css = {
"all": ("services/admin.css",) "all": ("allianceauth/services/admin.css",)
} }
search_fields = ('user__username',) search_fields = ('user__username',)

View File

@@ -8,7 +8,7 @@ from uuid import uuid1
from redis import Redis from redis import Redis
import requests import requests
from django_redis import get_redis_connection from allianceauth.utils.cache import get_redis_client
from allianceauth import __title__ as AUTH_TITLE, __url__, __version__ from allianceauth import __title__ as AUTH_TITLE, __url__, __version__
@@ -103,7 +103,7 @@ class DiscordClient:
self._access_token = str(access_token) self._access_token = str(access_token)
self._is_rate_limited = bool(is_rate_limited) self._is_rate_limited = bool(is_rate_limited)
if not redis: if not redis:
self._redis = get_redis_connection("default") self._redis = get_redis_client()
if not isinstance(self._redis, Redis): if not isinstance(self._redis, Redis):
raise RuntimeError( raise RuntimeError(
'This class requires a Redis client, but none was provided ' 'This class requires a Redis client, but none was provided '

View File

@@ -85,25 +85,18 @@ class TestBasicsAndHelpers(TestCase):
client = DiscordClient(TEST_BOT_TOKEN, mock_redis, is_rate_limited=True) client = DiscordClient(TEST_BOT_TOKEN, mock_redis, is_rate_limited=True)
self.assertTrue(client.is_rate_limited) self.assertTrue(client.is_rate_limited)
@patch(MODULE_PATH + '.get_redis_connection') def test_use_default_redis_if_none_provided(self):
def test_use_default_redis_if_none_provided(self, mock_caches):
my_redis = MagicMock(spec=Redis)
mock_caches.return_value = my_redis
client = DiscordClient(TEST_BOT_TOKEN) client = DiscordClient(TEST_BOT_TOKEN)
self.assertTrue(mock_caches.called) self.assertIsInstance(client._redis, Redis)
self.assertEqual(client._redis, my_redis)
@patch(MODULE_PATH + '.get_redis_connection')
def test_raise_exception_if_default_cache_is_not_redis(self, mock_caches):
my_redis = MagicMock()
mock_caches.return_value = my_redis
@patch(MODULE_PATH + '.get_redis_client')
def test_raise_exception_if_redis_client_not_found(self, mock_get_redis_client):
# given
mock_get_redis_client.return_value = None
# when
with self.assertRaises(RuntimeError): with self.assertRaises(RuntimeError):
DiscordClient(TEST_BOT_TOKEN) DiscordClient(TEST_BOT_TOKEN)
self.assertTrue(mock_caches.called)
@requests_mock.Mocker() @requests_mock.Mocker()
class TestOtherMethods(TestCase): class TestOtherMethods(TestCase):

View File

@@ -35,17 +35,17 @@ import logging
from uuid import uuid1 from uuid import uuid1
import random import random
from django.core.cache import caches
from django.contrib.auth.models import User, Group from django.contrib.auth.models import User, Group
from allianceauth.services.modules.discord.models import DiscordUser from allianceauth.services.modules.discord.models import DiscordUser
from allianceauth.utils.cache import get_redis_client
logger = logging.getLogger('allianceauth') logger = logging.getLogger('allianceauth')
MAX_RUNS = 3 MAX_RUNS = 3
def clear_cache(): def clear_cache():
default_cache = caches['default'] redis = get_redis_client()
redis = default_cache.get_master_client()
redis.flushall() redis.flushall()
logger.info('Cache flushed') logger.info('Cache flushed')

View File

@@ -14,7 +14,6 @@ from requests.exceptions import HTTPError
import requests_mock import requests_mock
from django.contrib.auth.models import Group, User from django.contrib.auth.models import Group, User
from django_redis import get_redis_connection
from django.shortcuts import reverse from django.shortcuts import reverse
from django.test import TransactionTestCase, TestCase from django.test import TransactionTestCase, TestCase
from django.test.utils import override_settings from django.test.utils import override_settings
@@ -23,6 +22,7 @@ from allianceauth.authentication.models import State
from allianceauth.eveonline.models import EveCharacter from allianceauth.eveonline.models import EveCharacter
from allianceauth.notifications.models import Notification from allianceauth.notifications.models import Notification
from allianceauth.tests.auth_utils import AuthUtils from allianceauth.tests.auth_utils import AuthUtils
from allianceauth.utils.cache import get_redis_client
from . import ( from . import (
TEST_GUILD_ID, TEST_GUILD_ID,
@@ -87,7 +87,7 @@ remove_guild_member_request = DiscordRequest(
def clear_cache(): def clear_cache():
redis = get_redis_connection('default') redis = get_redis_client()
redis.flushall() redis.flushall()
logger.info('Cache flushed') logger.info('Cache flushed')
@@ -108,7 +108,6 @@ def reset_testdata():
class TestServiceFeatures(TransactionTestCase): class TestServiceFeatures(TransactionTestCase):
fixtures = ['disable_analytics.json'] fixtures = ['disable_analytics.json']
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super().setUpClass() super().setUpClass()

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Jabber Broadcast" %}{% endblock page_title %} {% block page_title %}{% translate "Jabber Broadcast" %}{% endblock page_title %}

View File

@@ -6,6 +6,8 @@ import hashlib
import logging import logging
import re import re
from packaging import version
from django.db import connections from django.db import connections
from django.conf import settings from django.conf import settings
from allianceauth.eveonline.models import EveCharacter from allianceauth.eveonline.models import EveCharacter
@@ -20,9 +22,18 @@ class SmfManager:
def __init__(self): def __init__(self):
pass pass
SQL_ADD_USER = r"INSERT INTO %smembers (member_name, passwd, email_address, date_registered, real_name," \ # For SMF < 2.1
r" buddy_list, message_labels, openid_uri, signature, ignore_boards) " \ SQL_ADD_USER_SMF_20 = r"INSERT INTO %smembers (member_name, passwd, email_address, date_registered, real_name," \
r"VALUES (%%s, %%s, %%s, %%s, %%s, 0, 0, 0, 0, 0)" % TABLE_PREFIX r" buddy_list, message_labels, openid_uri, signature, ignore_boards) " \
r"VALUES (%%s, %%s, %%s, %%s, %%s, 0, 0, 0, 0, 0)" % TABLE_PREFIX
# For SMF >= 2.1
SQL_ADD_USER_SMF_21 = r"INSERT INTO %smembers (member_name, passwd, email_address, date_registered, real_name," \
r" buddy_list, signature, ignore_boards) " \
r"VALUES (%%s, %%s, %%s, %%s, %%s, 0, 0, 0)" % TABLE_PREFIX
# returns something like »window.smfVersion = "SMF 2.0.19";«
SQL_GET_CURRENT_SMF_VERSION = r"SELECT data FROM %sadmin_info_files WHERE filename = %%s" % TABLE_PREFIX
SQL_DEL_USER = r"DELETE FROM %smembers where member_name = %%s" % TABLE_PREFIX SQL_DEL_USER = r"DELETE FROM %smembers where member_name = %%s" % TABLE_PREFIX
@@ -46,6 +57,26 @@ class SmfManager:
SQL_ADD_USER_AVATAR = r"UPDATE %smembers SET avatar = %%s WHERE id_member = %%s" % TABLE_PREFIX SQL_ADD_USER_AVATAR = r"UPDATE %smembers SET avatar = %%s WHERE id_member = %%s" % TABLE_PREFIX
@classmethod
def _get_current_smf_version(cls) -> str:
"""
Get the current SMF version from the DB
:return:
"""
cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_GET_CURRENT_SMF_VERSION, ['current-version.js'])
row = cursor.fetchone()
db_result = row[0]
pattern = re.compile(r"\d+(\.\d+)+")
result = pattern.search(db_result)
smf_version = result.group(0)
return smf_version
@staticmethod @staticmethod
def _sanitize_groupname(name): def _sanitize_groupname(name):
name = name.strip(' _') name = name.strip(' _')
@@ -73,15 +104,15 @@ class SmfManager:
@classmethod @classmethod
def create_group(cls, groupname): def create_group(cls, groupname):
logger.debug("Creating smf group %s" % groupname) logger.debug(f"Creating smf group {groupname}")
cursor = connections['smf'].cursor() cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_ADD_GROUP, [groupname, groupname]) cursor.execute(cls.SQL_ADD_GROUP, [groupname, groupname])
logger.info("Created smf group %s" % groupname) logger.info(f"Created smf group {groupname}")
return cls.get_group_id(groupname) return cls.get_group_id(groupname)
@classmethod @classmethod
def get_group_id(cls, groupname): def get_group_id(cls, groupname):
logger.debug("Getting smf group id for groupname %s" % groupname) logger.debug(f"Getting smf group id for groupname {groupname}")
cursor = connections['smf'].cursor() cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_GET_GROUP_ID, [groupname]) cursor.execute(cls.SQL_GET_GROUP_ID, [groupname])
row = cursor.fetchone() row = cursor.fetchone()
@@ -90,14 +121,14 @@ class SmfManager:
@classmethod @classmethod
def check_user(cls, username): def check_user(cls, username):
logger.debug("Checking smf username %s" % username) logger.debug(f"Checking smf username {username}")
cursor = connections['smf'].cursor() cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_USER_ID_FROM_USERNAME, [cls.santatize_username(username)]) cursor.execute(cls.SQL_USER_ID_FROM_USERNAME, [cls.santatize_username(username)])
row = cursor.fetchone() row = cursor.fetchone()
if row: if row:
logger.debug("Found user %s on smf" % username) logger.debug(f"Found user {username} on smf")
return True return True
logger.debug("User %s not found on smf" % username) logger.debug(f"User {username} not found on smf")
return False return False
@classmethod @classmethod
@@ -110,7 +141,7 @@ class SmfManager:
@classmethod @classmethod
def get_user_id(cls, username): def get_user_id(cls, username):
logger.debug("Getting smf user id for username %s" % username) logger.debug(f"Getting smf user id for username {username}")
cursor = connections['smf'].cursor() cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_USER_ID_FROM_USERNAME, [username]) cursor.execute(cls.SQL_USER_ID_FROM_USERNAME, [username])
row = cursor.fetchone() row = cursor.fetchone()
@@ -118,7 +149,7 @@ class SmfManager:
logger.debug(f"Got smf user id {row[0]} for username {username}") logger.debug(f"Got smf user id {row[0]} for username {username}")
return row[0] return row[0]
else: else:
logger.error("username %s not found on smf. Unable to determine user id ." % username) logger.error(f"username {username} not found on smf. Unable to determine user id .")
return None return None
@classmethod @classmethod
@@ -130,12 +161,12 @@ class SmfManager:
out = {} out = {}
for row in rows: for row in rows:
out[row[1]] = row[0] out[row[1]] = row[0]
logger.debug("Got smf groups %s" % out) logger.debug(f"Got smf groups {out}")
return out return out
@classmethod @classmethod
def get_user_groups(cls, userid): def get_user_groups(cls, userid):
logger.debug("Getting smf user id %s groups" % userid) logger.debug(f"Getting smf user id {userid} groups")
cursor = connections['smf'].cursor() cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_GET_USER_GROUPS, [userid]) cursor.execute(cls.SQL_GET_USER_GROUPS, [userid])
out = [row[0] for row in cursor.fetchall()] out = [row[0] for row in cursor.fetchall()]
@@ -144,8 +175,11 @@ class SmfManager:
@classmethod @classmethod
def add_user(cls, username, email_address, groups, characterid): def add_user(cls, username, email_address, groups, characterid):
logger.debug("Adding smf user with member_name {}, email_address {}, characterid {}".format( logger.debug(
username, email_address, characterid)) f"Adding smf user with member_name {username}, "
f"email_address {email_address}, "
f"characterid {characterid}"
)
cursor = connections['smf'].cursor() cursor = connections['smf'].cursor()
username_clean = cls.santatize_username(username) username_clean = cls.santatize_username(username)
passwd = cls.generate_random_pass() passwd = cls.generate_random_pass()
@@ -154,42 +188,59 @@ class SmfManager:
register_date = cls.get_current_utc_date() register_date = cls.get_current_utc_date()
# check if the username was simply revoked # check if the username was simply revoked
if cls.check_user(username) is True: if cls.check_user(username) is True:
logger.warn("Unable to add smf user with username %s - already exists. Updating user instead." % username) logger.warning(f"Unable to add smf user with username {username} - already exists. Updating user instead.")
cls.__update_user_info(username_clean, email_address, pwhash) cls.__update_user_info(username_clean, email_address, pwhash)
else: else:
try: try:
cursor.execute(cls.SQL_ADD_USER, smf_version = cls._get_current_smf_version()
[username_clean, passwd, email_address, register_date, username_clean])
if version.parse(smf_version) < version.parse("2.1"):
logger.debug("SMF compatibility: < 2.1")
cursor.execute(
cls.SQL_ADD_USER_SMF_20,
[username_clean, pwhash, email_address, register_date, username_clean]
)
else:
logger.debug("SMF compatibility: >= 2.1")
cursor.execute(
cls.SQL_ADD_USER_SMF_21,
[username_clean, pwhash, email_address, register_date, username_clean]
)
cls.add_avatar(username_clean, characterid) cls.add_avatar(username_clean, characterid)
logger.info("Added smf member_name %s" % username_clean) logger.info(f"Added smf member_name {username_clean}")
cls.update_groups(username_clean, groups) cls.update_groups(username_clean, groups)
except: except Exception as e:
logger.warn("Unable to add smf user %s" % username_clean) logger.warning(f"Unable to add smf user {username_clean}: {e}")
pass pass
return username_clean, passwd return username_clean, passwd
@classmethod @classmethod
def __update_user_info(cls, username, email_address, passwd): def __update_user_info(cls, username, email_address, passwd):
logger.debug( logger.debug(
f"Updating smf user {username} info: username {email_address} password of length {len(passwd)}") f"Updating smf user {username} info: "
f"username {email_address} "
f"password of length {len(passwd)}"
)
cursor = connections['smf'].cursor() cursor = connections['smf'].cursor()
try: try:
cursor.execute(cls.SQL_DIS_USER, [email_address, passwd, username]) cursor.execute(cls.SQL_DIS_USER, [email_address, passwd, username])
logger.info("Updated smf user %s info" % username) logger.info(f"Updated smf user {username} info")
except: except Exception as e:
logger.exception("Unable to update smf user %s info." % username) logger.exception(f"Unable to update smf user {username} info. ({e})")
pass pass
@classmethod @classmethod
def delete_user(cls, username): def delete_user(cls, username):
logger.debug("Deleting smf user %s" % username) logger.debug(f"Deleting smf user {username}")
cursor = connections['smf'].cursor() cursor = connections['smf'].cursor()
if cls.check_user(username): if cls.check_user(username):
cursor.execute(cls.SQL_DEL_USER, [username]) cursor.execute(cls.SQL_DEL_USER, [username])
logger.info("Deleted smf user %s" % username) logger.info(f"Deleted smf user {username}")
return True return True
logger.error("Unable to delete smf user %s - user not found on smf." % username) logger.error(f"Unable to delete smf user {username} - user not found on smf.")
return False return False
@classmethod @classmethod
@@ -218,8 +269,8 @@ class SmfManager:
cursor = connections['smf'].cursor() cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_ADD_USER_GROUP, [groupid, userid]) cursor.execute(cls.SQL_ADD_USER_GROUP, [groupid, userid])
logger.info(f"Added smf user id {userid} to group id {groupid}") logger.info(f"Added smf user id {userid} to group id {groupid}")
except: except Exception as e:
logger.exception(f"Unable to add smf user id {userid} to group id {groupid}") logger.exception(f"Unable to add smf user id {userid} to group id {groupid} ({e})")
pass pass
@classmethod @classmethod
@@ -229,13 +280,13 @@ class SmfManager:
cursor = connections['smf'].cursor() cursor = connections['smf'].cursor()
cursor.execute(cls.SQL_REMOVE_USER_GROUP, [groupid, userid]) cursor.execute(cls.SQL_REMOVE_USER_GROUP, [groupid, userid])
logger.info(f"Removed smf user id {userid} from group id {groupid}") logger.info(f"Removed smf user id {userid} from group id {groupid}")
except: except Exception as e:
logger.exception(f"Unable to remove smf user id {userid} from group id {groupid}") logger.exception(f"Unable to remove smf user id {userid} from group id {groupid} ({e})")
pass pass
@classmethod @classmethod
def disable_user(cls, username): def disable_user(cls, username):
logger.debug("Disabling smf user %s" % username) logger.debug(f"Disabling smf user {username}")
cursor = connections['smf'].cursor() cursor = connections['smf'].cursor()
password = cls.generate_random_pass() password = cls.generate_random_pass()
@@ -245,15 +296,15 @@ class SmfManager:
cursor.execute(cls.SQL_DIS_USER, [revoke_email, pwhash, username]) cursor.execute(cls.SQL_DIS_USER, [revoke_email, pwhash, username])
cls.get_user_id(username) cls.get_user_id(username)
cls.update_groups(username, []) cls.update_groups(username, [])
logger.info("Disabled smf user %s" % username) logger.info(f"Disabled smf user {username}")
return True return True
except TypeError: except TypeError:
logger.exception("TypeError occured while disabling user %s - failed to disable." % username) logger.exception(f"TypeError occured while disabling user {username} - failed to disable.")
return False return False
@classmethod @classmethod
def update_user_password(cls, username, characterid, password=None): def update_user_password(cls, username, characterid, password=None):
logger.debug("Updating smf user %s password" % username) logger.debug(f"Updating smf user {username} password")
cursor = connections['smf'].cursor() cursor = connections['smf'].cursor()
if not password: if not password:
password = cls.generate_random_pass() password = cls.generate_random_pass()
@@ -261,10 +312,12 @@ class SmfManager:
username_clean = cls.santatize_username(username) username_clean = cls.santatize_username(username)
pwhash = cls.gen_hash(username_clean, password) pwhash = cls.gen_hash(username_clean, password)
logger.debug( logger.debug(
f"Proceeding to update smf user {username} password with pwhash starting with {pwhash[0:5]}") f"Proceeding to update smf user {username} "
f"password with pwhash starting with {pwhash[0:5]}"
)
cursor.execute(cls.SQL_UPDATE_USER_PASSWORD, [pwhash, username]) cursor.execute(cls.SQL_UPDATE_USER_PASSWORD, [pwhash, username])
cls.add_avatar(username, characterid) cls.add_avatar(username, characterid)
logger.info("Updated smf user %s password." % username) logger.info(f"Updated smf user {username} password.")
return password return password
logger.error("Unable to update smf user %s password - user not found on smf." % username) logger.error(f"Unable to update smf user {username} password - user not found on smf.")
return "" return ""

View File

@@ -1,5 +1,4 @@
{% extends "admin/change_list.html" %} {% extends "admin/change_list.html" %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block object-tools-items %} {% block object-tools-items %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Verify Teamspeak" %}{% endblock page_title %} {% block page_title %}{% translate "Verify Teamspeak" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Fleet Formatter Tool" %}{% endblock page_title %} {% block page_title %}{% translate "Fleet Formatter Tool" %}{% endblock page_title %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% blocktrans with service_name=view.service_name|title %}{{ service_name }} Credentials{% endblocktrans %}{% endblock page_title %} {% block page_title %}{% blocktrans with service_name=view.service_name|title %}{{ service_name }} Credentials{% endblocktrans %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% blocktrans with service_name=view.service_name|title %}{{ service_name }} Password Change{% endblocktrans %}{% endblock page_title %} {% block page_title %}{% blocktrans with service_name=view.service_name|title %}{{ service_name }} Password Change{% endblocktrans %}{% endblock page_title %}

View File

@@ -1,5 +1,4 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Services Management" %}{% endblock page_title %} {% block page_title %}{% translate "Services Management" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "SRP Fleet Create" %}{% endblock page_title %} {% block page_title %}{% translate "SRP Fleet Create" %}{% endblock page_title %}

View File

@@ -8,7 +8,7 @@
{% block extra_css %} {% block extra_css %}
{% include 'bundles/datatables-css.html' %} {% include 'bundles/datatables-css.html' %}
{% include 'bundles/x-editable.css.html' %} {% include 'bundles/x-editable.css.html' %}
<link href="{% static 'css/checkbox.css' %}" rel="stylesheet" type="text/css"> <link href="{% static 'allianceauth/css/checkbox.css' %}" rel="stylesheet" type="text/css">
<style> <style>
.copy-text-fa-icon:hover { .copy-text-fa-icon:hover {
cursor: pointer; cursor: pointer;
@@ -30,8 +30,8 @@
width: 95%; width: 95%;
} }
.radio, .checkbox { .radio, .checkbox {
margin-top: 0px; margin-top: 0;
margin-bottom: 0px; margin-bottom: 0;
} }
.editable-error-block { .editable-error-block {
white-space: nowrap; white-space: nowrap;

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% load humanize %} {% load humanize %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "SRP Request" %}{% endblock page_title %} {% block page_title %}{% translate "SRP Request" %}{% endblock page_title %}

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %}{% translate "Update AAR Link" %}{% endblock page_title %} {% block page_title %}{% translate "Update AAR Link" %}{% endblock page_title %}

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 483 B

View File

Before

Width:  |  Height:  |  Size: 868 B

After

Width:  |  Height:  |  Size: 868 B

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -17,7 +17,7 @@
{% include 'bundles/bootstrap-css.html' %} {% include 'bundles/bootstrap-css.html' %}
{% include 'bundles/fontawesome.html' %} {% include 'bundles/fontawesome.html' %}
<link href="{% static 'css/auth-base.css' %}" type="text/css" rel="stylesheet"> <link href="{% static 'allianceauth/css/auth-base.css' %}" type="text/css" rel="stylesheet">
{% block extra_css %}{% endblock extra_css %} {% block extra_css %}{% endblock extra_css %}
</head> </head>
@@ -49,8 +49,8 @@
userNotificationsCountViewUrl: "{% url 'notifications:user_notifications_count' request.user.pk %}" userNotificationsCountViewUrl: "{% url 'notifications:user_notifications_count' request.user.pk %}"
}; };
</script> </script>
<script src="{% static 'js/refresh_notifications.js' %}"></script> <script src="{% static 'allianceauth/js/refresh_notifications.js' %}"></script>
<script src="{% static 'js/eve-time.js' %}"></script> <script src="{% static 'allianceauth/js/eve-time.js' %}"></script>
{% block extra_javascript %} {% block extra_javascript %}
{% endblock extra_javascript %} {% endblock extra_javascript %}

View File

@@ -1,5 +1,5 @@
{% load static %} {% load static %}
<link rel="icon" type="image/png" href="{% static 'icons/favicon-16x16.png' %}" sizes="16x16"> <link rel="icon" type="image/png" href="{% static 'allianceauth/icons/favicon-16x16.png' %}" sizes="16x16">
<link rel="icon" type="image/png" href="{% static 'icons/favicon-32x32.png' %}" sizes="32x32"> <link rel="icon" type="image/png" href="{% static 'allianceauth/icons/favicon-32x32.png' %}" sizes="32x32">
<link rel="icon" type="image/png" href="{% static 'icons/favicon-96x96.png' %}" sizes="96x96"> <link rel="icon" type="image/png" href="{% static 'allianceauth/icons/favicon-96x96.png' %}" sizes="96x96">
<link rel="apple-touch-icon" href="{% static 'icons/apple-touch-icon.png' %}"> <link rel="apple-touch-icon" href="{% static 'allianceauth/icons/apple-touch-icon.png' %}">

View File

@@ -12,7 +12,7 @@
</button> </button>
<a class="navbar-brand"> <a class="navbar-brand">
<img src="{% static 'icons/favicon-32x32.png' %}" style="display: inline-block;" height="32" width="32"/> <img src="{% static 'allianceauth/icons/favicon-32x32.png' %}" style="display: inline-block;" height="32" width="32"/>
{{ SITE_NAME }} {{ SITE_NAME }}
</a> </a>
</div> </div>

View File

@@ -3,17 +3,17 @@
{% if NIGHT_MODE %} {% if NIGHT_MODE %}
{% if debug %} {% if debug %}
<!-- In template debug, loading less file instead of CSS --> <!-- In template debug, loading less file instead of CSS -->
<link rel="stylesheet/less" type="text/css" href="{% static 'css/themes/darkly/darkly.less' %}"> <link rel="stylesheet/less" type="text/css" href="{% static 'allianceauth/css/themes/darkly/darkly.less' %}">
<script src="https://cdnjs.cloudflare.com/ajax/libs/less.js/4.1.2/less.min.js" integrity="sha512-eXBn7AaMbUOWb3PSDhwcjByoM89FeO1SF9Jww6kqPYQkBrGZvqAKFbtqLHh5O95rYA/AOtWZ0QRO2S6rP+KsUw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> {% else %} <script src="https://cdnjs.cloudflare.com/ajax/libs/less.js/4.1.2/less.min.js" integrity="sha512-eXBn7AaMbUOWb3PSDhwcjByoM89FeO1SF9Jww6kqPYQkBrGZvqAKFbtqLHh5O95rYA/AOtWZ0QRO2S6rP+KsUw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> {% else %}
<link rel="stylesheet" type="text/css" href="{% static 'css/themes/darkly/darkly.min.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'allianceauth/css/themes/darkly/darkly.min.css' %}">
{% endif %} {% endif %}
{% else %} {% else %}
{% if debug %} {% if debug %}
<!-- In template debug, loading less file instead of CSS --> <!-- In template debug, loading less file instead of CSS -->
<link rel="stylesheet/less" type="text/css" href="{% static 'css/themes/flatly/flatly.less' %}"> <link rel="stylesheet/less" type="text/css" href="{% static 'allianceauth/css/themes/flatly/flatly.less' %}">
<script src="https://cdnjs.cloudflare.com/ajax/libs/less.js/4.1.2/less.min.js" integrity="sha512-eXBn7AaMbUOWb3PSDhwcjByoM89FeO1SF9Jww6kqPYQkBrGZvqAKFbtqLHh5O95rYA/AOtWZ0QRO2S6rP+KsUw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/less.js/4.1.2/less.min.js" integrity="sha512-eXBn7AaMbUOWb3PSDhwcjByoM89FeO1SF9Jww6kqPYQkBrGZvqAKFbtqLHh5O95rYA/AOtWZ0QRO2S6rP+KsUw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
{% else %} {% else %}
<link rel="stylesheet" type="text/css" href="{% static 'css/themes/flatly/flatly.min.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'allianceauth/css/themes/flatly/flatly.min.css' %}">
{% endif %} {% endif %}
{% endif %} {% endif %}
<!-- End Bootstrap CSS --> <!-- End Bootstrap CSS -->

View File

@@ -1,5 +1,5 @@
{% load static %} {% load static %}
<!-- Start jQuery UI CSS from Alliance Auth --> <!-- Start jQuery UI CSS from Alliance Auth -->
<!-- CDNs all contain theme.css, which is not supposed to be in the base CSS, Which is why this is uniquely bundled in not using a CDN --> <!-- CDNs all contain theme.css, which is not supposed to be in the base CSS, Which is why this is uniquely bundled in not using a CDN -->
<link rel="stylesheet" href="{% static 'js/jquery-ui/1.12.1/css/jquery-ui.min.css' %}" integrity="sha512-7smZe1765O+Mm1UZH46SzaFClbRX7dEs01lB9lqU91oocmugWWfQXVQNVr5tEwktYSqwJMErEfr4GvflXMgTPA==" crossorigin="anonymous" referrerpolicy="no-referrer"> <link rel="stylesheet" href="{% static 'allianceauth/js/jquery-ui/1.12.1/css/jquery-ui.min.css' %}" integrity="sha512-7smZe1765O+Mm1UZH46SzaFClbRX7dEs01lB9lqU91oocmugWWfQXVQNVr5tEwktYSqwJMErEfr4GvflXMgTPA==" crossorigin="anonymous" referrerpolicy="no-referrer">
<!-- End jQuery UI CSS from aa-gdpr --> <!-- End jQuery UI CSS from aa-gdpr -->

View File

@@ -1,4 +1,3 @@
{% load static %}
<!-- Start jQuery visibility js --> <!-- Start jQuery visibility js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-visibility/1.0.11/jquery-visibility.min.js" integrity="sha512-kL8M4N4KLFJ4ydyfbBiXU1InCR6zs8jm8NR1BXykgFmMhVO3RS9bvoMHnVwoPe+i6NRvfydNlweatKee85Df3A==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-visibility/1.0.11/jquery-visibility.min.js" integrity="sha512-kL8M4N4KLFJ4ydyfbBiXU1InCR6zs8jm8NR1BXykgFmMhVO3RS9bvoMHnVwoPe+i6NRvfydNlweatKee85Df3A==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- End jQuery visibility js --> <!-- End jQuery visibility js -->

View File

@@ -1,6 +1,5 @@
{% extends "allianceauth/base.html" %} {% extends "allianceauth/base.html" %}
{% load bootstrap %} {% load bootstrap %}
{% load static %}
{% load i18n %} {% load i18n %}
{% block page_title %} {% block page_title %}

View File

@@ -539,7 +539,7 @@
</div> </div>
{% include 'bundles/moment-js.html' with locale=True %} {% include 'bundles/moment-js.html' with locale=True %}
<script src="{% static 'js/timers.js' %}"></script> <script src="{% static 'allianceauth/js/timers.js' %}"></script>
<script type="application/javascript"> <script type="application/javascript">
let timers = [ let timers = [
{% for timer in timers %} {% for timer in timers %}

View File

View File

@@ -0,0 +1,21 @@
from redis import Redis
from django.core.cache import caches
try:
import django_redis
except ImportError:
django_redis = None
def get_redis_client() -> Redis:
"""Get the configured redis client used by Django for caching.
This function is a wrapper designed to work for both AA2 and AA3
and should always be used to ensure backwards compatibility.
"""
try:
return django_redis.get_redis_connection("default")
except AttributeError:
default_cache = caches["default"]
return default_cache.get_master_client()

View File

View File

@@ -0,0 +1,39 @@
from unittest.mock import MagicMock, patch
from django.test import TestCase
from allianceauth.utils.cache import get_redis_client
MODULE_PATH = "allianceauth.utils.cache"
class RedisClientStub:
"""Substitute for a Redis client."""
pass
class TestGetRedisClient(TestCase):
def test_should_work_with_aa2_api(self):
# given
mock_django_cache = MagicMock()
mock_django_cache.get_master_client.return_value = RedisClientStub()
# when
with patch(MODULE_PATH + ".django_redis", None), patch.dict(
MODULE_PATH + ".caches", {"default": mock_django_cache}
):
client = get_redis_client()
# then
self.assertIsInstance(client, RedisClientStub)
def test_should_work_with_aa3_api(self):
# given
mock_django_redis = MagicMock()
mock_django_redis.get_redis_connection.return_value = RedisClientStub()
# when
with patch(MODULE_PATH + ".django_redis", mock_django_redis), patch.dict(
MODULE_PATH + ".caches", {"default": None}
):
client = get_redis_client()
# then
self.assertIsInstance(client, RedisClientStub)

View File

@@ -1,7 +1,7 @@
PROTOCOL=https:// PROTOCOL=https://
AUTH_SUBDOMAIN=%AUTH_SUBDOMAIN% AUTH_SUBDOMAIN=%AUTH_SUBDOMAIN%
DOMAIN=%DOMAIN% DOMAIN=%DOMAIN%
AA_DOCKER_TAG=registry.gitlab.com/allianceauth/allianceauth/auth:v3.0.0b1 AA_DOCKER_TAG=registry.gitlab.com/allianceauth/allianceauth/auth:v3.0.0b2
# Nginx Proxy Manager # Nginx Proxy Manager
PROXY_HTTP_PORT=80 PROXY_HTTP_PORT=80

Some files were not shown because too many files have changed in this diff Show More