mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-04 14:16:21 +01:00
Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80efdec5d9 | ||
|
|
d49687400a | ||
|
|
e6e03b50da | ||
|
|
899988c7c2 | ||
|
|
2f48dd449b | ||
|
|
2b09ca240d | ||
|
|
0626ff84ad | ||
|
|
62ec746ee3 | ||
|
|
d0f12d7d56 | ||
|
|
b806a69604 | ||
|
|
a609d6360b | ||
|
|
dafbfc8644 | ||
|
|
55413eea19 | ||
|
|
5247c181af | ||
|
|
321af5ec87 | ||
|
|
9ccf340b3d | ||
|
|
d7dcacb899 | ||
|
|
8addd483c2 | ||
|
|
4d27e5ac9b | ||
|
|
31290f6e80 | ||
|
|
c31cc4dbee | ||
|
|
cc1f94cf61 | ||
|
|
a9132b8d50 | ||
|
|
7b4a9891aa | ||
|
|
dcaaf38ecc | ||
|
|
653a8aa850 | ||
|
|
274af11385 | ||
|
|
170b246901 | ||
|
|
9ea79ea389 | ||
|
|
b6fdf840ef | ||
|
|
42948386ec |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -72,3 +72,6 @@ celerybeat-schedule
|
||||
|
||||
#transifex
|
||||
.tx/
|
||||
|
||||
#other
|
||||
.flake8
|
||||
|
||||
@@ -6,11 +6,6 @@ before_script:
|
||||
- python -V
|
||||
- pip install wheel tox
|
||||
|
||||
test-3.5-core:
|
||||
image: python:3.5-buster
|
||||
script:
|
||||
- tox -e py35-core
|
||||
|
||||
test-3.6-core:
|
||||
image: python:3.6-buster
|
||||
script:
|
||||
@@ -26,11 +21,6 @@ test-3.8-core:
|
||||
script:
|
||||
- tox -e py38-core
|
||||
|
||||
test-3.5-all:
|
||||
image: python:3.5-buster
|
||||
script:
|
||||
- tox -e py35-all
|
||||
|
||||
test-3.6-all:
|
||||
image: python:3.6-buster
|
||||
script:
|
||||
|
||||
27
.readthedocs.yml
Normal file
27
.readthedocs.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
# .readthedocs.yml
|
||||
# Read the Docs configuration file
|
||||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||
|
||||
# Required
|
||||
version: 2
|
||||
|
||||
# Build documentation in the docs/ directory with Sphinx
|
||||
sphinx:
|
||||
configuration: docs/conf.py
|
||||
|
||||
# Build documentation with MkDocs
|
||||
#mkdocs:
|
||||
# configuration: mkdocs.yml
|
||||
|
||||
# Optionally build your docs in additional formats such as PDF and ePub
|
||||
formats: all
|
||||
|
||||
# Optionally set the version of Python and requirements required to build your docs
|
||||
python:
|
||||
version: 3.7
|
||||
install:
|
||||
- method: pip
|
||||
path: .
|
||||
extra_requirements:
|
||||
- testing
|
||||
system_packages: true
|
||||
@@ -1,6 +1,6 @@
|
||||
# This will make sure the app is always imported when
|
||||
# Django starts so that shared_task will use this app.
|
||||
|
||||
__version__ = '2.6.3'
|
||||
__version__ = '2.6.5'
|
||||
NAME = 'Alliance Auth v%s' % __version__
|
||||
default_app_config = 'allianceauth.apps.AllianceAuthConfig'
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<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:description" content="Alliance Auth - An auth system for EVE Online to help in-game organizations manage online service access.">
|
||||
|
||||
{% include 'allianceauth/icons.html' %}
|
||||
|
||||
<title>{% block title %}{{ SITE_NAME }}{% endblock %}</title>
|
||||
|
||||
@@ -22,13 +22,6 @@ urlpatterns = [
|
||||
r'^account/characters/add/$',
|
||||
views.add_character,
|
||||
name='add_character'
|
||||
),
|
||||
url(
|
||||
r'^help/$',
|
||||
login_required(
|
||||
TemplateView.as_view(template_name='allianceauth/help.html')
|
||||
),
|
||||
name='help'
|
||||
),
|
||||
),
|
||||
url(r'^dashboard/$', views.dashboard, name='dashboard'),
|
||||
]
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -53,6 +53,10 @@
|
||||
<a href="{% url "groupmanagement:audit_log" group.id %}" class="btn btn-info" title="{% trans "Audit Members" %}">
|
||||
<i class="glyphicon glyphicon-list-alt"></i>
|
||||
</a>
|
||||
<a id="clipboard-copy" data-clipboard-text="{{ request.scheme }}://{{request.get_host}}{% url 'groupmanagement:request_add' group.id %}" class="btn btn-warning" title="{% trans "Copy Direct Join Link" %}">
|
||||
<i class="glyphicon glyphicon-copy"></i>
|
||||
</a>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -68,3 +72,9 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
{% block extra_javascript %}
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js"></script>
|
||||
<script>
|
||||
new ClipboardJS('#clipboard-copy');
|
||||
</script>
|
||||
{% endblock %}
|
||||
Binary file not shown.
@@ -13,7 +13,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-04-02 03:23+0000\n"
|
||||
"POT-Creation-Date: 2020-05-08 00:57+0000\n"
|
||||
"PO-Revision-Date: 2020-02-18 03:14+0000\n"
|
||||
"Last-Translator: Rounon Dax <rounon.dax@terra-nanotech.de>, 2020\n"
|
||||
"Language-Team: German (https://www.transifex.com/alliance-auth/teams/107430/de/)\n"
|
||||
@@ -657,7 +657,11 @@ msgstr "Mitglieder ansehen"
|
||||
msgid "Audit Members"
|
||||
msgstr "Mitglieder Protokoll"
|
||||
|
||||
#: allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html:64
|
||||
#: allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html:56
|
||||
msgid "Copy Direrct Join Link"
|
||||
msgstr ""
|
||||
|
||||
#: allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html:68
|
||||
msgid "No groups to list."
|
||||
msgstr "Keine Gruppen vorhanden."
|
||||
|
||||
@@ -1177,7 +1181,7 @@ msgstr "Änderungen für Operation timer %(opname)s gespeichert."
|
||||
#: allianceauth/permissions_tool/templates/permissions_tool/audit.html:6
|
||||
#: allianceauth/permissions_tool/templates/permissions_tool/audit.html:10
|
||||
msgid "Permissions Audit"
|
||||
msgstr "Berechtigungsprüfung"
|
||||
msgstr "Berechtigungsübersicht"
|
||||
|
||||
#: allianceauth/permissions_tool/templates/permissions_tool/audit.html:22
|
||||
msgid "User / Character"
|
||||
@@ -1912,12 +1916,6 @@ msgid_plural "%(tasks)s tasks"
|
||||
msgstr[0] "%(tasks)sAufgabe"
|
||||
msgstr[1] "%(tasks)sAufgaben"
|
||||
|
||||
#: allianceauth/templates/allianceauth/help.html:4
|
||||
#: allianceauth/templates/allianceauth/help.html:9
|
||||
#: allianceauth/templates/allianceauth/side-menu.html:34
|
||||
msgid "Help"
|
||||
msgstr "Hilfe"
|
||||
|
||||
#: allianceauth/templates/allianceauth/night-toggle.html:3
|
||||
msgid "Night"
|
||||
msgstr "Nacht"
|
||||
|
||||
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-04-02 03:23+0000\n"
|
||||
"POT-Creation-Date: 2020-05-08 00:57+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -642,7 +642,11 @@ msgstr ""
|
||||
msgid "Audit Members"
|
||||
msgstr ""
|
||||
|
||||
#: allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html:64
|
||||
#: allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html:56
|
||||
msgid "Copy Direrct Join Link"
|
||||
msgstr ""
|
||||
|
||||
#: allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html:68
|
||||
msgid "No groups to list."
|
||||
msgstr ""
|
||||
|
||||
@@ -1876,12 +1880,6 @@ msgid_plural "%(tasks)s tasks"
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: allianceauth/templates/allianceauth/help.html:4
|
||||
#: allianceauth/templates/allianceauth/help.html:9
|
||||
#: allianceauth/templates/allianceauth/side-menu.html:34
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#: allianceauth/templates/allianceauth/night-toggle.html:3
|
||||
msgid "Night"
|
||||
msgstr ""
|
||||
|
||||
Binary file not shown.
@@ -12,7 +12,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-03-26 03:07+0000\n"
|
||||
"POT-Creation-Date: 2020-05-08 00:57+0000\n"
|
||||
"PO-Revision-Date: 2020-02-18 03:14+0000\n"
|
||||
"Last-Translator: frank1210 <francolopez_16@hotmail.com>, 2020\n"
|
||||
"Language-Team: Spanish (https://www.transifex.com/alliance-auth/teams/107430/es/)\n"
|
||||
@@ -653,7 +653,11 @@ msgstr "Ver Miembros"
|
||||
msgid "Audit Members"
|
||||
msgstr "Auditar Miembros"
|
||||
|
||||
#: allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html:64
|
||||
#: allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html:56
|
||||
msgid "Copy Direrct Join Link"
|
||||
msgstr ""
|
||||
|
||||
#: allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html:68
|
||||
msgid "No groups to list."
|
||||
msgstr "No hay grupos para listar"
|
||||
|
||||
@@ -785,21 +789,21 @@ msgid "Rejected application from %(mainchar)s to leave %(group)s."
|
||||
msgstr ""
|
||||
"Se rechazo la solicitud de %(mainchar)s para dejar el grupo %(group)s."
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:347
|
||||
#: allianceauth/groupmanagement/views.py:359
|
||||
#: allianceauth/groupmanagement/views.py:346
|
||||
#: allianceauth/groupmanagement/views.py:358
|
||||
msgid "You cannot join that group"
|
||||
msgstr "No puedes unirte a ese grupo"
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:353
|
||||
#: allianceauth/groupmanagement/views.py:352
|
||||
msgid "You are already a member of that group."
|
||||
msgstr ""
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:368
|
||||
#: allianceauth/groupmanagement/views.py:367
|
||||
msgid "You already have a pending application for that group."
|
||||
msgstr ""
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:371
|
||||
#: allianceauth/groupmanagement/views.py:409
|
||||
#: allianceauth/groupmanagement/views.py:370
|
||||
#: allianceauth/groupmanagement/views.py:408
|
||||
#: allianceauth/hrapplications/templates/hrapplications/management.html:37
|
||||
#: allianceauth/hrapplications/templates/hrapplications/management.html:72
|
||||
#: allianceauth/hrapplications/templates/hrapplications/management.html:99
|
||||
@@ -811,24 +815,24 @@ msgstr ""
|
||||
msgid "Pending"
|
||||
msgstr "Pendiente"
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:377
|
||||
#: allianceauth/groupmanagement/views.py:376
|
||||
#, python-format
|
||||
msgid "Applied to group %(group)s."
|
||||
msgstr "Solicitud enviada al grupo %(group)s."
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:388
|
||||
#: allianceauth/groupmanagement/views.py:387
|
||||
msgid "You cannot leave that group"
|
||||
msgstr "No puedes dejar el grupos"
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:393
|
||||
#: allianceauth/groupmanagement/views.py:392
|
||||
msgid "You are not a member of that group"
|
||||
msgstr "No eres miembro de ese grupo"
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:402
|
||||
#: allianceauth/groupmanagement/views.py:401
|
||||
msgid "You already have a pending leave request for that group."
|
||||
msgstr ""
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:415
|
||||
#: allianceauth/groupmanagement/views.py:414
|
||||
#, python-format
|
||||
msgid "Applied to leave group %(group)s."
|
||||
msgstr "Solicitaste dejar el grupo %(group)s."
|
||||
@@ -1894,12 +1898,6 @@ msgid_plural "%(tasks)s tasks"
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: allianceauth/templates/allianceauth/help.html:4
|
||||
#: allianceauth/templates/allianceauth/help.html:9
|
||||
#: allianceauth/templates/allianceauth/side-menu.html:34
|
||||
msgid "Help"
|
||||
msgstr "Ayuda"
|
||||
|
||||
#: allianceauth/templates/allianceauth/night-toggle.html:3
|
||||
msgid "Night"
|
||||
msgstr "Noche"
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -11,7 +11,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-03-26 03:07+0000\n"
|
||||
"POT-Creation-Date: 2020-05-08 00:57+0000\n"
|
||||
"PO-Revision-Date: 2020-02-18 03:14+0000\n"
|
||||
"Last-Translator: Alexander Gess <de.alex.gess@gmail.com>, 2020\n"
|
||||
"Language-Team: Russian (https://www.transifex.com/alliance-auth/teams/107430/ru/)\n"
|
||||
@@ -651,7 +651,11 @@ msgstr "Посмотреть участников"
|
||||
msgid "Audit Members"
|
||||
msgstr "Проверить участников"
|
||||
|
||||
#: allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html:64
|
||||
#: allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html:56
|
||||
msgid "Copy Direrct Join Link"
|
||||
msgstr ""
|
||||
|
||||
#: allianceauth/groupmanagement/templates/groupmanagement/groupmembership.html:68
|
||||
msgid "No groups to list."
|
||||
msgstr "Нет групп в списке"
|
||||
|
||||
@@ -782,21 +786,21 @@ msgstr ""
|
||||
msgid "Rejected application from %(mainchar)s to leave %(group)s."
|
||||
msgstr "Прошение об исключении %(mainchar)s из %(group)s – отклонено. "
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:347
|
||||
#: allianceauth/groupmanagement/views.py:359
|
||||
#: allianceauth/groupmanagement/views.py:346
|
||||
#: allianceauth/groupmanagement/views.py:358
|
||||
msgid "You cannot join that group"
|
||||
msgstr "Вы не можете вступить"
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:353
|
||||
#: allianceauth/groupmanagement/views.py:352
|
||||
msgid "You are already a member of that group."
|
||||
msgstr ""
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:368
|
||||
#: allianceauth/groupmanagement/views.py:367
|
||||
msgid "You already have a pending application for that group."
|
||||
msgstr ""
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:371
|
||||
#: allianceauth/groupmanagement/views.py:409
|
||||
#: allianceauth/groupmanagement/views.py:370
|
||||
#: allianceauth/groupmanagement/views.py:408
|
||||
#: allianceauth/hrapplications/templates/hrapplications/management.html:37
|
||||
#: allianceauth/hrapplications/templates/hrapplications/management.html:72
|
||||
#: allianceauth/hrapplications/templates/hrapplications/management.html:99
|
||||
@@ -808,24 +812,24 @@ msgstr ""
|
||||
msgid "Pending"
|
||||
msgstr "Ожидание"
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:377
|
||||
#: allianceauth/groupmanagement/views.py:376
|
||||
#, python-format
|
||||
msgid "Applied to group %(group)s."
|
||||
msgstr "Вступить в группу %(group)s."
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:388
|
||||
#: allianceauth/groupmanagement/views.py:387
|
||||
msgid "You cannot leave that group"
|
||||
msgstr "Вы не можете покинуть эту группу"
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:393
|
||||
#: allianceauth/groupmanagement/views.py:392
|
||||
msgid "You are not a member of that group"
|
||||
msgstr "Вы не участник группыы"
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:402
|
||||
#: allianceauth/groupmanagement/views.py:401
|
||||
msgid "You already have a pending leave request for that group."
|
||||
msgstr ""
|
||||
|
||||
#: allianceauth/groupmanagement/views.py:415
|
||||
#: allianceauth/groupmanagement/views.py:414
|
||||
#, python-format
|
||||
msgid "Applied to leave group %(group)s."
|
||||
msgstr "Запрос на выход из группы %(group)s."
|
||||
@@ -1896,12 +1900,6 @@ msgstr[1] "%(tasks)s задач"
|
||||
msgstr[2] "%(tasks)s задач"
|
||||
msgstr[3] "%(tasks)s задач"
|
||||
|
||||
#: allianceauth/templates/allianceauth/help.html:4
|
||||
#: allianceauth/templates/allianceauth/help.html:9
|
||||
#: allianceauth/templates/allianceauth/side-menu.html:34
|
||||
msgid "Help"
|
||||
msgstr "Помощь"
|
||||
|
||||
#: allianceauth/templates/allianceauth/night-toggle.html:3
|
||||
msgid "Night"
|
||||
msgstr "Ночь"
|
||||
|
||||
@@ -4,3 +4,8 @@ from allianceauth import urls
|
||||
urlpatterns = [
|
||||
url(r'', include(urls)),
|
||||
]
|
||||
|
||||
handler500 = 'allianceauth.views.Generic500Redirect'
|
||||
handler404 = 'allianceauth.views.Generic404Redirect'
|
||||
handler403 = 'allianceauth.views.Generic403Redirect'
|
||||
handler400 = 'allianceauth.views.Generic400Redirect'
|
||||
|
||||
@@ -36,7 +36,7 @@ class DiscordService(ServicesHook):
|
||||
|
||||
def sync_nickname(self, user):
|
||||
logger.debug('Syncing %s nickname for user %s' % (self.name, user))
|
||||
DiscordTasks.update_nickname.delay(user.pk)
|
||||
DiscordTasks.update_nickname.apply_async(args=[user.pk], countdown=5)
|
||||
|
||||
def update_all_groups(self):
|
||||
logger.debug('Update all %s groups called' % self.name)
|
||||
|
||||
@@ -27,7 +27,12 @@ class DiscordViewsTestCase(WebTest):
|
||||
self.login()
|
||||
manager.generate_oauth_redirect_url.return_value = '/example.com/oauth/'
|
||||
response = self.app.get('/discord/activate/', auto_follow=False)
|
||||
self.assertRedirects(response, expected_url='/example.com/oauth/', target_status_code=404)
|
||||
self.assertRedirects(
|
||||
response,
|
||||
expected_url="/example.com/oauth/",
|
||||
target_status_code=404,
|
||||
fetch_redirect_response=False,
|
||||
)
|
||||
|
||||
@mock.patch(MODULE_PATH + '.tasks.DiscordOAuthManager')
|
||||
def test_callback(self, manager):
|
||||
|
||||
@@ -40,6 +40,11 @@ class MumbleService(ServicesHook):
|
||||
if MumbleTasks.has_account(user):
|
||||
MumbleTasks.update_groups.delay(user.pk)
|
||||
|
||||
def sync_nickname(self, user):
|
||||
logger.debug("Updating %s nickname for %s" % (self.name, user))
|
||||
if MumbleTasks.has_account(user):
|
||||
MumbleTasks.update_display_name.apply_async(args=[user.pk], countdown=5) # cooldown on this task to ensure DB clean when syncing
|
||||
|
||||
def validate_user(self, user):
|
||||
if MumbleTasks.has_account(user) and not self.service_active_for_user(user):
|
||||
self.delete_user(user, notify_user=True)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# Generated by Django 2.2.9 on 2020-03-16 07:49
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mumble', '0007_not_null_user'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='mumbleuser',
|
||||
name='display_name',
|
||||
field=models.CharField(max_length=254, null=True),
|
||||
)
|
||||
]
|
||||
@@ -0,0 +1,37 @@
|
||||
from django.db import migrations, models
|
||||
from ..auth_hooks import MumbleService
|
||||
from allianceauth.services.hooks import NameFormatter
|
||||
|
||||
def fwd_func(apps, schema_editor):
|
||||
MumbleUser = apps.get_model("mumble", "MumbleUser")
|
||||
db_alias = schema_editor.connection.alias
|
||||
all_users = MumbleUser.objects.using(db_alias).all()
|
||||
for user in all_users:
|
||||
display_name = NameFormatter(MumbleService(), user.user).format_name()
|
||||
user.display_name = display_name
|
||||
user.save()
|
||||
|
||||
def rev_func(apps, schema_editor):
|
||||
MumbleUser = apps.get_model("mumble", "MumbleUser")
|
||||
db_alias = schema_editor.connection.alias
|
||||
all_users = MumbleUser.objects.using(db_alias).all()
|
||||
for user in all_users:
|
||||
user.display_name = None
|
||||
user.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mumble', '0008_mumbleuser_display_name'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(fwd_func, rev_func),
|
||||
migrations.AlterField(
|
||||
model_name='mumbleuser',
|
||||
name='display_name',
|
||||
field=models.CharField(max_length=254, unique=True),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
||||
@@ -15,10 +15,14 @@ class MumbleManager(models.Manager):
|
||||
HASH_FN = 'bcrypt-sha256'
|
||||
|
||||
@staticmethod
|
||||
def get_username(user):
|
||||
def get_display_name(user):
|
||||
from .auth_hooks import MumbleService
|
||||
return NameFormatter(MumbleService(), user).format_name()
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_username(user):
|
||||
return user.profile.main_character.character_name # main character as the user.username may be incorect
|
||||
|
||||
@staticmethod
|
||||
def sanitise_username(username):
|
||||
return username.replace(" ", "_")
|
||||
@@ -32,20 +36,26 @@ class MumbleManager(models.Manager):
|
||||
return bcrypt_sha256.encrypt(password.encode('utf-8'))
|
||||
|
||||
def create(self, user):
|
||||
username = self.get_username(user)
|
||||
logger.debug("Creating mumble user with username {}".format(username))
|
||||
username_clean = self.sanitise_username(username)
|
||||
password = self.generate_random_pass()
|
||||
pwhash = self.gen_pwhash(password)
|
||||
logger.debug("Proceeding with mumble user creation: clean username {}, pwhash starts with {}".format(
|
||||
username_clean, pwhash[0:5]))
|
||||
logger.info("Creating mumble user {}".format(username_clean))
|
||||
try:
|
||||
username = self.get_username(user)
|
||||
logger.debug("Creating mumble user with username {}".format(username))
|
||||
username_clean = self.sanitise_username(username)
|
||||
display_name = self.get_display_name(user)
|
||||
password = self.generate_random_pass()
|
||||
pwhash = self.gen_pwhash(password)
|
||||
logger.debug("Proceeding with mumble user creation: clean username {}, pwhash starts with {}".format(
|
||||
username_clean, pwhash[0:5]))
|
||||
logger.info("Creating mumble user {}".format(username_clean))
|
||||
|
||||
result = super(MumbleManager, self).create(user=user, username=username_clean,
|
||||
pwhash=pwhash, hashfn=self.HASH_FN)
|
||||
result.update_groups()
|
||||
result.credentials.update({'username': result.username, 'password': password})
|
||||
return result
|
||||
result = super(MumbleManager, self).create(user=user, username=username_clean,
|
||||
pwhash=pwhash, hashfn=self.HASH_FN,
|
||||
display_name=display_name)
|
||||
result.update_groups()
|
||||
result.credentials.update({'username': result.username, 'password': password})
|
||||
return result
|
||||
except AttributeError: # No Main or similar errors
|
||||
return False
|
||||
return False
|
||||
|
||||
def user_exists(self, username):
|
||||
return self.filter(username=username).exists()
|
||||
@@ -59,6 +69,8 @@ class MumbleUser(AbstractServiceModel):
|
||||
|
||||
objects = MumbleManager()
|
||||
|
||||
display_name = models.CharField(max_length=254, unique=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.username
|
||||
|
||||
@@ -91,6 +103,12 @@ class MumbleUser(AbstractServiceModel):
|
||||
self.save()
|
||||
return True
|
||||
|
||||
def update_display_name(self):
|
||||
logger.info("Updating mumble user {} display name".format(self.user))
|
||||
self.display_name = MumbleManager.get_display_name(self.user)
|
||||
self.save()
|
||||
return True
|
||||
|
||||
class Meta:
|
||||
permissions = (
|
||||
("access_mumble", u"Can access the Mumble service"),
|
||||
|
||||
@@ -45,9 +45,37 @@ class MumbleTasks:
|
||||
logger.debug("User %s does not have a mumble account, skipping" % user)
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
@shared_task(bind=True, name="mumble.update_display_name", base=QueueOnce)
|
||||
def update_display_name(self, pk):
|
||||
user = User.objects.get(pk=pk)
|
||||
logger.debug("Updating mumble groups for user %s" % user)
|
||||
if MumbleTasks.has_account(user):
|
||||
try:
|
||||
if not user.mumble.update_display_name():
|
||||
raise Exception("Display Name Sync failed")
|
||||
logger.debug("Updated user %s mumble display name." % user)
|
||||
return True
|
||||
except MumbleUser.DoesNotExist:
|
||||
logger.info("Mumble display name sync failed for {}, user does not have a mumble account".format(user))
|
||||
except:
|
||||
logger.exception("Mumble display name sync failed for %s, retrying in 10 mins" % user)
|
||||
raise self.retry(countdown=60 * 10)
|
||||
else:
|
||||
logger.debug("User %s does not have a mumble account, skipping" % user)
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
@shared_task(name="mumble.update_all_groups")
|
||||
def update_all_groups():
|
||||
logger.debug("Updating ALL mumble groups")
|
||||
for mumble_user in MumbleUser.objects.exclude(username__exact=''):
|
||||
MumbleTasks.update_groups.delay(mumble_user.user.pk)
|
||||
|
||||
@staticmethod
|
||||
@shared_task(name="mumble.update_all_display_names")
|
||||
def update_all_display_names():
|
||||
logger.debug("Updating ALL mumble display names")
|
||||
for mumble_user in MumbleUser.objects.exclude(username__exact=''):
|
||||
MumbleTasks.update_display_name.delay(mumble_user.user.pk)
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ class MumbleHooksTestCase(TestCase):
|
||||
def setUp(self):
|
||||
self.member = 'member_user'
|
||||
member = AuthUtils.create_member(self.member)
|
||||
AuthUtils.add_main_character(member, 'auth_member', '12345', corp_id='111', corp_name='Test Corporation',
|
||||
corp_ticker='TESTR')
|
||||
member = User.objects.get(pk=member.pk)
|
||||
MumbleUser.objects.create(user=member)
|
||||
self.none_user = 'none_user'
|
||||
none_user = AuthUtils.create_user(self.none_user)
|
||||
@@ -122,23 +125,45 @@ class MumbleViewsTestCase(TestCase):
|
||||
self.member.save()
|
||||
AuthUtils.add_main_character(self.member, 'auth_member', '12345', corp_id='111', corp_name='Test Corporation',
|
||||
corp_ticker='TESTR')
|
||||
self.member = User.objects.get(pk=self.member.pk)
|
||||
add_permissions()
|
||||
|
||||
def login(self):
|
||||
self.client.force_login(self.member)
|
||||
|
||||
def test_activate(self):
|
||||
def test_activate_update(self):
|
||||
self.login()
|
||||
expected_username = '[TESTR]auth_member'
|
||||
expected_username = 'auth_member'
|
||||
expected_displayname = '[TESTR]auth_member'
|
||||
response = self.client.get(urls.reverse('mumble:activate'), follow=False)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, expected_username)
|
||||
# create
|
||||
mumble_user = MumbleUser.objects.get(user=self.member)
|
||||
self.assertEqual(mumble_user.username, expected_username)
|
||||
self.assertTrue(MumbleUser.objects.user_exists(expected_username))
|
||||
self.assertEqual(str(mumble_user), expected_username)
|
||||
self.assertEqual(mumble_user.display_name, expected_displayname)
|
||||
self.assertTrue(mumble_user.pwhash)
|
||||
self.assertIn('Guest', mumble_user.groups)
|
||||
self.assertIn('Member', mumble_user.groups)
|
||||
self.assertIn(',', mumble_user.groups)
|
||||
# test update
|
||||
self.member.profile.main_character.character_name = "auth_member_updated"
|
||||
self.member.profile.main_character.corporation_ticker = "TESTU"
|
||||
self.member.profile.main_character.save()
|
||||
mumble_user.update_display_name()
|
||||
mumble_user = MumbleUser.objects.get(user=self.member)
|
||||
expected_displayname = '[TESTU]auth_member_updated'
|
||||
self.assertEqual(mumble_user.username, expected_username)
|
||||
self.assertTrue(MumbleUser.objects.user_exists(expected_username))
|
||||
self.assertEqual(str(mumble_user), expected_username)
|
||||
self.assertEqual(mumble_user.display_name, expected_displayname)
|
||||
self.assertTrue(mumble_user.pwhash)
|
||||
self.assertIn('Guest', mumble_user.groups)
|
||||
self.assertIn('Member', mumble_user.groups)
|
||||
self.assertIn(',', mumble_user.groups)
|
||||
|
||||
|
||||
def test_deactivate_post(self):
|
||||
self.login()
|
||||
@@ -171,7 +196,6 @@ class MumbleViewsTestCase(TestCase):
|
||||
self.assertTemplateUsed(response, 'services/service_credentials.html')
|
||||
self.assertContains(response, 'auth_member')
|
||||
|
||||
|
||||
class MumbleManagerTestCase(TestCase):
|
||||
def setUp(self):
|
||||
from .models import MumbleManager
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import logging
|
||||
|
||||
from django.contrib.auth.models import User, Group, Permission
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.db import transaction
|
||||
from django.db.models.signals import m2m_changed
|
||||
from django.db.models.signals import pre_delete
|
||||
@@ -11,6 +12,7 @@ from .tasks import disable_user
|
||||
|
||||
from allianceauth.authentication.models import State, UserProfile
|
||||
from allianceauth.authentication.signals import state_changed
|
||||
from allianceauth.eveonline.models import EveCharacter
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -157,14 +159,45 @@ def disable_services_on_inactive(sender, instance, *args, **kwargs):
|
||||
|
||||
|
||||
@receiver(pre_save, sender=UserProfile)
|
||||
def disable_services_on_no_main(sender, instance, *args, **kwargs):
|
||||
if not instance.pk:
|
||||
def process_main_character_change(sender, instance, *args, **kwargs):
|
||||
|
||||
if not instance.pk: # ignore
|
||||
# new model being created
|
||||
return
|
||||
try:
|
||||
old_instance = UserProfile.objects.get(pk=instance.pk)
|
||||
if old_instance.main_character and not instance.main_character:
|
||||
if old_instance.main_character and not instance.main_character: # lost main char disable services
|
||||
logger.info("Disabling services due to loss of main character for user {0}".format(instance.user))
|
||||
disable_user(instance.user)
|
||||
elif old_instance.main_character is not instance.main_character: # swapping/changing main character
|
||||
logger.info("Updating Names due to change of main character for user {0}".format(instance.user))
|
||||
for svc in ServicesHook.get_services():
|
||||
try:
|
||||
svc.validate_user(instance.user)
|
||||
svc.sync_nickname(instance.user)
|
||||
except:
|
||||
logger.exception('Exception running sync_nickname for services module %s on user %s' % (svc, instance))
|
||||
|
||||
except UserProfile.DoesNotExist:
|
||||
pass
|
||||
|
||||
|
||||
@receiver(pre_save, sender=EveCharacter)
|
||||
def process_main_character_update(sender, instance, *args, **kwargs):
|
||||
try:
|
||||
if instance.userprofile:
|
||||
old_instance = EveCharacter.objects.get(pk=instance.pk)
|
||||
if not instance.character_name == old_instance.character_name or \
|
||||
not instance.corporation_name == old_instance.corporation_name or \
|
||||
not instance.alliance_name == old_instance.alliance_name:
|
||||
logger.info("syncing service nickname for user {0}".format(instance.userprofile.user))
|
||||
|
||||
for svc in ServicesHook.get_services():
|
||||
try:
|
||||
svc.validate_user(instance.userprofile.user)
|
||||
svc.sync_nickname(instance.userprofile.user)
|
||||
except:
|
||||
logger.exception('Exception running sync_nickname for services module %s on user %s' % (svc, instance))
|
||||
|
||||
except ObjectDoesNotExist: # not a main char ignore
|
||||
pass
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
from allianceauth import NAME
|
||||
from esi.clients import esi_client_factory
|
||||
import requests
|
||||
import logging
|
||||
import os
|
||||
|
||||
import requests
|
||||
|
||||
from allianceauth import NAME
|
||||
from allianceauth.eveonline.providers import provider
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
SWAGGER_SPEC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'swagger.json')
|
||||
"""
|
||||
Swagger Operations:
|
||||
get_killmails_killmail_id_killmail_hash
|
||||
"""
|
||||
|
||||
|
||||
class SRPManager:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_kill_id(killboard_link):
|
||||
num_set = '0123456789'
|
||||
@@ -34,18 +30,23 @@ class SRPManager:
|
||||
if result:
|
||||
killmail_id = result['killmail_id']
|
||||
killmail_hash = result['zkb']['hash']
|
||||
c = esi_client_factory(spec_file=SWAGGER_SPEC_PATH)
|
||||
km = c.Killmails.get_killmails_killmail_id_killmail_hash(killmail_id=killmail_id,
|
||||
killmail_hash=killmail_hash).result()
|
||||
c = provider.client
|
||||
km = c.Killmails.get_killmails_killmail_id_killmail_hash(
|
||||
killmail_id=killmail_id,
|
||||
killmail_hash=killmail_hash
|
||||
).result()
|
||||
else:
|
||||
raise ValueError("Invalid Kill ID")
|
||||
if km:
|
||||
ship_type = km['victim']['ship_type_id']
|
||||
logger.debug("Ship type for kill ID %s is %s" % (kill_id, ship_type))
|
||||
logger.debug(
|
||||
"Ship type for kill ID %s is %s" % (kill_id, ship_type)
|
||||
)
|
||||
ship_value = result['zkb']['totalValue']
|
||||
logger.debug("Total loss value for kill id %s is %s" % (kill_id, ship_value))
|
||||
logger.debug(
|
||||
"Total loss value for kill id %s is %s" % (kill_id, ship_value)
|
||||
)
|
||||
victim_id = km['victim']['character_id']
|
||||
return ship_type, ship_value, victim_id
|
||||
else:
|
||||
raise ValueError("Invalid Kill ID or Hash.")
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
# Create your tests here.
|
||||
0
allianceauth/srp/tests/__init__.py
Executable file
0
allianceauth/srp/tests/__init__.py
Executable file
72
allianceauth/srp/tests/test_managers.py
Executable file
72
allianceauth/srp/tests/test_managers.py
Executable file
@@ -0,0 +1,72 @@
|
||||
import inspect
|
||||
import json
|
||||
import os
|
||||
from unittest.mock import patch, Mock
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
from ..managers import SRPManager
|
||||
|
||||
MODULE_PATH = 'allianceauth.srp.managers'
|
||||
|
||||
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(
|
||||
inspect.currentframe()
|
||||
)))
|
||||
|
||||
def load_data(filename):
|
||||
"""loads given JSON file from `testdata` sub folder and returns content"""
|
||||
with open(
|
||||
currentdir + '/testdata/%s.json' % filename, 'r', encoding='utf-8'
|
||||
) as f:
|
||||
data = json.load(f)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
class TestSrpManager(TestCase):
|
||||
|
||||
def test_can_extract_kill_id(self):
|
||||
link = 'https://zkillboard.com/kill/81973979/'
|
||||
expected = 81973979
|
||||
self.assertEqual(int(SRPManager.get_kill_id(link)), expected)
|
||||
|
||||
@patch(MODULE_PATH + '.provider')
|
||||
@patch(MODULE_PATH + '.requests.get')
|
||||
def test_can_get_kill_data(self, mock_get, mock_provider):
|
||||
mock_get.return_value.json.return_value = load_data(
|
||||
'zkillboard_killmail_api_81973979'
|
||||
)
|
||||
mock_provider.client.Killmails.\
|
||||
get_killmails_killmail_id_killmail_hash.return_value.\
|
||||
result.return_value = load_data(
|
||||
'get_killmails_killmail_id_killmail_hash_81973979'
|
||||
)
|
||||
|
||||
ship_type, ship_value, victim_id = SRPManager.get_kill_data(81973979)
|
||||
self.assertEqual(ship_type, 19720)
|
||||
self.assertEqual(ship_value, 3177859026.86)
|
||||
self.assertEqual(victim_id, 93330670)
|
||||
|
||||
@patch(MODULE_PATH + '.requests.get')
|
||||
def test_invalid_id_for_zkb_raises_exception(self, mock_get):
|
||||
mock_get.return_value.json.return_value = ['']
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
ship_type, ship_value, victim_id = SRPManager.get_kill_data(81973979)
|
||||
|
||||
@patch(MODULE_PATH + '.provider')
|
||||
@patch(MODULE_PATH + '.requests.get')
|
||||
def test_invalid_id_for_esi_raises_exception(
|
||||
self, mock_get, mock_provider
|
||||
):
|
||||
mock_get.return_value.json.return_value = load_data(
|
||||
'zkillboard_killmail_api_81973979'
|
||||
)
|
||||
mock_provider.client.Killmails.\
|
||||
get_killmails_killmail_id_killmail_hash.return_value.\
|
||||
result.return_value = None
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
ship_type, ship_value, victim_id = SRPManager.get_kill_data(81973979)
|
||||
|
||||
|
||||
953
allianceauth/srp/tests/testdata/get_killmails_killmail_id_killmail_hash_81973979.json
vendored
Normal file
953
allianceauth/srp/tests/testdata/get_killmails_killmail_id_killmail_hash_81973979.json
vendored
Normal file
@@ -0,0 +1,953 @@
|
||||
{
|
||||
"attackers": [
|
||||
{
|
||||
"alliance_id": 99009221,
|
||||
"character_id": 92606407,
|
||||
"corporation_id": 98343297,
|
||||
"damage_done": 65236,
|
||||
"final_blow": false,
|
||||
"security_status": -6.4,
|
||||
"ship_type_id": 47271,
|
||||
"weapon_type_id": 47271
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 95104060,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 56425,
|
||||
"final_blow": true,
|
||||
"security_status": -1.1,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 2929
|
||||
},
|
||||
{
|
||||
"alliance_id": 1220922756,
|
||||
"character_id": 92793488,
|
||||
"corporation_id": 679468421,
|
||||
"damage_done": 55225,
|
||||
"final_blow": false,
|
||||
"security_status": -3.4,
|
||||
"ship_type_id": 47271,
|
||||
"weapon_type_id": 47271
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 90376343,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 51941,
|
||||
"final_blow": false,
|
||||
"security_status": 0.6,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 28215
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 676848606,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 45906,
|
||||
"final_blow": false,
|
||||
"security_status": -1.6,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 31894
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 96692394,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 44900,
|
||||
"final_blow": false,
|
||||
"security_status": -1.9,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 31894
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 96624133,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 44146,
|
||||
"final_blow": false,
|
||||
"security_status": -9.1,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 2929
|
||||
},
|
||||
{
|
||||
"character_id": 95050100,
|
||||
"corporation_id": 98497860,
|
||||
"damage_done": 41517,
|
||||
"final_blow": false,
|
||||
"security_status": -3,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 458944878,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 39888,
|
||||
"final_blow": false,
|
||||
"security_status": -6.5,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 28215
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 96029663,
|
||||
"corporation_id": 98433294,
|
||||
"damage_done": 39406,
|
||||
"final_blow": false,
|
||||
"security_status": -6.7,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 28215
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 90626300,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 37808,
|
||||
"final_blow": false,
|
||||
"security_status": -0.6,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 31894
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 90740848,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 36342,
|
||||
"final_blow": false,
|
||||
"security_status": -1.8,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 2929
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 1105550086,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 35971,
|
||||
"final_blow": false,
|
||||
"security_status": -2.6,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 28215
|
||||
},
|
||||
{
|
||||
"alliance_id": 99003581,
|
||||
"character_id": 94727582,
|
||||
"corporation_id": 98514029,
|
||||
"damage_done": 33501,
|
||||
"final_blow": false,
|
||||
"security_status": 3.2,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 31894
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 90368224,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 32116,
|
||||
"final_blow": false,
|
||||
"security_status": -2.4,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 2929
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 90001595,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 31387,
|
||||
"final_blow": false,
|
||||
"security_status": -0.8,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 2456
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 95278082,
|
||||
"corporation_id": 98418839,
|
||||
"damage_done": 31250,
|
||||
"final_blow": false,
|
||||
"security_status": 1.8,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 28215
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 91971344,
|
||||
"corporation_id": 98217414,
|
||||
"damage_done": 31247,
|
||||
"final_blow": false,
|
||||
"security_status": -1,
|
||||
"ship_type_id": 29986,
|
||||
"weapon_type_id": 29986
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 2113448089,
|
||||
"corporation_id": 98418839,
|
||||
"damage_done": 30174,
|
||||
"final_blow": false,
|
||||
"security_status": -0.4,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 2115912819,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 29242,
|
||||
"final_blow": false,
|
||||
"security_status": -2.1,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 2115885290,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 28009,
|
||||
"final_blow": false,
|
||||
"security_status": -2,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 95746094,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 27565,
|
||||
"final_blow": false,
|
||||
"security_status": -7.8,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99003581,
|
||||
"character_id": 90345487,
|
||||
"corporation_id": 98514029,
|
||||
"damage_done": 26016,
|
||||
"final_blow": false,
|
||||
"security_status": 0.5,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 2115874625,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 25679,
|
||||
"final_blow": false,
|
||||
"security_status": -1.9,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 2115880975,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 23320,
|
||||
"final_blow": false,
|
||||
"security_status": -3.5,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 96667534,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 21699,
|
||||
"final_blow": false,
|
||||
"security_status": -0.6,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 2115866658,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 20506,
|
||||
"final_blow": false,
|
||||
"security_status": -1.3,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 97105982,
|
||||
"corporation_id": 98217414,
|
||||
"damage_done": 19400,
|
||||
"final_blow": false,
|
||||
"security_status": 0,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99008704,
|
||||
"character_id": 96110151,
|
||||
"corporation_id": 98614116,
|
||||
"damage_done": 17547,
|
||||
"final_blow": false,
|
||||
"security_status": -5.5,
|
||||
"ship_type_id": 17740,
|
||||
"weapon_type_id": 17740
|
||||
},
|
||||
{
|
||||
"alliance_id": 99009221,
|
||||
"character_id": 90526637,
|
||||
"corporation_id": 98343297,
|
||||
"damage_done": 16791,
|
||||
"final_blow": false,
|
||||
"security_status": -1.9,
|
||||
"ship_type_id": 33157,
|
||||
"weapon_type_id": 21640
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 2112972140,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 16749,
|
||||
"final_blow": false,
|
||||
"security_status": -1.2,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 2115879470,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 14402,
|
||||
"final_blow": false,
|
||||
"security_status": -3.9,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 95698217,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 11546,
|
||||
"final_blow": false,
|
||||
"security_status": -5.2,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 353190170,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 10896,
|
||||
"final_blow": false,
|
||||
"security_status": -4.7,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 28215
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 91546798,
|
||||
"corporation_id": 98217414,
|
||||
"damage_done": 9872,
|
||||
"final_blow": false,
|
||||
"security_status": -0.7,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99009221,
|
||||
"character_id": 91578428,
|
||||
"corporation_id": 302750157,
|
||||
"damage_done": 7699,
|
||||
"final_blow": false,
|
||||
"security_status": -8.7,
|
||||
"ship_type_id": 17920,
|
||||
"weapon_type_id": 2185
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 94105463,
|
||||
"corporation_id": 98418839,
|
||||
"damage_done": 5265,
|
||||
"final_blow": false,
|
||||
"security_status": -3.3,
|
||||
"ship_type_id": 49713,
|
||||
"weapon_type_id": 2488
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 95526304,
|
||||
"corporation_id": 98418839,
|
||||
"damage_done": 3967,
|
||||
"final_blow": false,
|
||||
"security_status": -8.7,
|
||||
"ship_type_id": 22474,
|
||||
"weapon_type_id": 2488
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 90331727,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 2940,
|
||||
"final_blow": false,
|
||||
"security_status": -1.2,
|
||||
"ship_type_id": 49713,
|
||||
"weapon_type_id": 2185
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 2115880459,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 2301,
|
||||
"final_blow": false,
|
||||
"security_status": 4.1,
|
||||
"ship_type_id": 17738,
|
||||
"weapon_type_id": 17738
|
||||
},
|
||||
{
|
||||
"alliance_id": 99009547,
|
||||
"character_id": 1832436128,
|
||||
"corporation_id": 98618666,
|
||||
"damage_done": 937,
|
||||
"final_blow": false,
|
||||
"security_status": -8.1,
|
||||
"ship_type_id": 17740,
|
||||
"weapon_type_id": 3186
|
||||
},
|
||||
{
|
||||
"alliance_id": 99009547,
|
||||
"character_id": 96632877,
|
||||
"corporation_id": 98618666,
|
||||
"damage_done": 430,
|
||||
"final_blow": false,
|
||||
"security_status": -5.4,
|
||||
"ship_type_id": 17740,
|
||||
"weapon_type_id": 3186
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 96146444,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 126,
|
||||
"final_blow": false,
|
||||
"security_status": -1.2,
|
||||
"ship_type_id": 49713,
|
||||
"weapon_type_id": 49713
|
||||
},
|
||||
{
|
||||
"character_id": 2116393370,
|
||||
"corporation_id": 98593091,
|
||||
"damage_done": 111,
|
||||
"final_blow": false,
|
||||
"security_status": 0,
|
||||
"ship_type_id": 602,
|
||||
"weapon_type_id": 27321
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 93745147,
|
||||
"corporation_id": 98418839,
|
||||
"damage_done": 6,
|
||||
"final_blow": false,
|
||||
"security_status": -1.6,
|
||||
"ship_type_id": 12021,
|
||||
"weapon_type_id": 2873
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 95610468,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 4,
|
||||
"final_blow": false,
|
||||
"security_status": -2.2,
|
||||
"ship_type_id": 12017,
|
||||
"weapon_type_id": 484
|
||||
},
|
||||
{
|
||||
"alliance_id": 99009221,
|
||||
"character_id": 92304254,
|
||||
"corporation_id": 98343297,
|
||||
"damage_done": 1,
|
||||
"final_blow": false,
|
||||
"security_status": -9.3,
|
||||
"ship_type_id": 22474,
|
||||
"weapon_type_id": 22474
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 96624034,
|
||||
"corporation_id": 98493618,
|
||||
"damage_done": 0,
|
||||
"final_blow": false,
|
||||
"security_status": -2.1,
|
||||
"ship_type_id": 12017,
|
||||
"weapon_type_id": 37611
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 95388762,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 0,
|
||||
"final_blow": false,
|
||||
"security_status": 0.4,
|
||||
"ship_type_id": 12017,
|
||||
"weapon_type_id": 3001
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 1290463210,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 0,
|
||||
"final_blow": false,
|
||||
"security_status": -1.9,
|
||||
"ship_type_id": 49713,
|
||||
"weapon_type_id": 23707
|
||||
},
|
||||
{
|
||||
"alliance_id": 99009547,
|
||||
"character_id": 95748579,
|
||||
"corporation_id": 98618666,
|
||||
"damage_done": 0,
|
||||
"final_blow": false,
|
||||
"security_status": -7.9,
|
||||
"ship_type_id": 643,
|
||||
"weapon_type_id": 16497
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 2114899882,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 0,
|
||||
"final_blow": false,
|
||||
"security_status": -1.7,
|
||||
"ship_type_id": 12017,
|
||||
"weapon_type_id": 484
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 95624225,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 0,
|
||||
"final_blow": false,
|
||||
"security_status": -9.2,
|
||||
"ship_type_id": 12017,
|
||||
"weapon_type_id": 37608
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 93452185,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 0,
|
||||
"final_blow": false,
|
||||
"security_status": -2.1,
|
||||
"ship_type_id": 22474,
|
||||
"weapon_type_id": 7537
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 2114109824,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 0,
|
||||
"final_blow": false,
|
||||
"security_status": -2.1,
|
||||
"ship_type_id": 49713,
|
||||
"weapon_type_id": 484
|
||||
},
|
||||
{
|
||||
"alliance_id": 99006941,
|
||||
"character_id": 2113100583,
|
||||
"corporation_id": 98416134,
|
||||
"damage_done": 0,
|
||||
"final_blow": false,
|
||||
"security_status": -0.2,
|
||||
"ship_type_id": 49713,
|
||||
"weapon_type_id": 484
|
||||
}
|
||||
],
|
||||
"killmail_id": 81973979,
|
||||
"killmail_time": "2020-03-01T13:10:55Z",
|
||||
"solar_system_id": 30002537,
|
||||
"victim": {
|
||||
"alliance_id": 99009333,
|
||||
"character_id": 93330670,
|
||||
"corporation_id": 98267621,
|
||||
"damage_taken": 1127412,
|
||||
"items": [
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 41332,
|
||||
"quantity_destroyed": 3,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 41332,
|
||||
"quantity_dropped": 3,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 27,
|
||||
"item_type_id": 20847,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 155,
|
||||
"item_type_id": 33474,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 18,
|
||||
"item_type_id": 2048,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 28,
|
||||
"item_type_id": 4292,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 29001,
|
||||
"quantity_dropped": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 22,
|
||||
"item_type_id": 41218,
|
||||
"quantity_dropped": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 133,
|
||||
"item_type_id": 16275,
|
||||
"quantity_destroyed": 1125,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 41330,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 41330,
|
||||
"quantity_dropped": 4,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 94,
|
||||
"item_type_id": 31452,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 20028,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 20028,
|
||||
"quantity_dropped": 2,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 155,
|
||||
"item_type_id": 41489,
|
||||
"quantity_dropped": 48,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 13,
|
||||
"item_type_id": 18708,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 21,
|
||||
"item_type_id": 1978,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 20026,
|
||||
"quantity_destroyed": 3,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 29,
|
||||
"item_type_id": 20847,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 21,
|
||||
"item_type_id": 29001,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 155,
|
||||
"item_type_id": 16275,
|
||||
"quantity_dropped": 1250,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 155,
|
||||
"item_type_id": 16299,
|
||||
"quantity_destroyed": 6,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 155,
|
||||
"item_type_id": 16299,
|
||||
"quantity_dropped": 2,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 41489,
|
||||
"quantity_dropped": 12,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 29,
|
||||
"item_type_id": 37298,
|
||||
"quantity_dropped": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 17,
|
||||
"item_type_id": 40351,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 19,
|
||||
"item_type_id": 41491,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 12,
|
||||
"item_type_id": 2364,
|
||||
"quantity_dropped": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 20030,
|
||||
"quantity_dropped": 3,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 14,
|
||||
"item_type_id": 18708,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 28999,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 93,
|
||||
"item_type_id": 30993,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 11,
|
||||
"item_type_id": 2364,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 20,
|
||||
"item_type_id": 29001,
|
||||
"quantity_dropped": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 15,
|
||||
"item_type_id": 40351,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 19,
|
||||
"item_type_id": 41489,
|
||||
"quantity_dropped": 4,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 21254,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 21254,
|
||||
"quantity_dropped": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 20032,
|
||||
"quantity_destroyed": 3,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 20032,
|
||||
"quantity_dropped": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 16,
|
||||
"item_type_id": 40351,
|
||||
"quantity_dropped": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 20843,
|
||||
"quantity_dropped": 3,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 31,
|
||||
"item_type_id": 37298,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 20845,
|
||||
"quantity_destroyed": 3,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 92,
|
||||
"item_type_id": 30993,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 31,
|
||||
"item_type_id": 20847,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 133,
|
||||
"item_type_id": 16274,
|
||||
"quantity_dropped": 141666,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 20,
|
||||
"item_type_id": 1978,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 20847,
|
||||
"quantity_destroyed": 6,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 20847,
|
||||
"quantity_dropped": 3,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 5,
|
||||
"item_type_id": 21246,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 27,
|
||||
"item_type_id": 37298,
|
||||
"quantity_dropped": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 90,
|
||||
"item_type_id": 585,
|
||||
"items": [
|
||||
{
|
||||
"flag": 94,
|
||||
"item_type_id": 31159,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 20,
|
||||
"item_type_id": 3831,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 93,
|
||||
"item_type_id": 31159,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 22,
|
||||
"item_type_id": 9568,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 12,
|
||||
"item_type_id": 1405,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 92,
|
||||
"item_type_id": 31159,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 21,
|
||||
"item_type_id": 2553,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 11,
|
||||
"item_type_id": 1405,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
},
|
||||
{
|
||||
"flag": 19,
|
||||
"item_type_id": 5971,
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
}
|
||||
],
|
||||
"quantity_destroyed": 1,
|
||||
"singleton": 0
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"x": 55026869426.47358,
|
||||
"y": 7310382040.828209,
|
||||
"z": -163690355689.8978
|
||||
},
|
||||
"ship_type_id": 19720
|
||||
}
|
||||
}
|
||||
15
allianceauth/srp/tests/testdata/zkillboard_killmail_api_81973979.json
vendored
Normal file
15
allianceauth/srp/tests/testdata/zkillboard_killmail_api_81973979.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"killmail_id": 81973979,
|
||||
"zkb": {
|
||||
"locationID": 60004816,
|
||||
"hash": "e88a5fa7f342fa658ebe74a055b7679e28b05628",
|
||||
"fittedValue": 1532365686.21,
|
||||
"totalValue": 3177859026.86,
|
||||
"points": 1,
|
||||
"npc": false,
|
||||
"solo": false,
|
||||
"awox": false
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,18 +0,0 @@
|
||||
{% extends "allianceauth/base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block page_title %}{% trans "Help" %}{% endblock page_title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="col-lg-12">
|
||||
|
||||
<h1 class="page-header text-center">{% trans "Help" %}</h1>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="embed-responsive embed-responsive-16by9">
|
||||
<iframe class="embed-responsive-item" src="https://allianceauth.readthedocs.io/en/latest/features/"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
||||
@@ -26,15 +26,7 @@
|
||||
{% endif %}
|
||||
|
||||
{% menu_items %}
|
||||
|
||||
{% if user.is_superuser %}
|
||||
<li>
|
||||
<a class="{% navactive request 'authentication:help' %}"
|
||||
href="{% url 'authentication:help' %}">
|
||||
<i class="fa fa-question fa-fw"></i> {% trans "Help" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -39,6 +39,13 @@
|
||||
{% else %}
|
||||
<li><a href="{% url 'authentication:login' %}">{% trans "Login" %}</a></li>
|
||||
{% endif %}
|
||||
{% if user.is_superuser %}
|
||||
<li>
|
||||
<a class="navbar-brand" style="margin-left: -4px;" href="https://allianceauth.readthedocs.io/" target="_blank">
|
||||
<i class="fa fa-question-circle fa-fw"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<form id="f-lang-select" class="navbar-form navbar-right" action="{% url 'set_language' %}" method="post">
|
||||
{% csrf_token %}
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
from django.views.generic.base import View
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import redirect
|
||||
from django.contrib import messages
|
||||
|
||||
|
||||
class NightModeRedirectView(View):
|
||||
SESSION_VAR = 'NIGHT_MODE'
|
||||
SESSION_VAR = "NIGHT_MODE"
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
request.session[self.SESSION_VAR] = not self.night_mode_state(request)
|
||||
return HttpResponseRedirect(request.GET.get('next', '/'))
|
||||
return HttpResponseRedirect(request.GET.get("next", "/"))
|
||||
|
||||
@classmethod
|
||||
def night_mode_state(cls, request):
|
||||
@@ -17,3 +19,39 @@ class NightModeRedirectView(View):
|
||||
# Session is middleware
|
||||
# Sometimes request wont have a session attribute
|
||||
return False
|
||||
|
||||
|
||||
def Generic500Redirect(request):
|
||||
messages.error(
|
||||
request,
|
||||
"Auth encountered an error processing your request, please try again. "
|
||||
"If the error persists, please contact the administrators. (500 Internal Server Error)",
|
||||
)
|
||||
return redirect("authentication:dashboard")
|
||||
|
||||
|
||||
def Generic404Redirect(request, exception):
|
||||
messages.error(
|
||||
request,
|
||||
"Page does not exist. If you believe this is in error please contact the administrators. "
|
||||
"(404 Page Not Found)",
|
||||
)
|
||||
return redirect("authentication:dashboard")
|
||||
|
||||
|
||||
def Generic403Redirect(request, exception):
|
||||
messages.error(
|
||||
request,
|
||||
"You do not have permission to access the requested page. "
|
||||
"If you believe this is in error please contact the administrators. (403 Permission Denied)",
|
||||
)
|
||||
return redirect("authentication:dashboard")
|
||||
|
||||
|
||||
def Generic400Redirect(request, exception):
|
||||
messages.error(
|
||||
request,
|
||||
"Auth encountered an error processing your request, please try again. "
|
||||
"If the error persists, please contact the administrators. (400 Bad Request)",
|
||||
)
|
||||
return redirect("authentication:dashboard")
|
||||
|
||||
BIN
docs/_static/images/development/aa_core.png
vendored
Normal file
BIN
docs/_static/images/development/aa_core.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 193 KiB |
BIN
docs/_static/images/features/apps/corpstats.png
vendored
Normal file
BIN
docs/_static/images/features/apps/corpstats.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
17
docs/conf.py
17
docs/conf.py
@@ -18,7 +18,10 @@
|
||||
#
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.abspath('.'))
|
||||
import django
|
||||
sys.path.insert(0, os.path.abspath('..'))
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings_all'
|
||||
django.setup()
|
||||
|
||||
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
|
||||
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
|
||||
@@ -38,7 +41,9 @@ from recommonmark.transform import AutoStructify
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = []
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
@@ -96,7 +101,10 @@ html_theme = 'sphinx_rtd_theme'
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#
|
||||
# html_theme_options = {}
|
||||
|
||||
html_theme_options = {
|
||||
'navigation_depth': 4,
|
||||
}
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
@@ -148,6 +156,9 @@ man_pages = [
|
||||
[author], 1)
|
||||
]
|
||||
|
||||
# -- Options for autodoc -------------------------------------------------
|
||||
|
||||
add_module_names = False
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ It is possible to customize your **Alliance Auth** instance.
|
||||
|
||||
```eval_rst
|
||||
.. warning::
|
||||
Keep in mind that you may need to update some of your customizations manually after new release (e.g. when replacing AA templates).
|
||||
Keep in mind that you may need to update some of your customizations manually after new Auth releases (e.g. when replacing templates).
|
||||
```
|
||||
|
||||
## Site name
|
||||
463
docs/development/dev_setup/aa-dev-setup-wsl-vsc-v2.md
Normal file
463
docs/development/dev_setup/aa-dev-setup-wsl-vsc-v2.md
Normal file
@@ -0,0 +1,463 @@
|
||||
# Development on Windows 10 with WSL and Visual Studio Code
|
||||
|
||||
This document describes step-by-step how to setup a complete development environment for Alliance Auth apps on Windows 10 with Windows Subsystem for Linux (WSL) and Visual Studio Code.
|
||||
|
||||
The main benefit of this setup is that it runs all services and code in the native Linux environment (WSL) and at the same time can be full controlled from within a comfortable Windows IDE (Visual Studio Code) including code debugging.
|
||||
|
||||
In addition all tools described in this guide are open source or free software.
|
||||
|
||||
```eval_rst
|
||||
.. hint::
|
||||
This guide is meant for development purposes only and not for installing AA in a production environment. For production installation please see chapter **Installation**.
|
||||
```
|
||||
|
||||
## Overview
|
||||
|
||||
The development environment consists of the following components:
|
||||
|
||||
- Visual Studio Code with Remote WSL and Python extension
|
||||
- WSL with Ubunutu 18.04. LTS
|
||||
- Python 3.6 environment on WSL
|
||||
- MySQL server on WSL
|
||||
- Redis on WSL
|
||||
- Alliance Auth on WSL
|
||||
- Celery on WSL
|
||||
|
||||
We will use the build-in Django development webserver, so we don't need to setup a WSGI server or a web server.
|
||||
|
||||
## Requirement
|
||||
|
||||
The only requirement is a PC with Windows 10 and Internet connection in order to download the additional software components.
|
||||
|
||||
## Windows installation
|
||||
|
||||
### Windows Subsystem for Linux
|
||||
|
||||
- Install from here: [Microsoft docs](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
|
||||
|
||||
- Choose Ubuntu 18.04. LTS
|
||||
|
||||
### Visual Studio Code
|
||||
|
||||
- Install from here: [VSC Download](https://code.visualstudio.com/Download)
|
||||
|
||||
- Open the app and install the following VSC extensions:
|
||||
|
||||
- Remote WSL
|
||||
|
||||
- Connect to WSL. This will automatically install the VSC server on the VSC server for WSL
|
||||
|
||||
- Once connected to WSL install the Python extension on the WSL side
|
||||
|
||||
## WSL Installation
|
||||
|
||||
Open a WSL bash and update all software packets:
|
||||
|
||||
```bash
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
```
|
||||
|
||||
### Install Tools
|
||||
|
||||
```bash
|
||||
sudo apt-get install build-essential
|
||||
sudo apt-get install gettext
|
||||
```
|
||||
|
||||
### Install Python
|
||||
|
||||
For AA we want to develop with Python 3.6, because that provides the maximum compatibility with today's AA installations. This also happens to be the default Python 3 version for Ubuntu 18.04. at the point of this writing.
|
||||
|
||||
```eval_rst
|
||||
.. hint::
|
||||
To check your system's Python 3 version you can enter: ``python3 --version``
|
||||
```
|
||||
|
||||
```eval_rst
|
||||
.. note::
|
||||
Should your Ubuntu come with a newer version of Python we recommend to still setup your dev environment with the oldest Python 3 version supported by AA, e.g Python 3.6
|
||||
You an check out this `page <https://askubuntu.com/questions/682869/how-do-i-install-a-different-python-version-using-apt-get/1195153>`_ on how to install additional Python versions on Ubuntu.
|
||||
```
|
||||
|
||||
Use the following command to install Python 3 with all required libraries with the default version:
|
||||
|
||||
```bash
|
||||
sudo apt-get install python3 python3-dev python3-venv python3-setuptools python3-pip python-pip
|
||||
```
|
||||
|
||||
### Installing the DBMS
|
||||
|
||||
Install MySQL and required libraries with the following command:
|
||||
|
||||
```bash
|
||||
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
|
||||
```
|
||||
|
||||
```eval_rst
|
||||
.. note::
|
||||
We chose to use MySQL instead of MariaDB, because the standard version of MariaDB that comes with this Ubuntu distribution will not work with AA.
|
||||
```
|
||||
|
||||
We need to apply a permission fix to mysql or you will get a warning with every startup:
|
||||
|
||||
```bash
|
||||
sudo usermod -d /var/lib/mysql/ mysql
|
||||
```
|
||||
|
||||
Start the mysql server
|
||||
|
||||
```bash
|
||||
sudo service mysql start
|
||||
```
|
||||
|
||||
Create database and user for AA
|
||||
|
||||
```bash
|
||||
sudo mysql -u root
|
||||
```
|
||||
|
||||
```sql
|
||||
CREATE USER 'aa_dev'@'localhost' IDENTIFIED BY 'PASSWORD';
|
||||
CREATE DATABASE aa_dev CHARACTER SET utf8mb4;
|
||||
GRANT ALL PRIVILEGES ON aa_dev . * TO 'aa_dev'@'localhost';
|
||||
CREATE DATABASE test_aa_dev CHARACTER SET utf8mb4;
|
||||
GRANT ALL PRIVILEGES ON test_aa_dev . * TO 'aa_dev'@'localhost';
|
||||
exit;
|
||||
```
|
||||
|
||||
Add timezone info to mysql
|
||||
|
||||
```bash
|
||||
sudo mysql_tzinfo_to_sql /usr/share/zoneinfo | sudo mysql -u root mysql
|
||||
```
|
||||
|
||||
### Install redis and other tools
|
||||
|
||||
```bash
|
||||
sudo apt-get install unzip git redis-server curl libssl-dev libbz2-dev libffi-dev
|
||||
```
|
||||
|
||||
Start redis
|
||||
|
||||
```bash
|
||||
sudo redis-server --daemonize yes
|
||||
```
|
||||
|
||||
```eval_rst
|
||||
.. note::
|
||||
WSL does not have an init.d service, so it will not automatically start your services such as MySQL and Redis when you boot your Windows machine. For convenience we recommend putting the commands for starting these services in a bash script. Here is an example: ::
|
||||
|
||||
#/bin/bash
|
||||
# start services for AA dev
|
||||
sudo service mysql start
|
||||
sudo redis-server --daemonize yes
|
||||
|
||||
In addition it is possible to configure Windows to automatically start WSL services, but that procedure goes beyond the scopes of this guide.
|
||||
```
|
||||
|
||||
### Setup dev folder on WSL
|
||||
|
||||
Setup your folders on WSL bash for your dev project. Our approach will setup one AA project with one venv and multiple apps running under the same AA project, but each in their own folder and git.
|
||||
|
||||
A good location for setting up this folder structure is your home folder or a subfolder of your home:
|
||||
|
||||
```text
|
||||
~/aa-dev
|
||||
|- venv
|
||||
|- myauth
|
||||
|- my_app_1
|
||||
|- my_app_2
|
||||
|- ...
|
||||
```
|
||||
|
||||
Following this approach you can also setup additional AA projects, e.g. aa-dev-2, aa-dev-3 if needed.
|
||||
|
||||
Create the root folder aa-dev.
|
||||
|
||||
### setup virtual Python environment for aa-dev
|
||||
|
||||
Create the virtual environment. Run this in your aa-dev folder:
|
||||
|
||||
```bash
|
||||
python3 -m venv venv
|
||||
```
|
||||
|
||||
And activate your venv:
|
||||
|
||||
```bash
|
||||
source venv/bin/activate
|
||||
```
|
||||
|
||||
### install Python packages
|
||||
|
||||
```bash
|
||||
pip install --upgrade pip
|
||||
pip install wheel
|
||||
```
|
||||
|
||||
## Alliance Auth installation
|
||||
|
||||
## Install and create AA instance
|
||||
|
||||
```bash
|
||||
pip install allianceauth
|
||||
```
|
||||
|
||||
Now we are ready to setup our AA instance. Make sure to run this command in your aa-dev folder:
|
||||
|
||||
```bash
|
||||
allianceauth start myauth
|
||||
```
|
||||
|
||||
Next we will setup our VSC project for aa-dev by starting it directly from the WSL bash:
|
||||
|
||||
```bash
|
||||
code .
|
||||
```
|
||||
|
||||
First you want to make sure exclude the venv folder from VSC as follows:
|
||||
Open settings and go to Files:Exclude
|
||||
Add pattern: `**/venv`
|
||||
|
||||
### Update settings
|
||||
|
||||
Open the settings file with VSC. Its under `myauth/myauth/settings/local.py`
|
||||
|
||||
Make sure to have the settings of your Eve Online app ready.
|
||||
|
||||
Turn on DEBUG mode to ensure your static files get served by Django:
|
||||
|
||||
```python
|
||||
DEBUG = True
|
||||
```
|
||||
|
||||
Update name, user and password of your DATABASE configuration.
|
||||
|
||||
```python
|
||||
DATABASES['default'] = {
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'NAME': 'aa_dev',
|
||||
'USER': 'aa_dev',
|
||||
'PASSWORD': 'PASSWORD',
|
||||
'HOST': '127.0.0.1',
|
||||
'PORT': '3306',
|
||||
'OPTIONS': {'charset': 'utf8mb4'},
|
||||
}
|
||||
```
|
||||
|
||||
For the Eve Online related setup you need to create a SSO app on the developer site:
|
||||
|
||||
- Create your Eve Online SSO App on the [Eve Online developer site](https://developers.eveonline.com/)
|
||||
- Add all ESI scopes
|
||||
- Set callback URL to: `http://localhost:8000/sso/callback`
|
||||
|
||||
Then update local.py with your settings:
|
||||
|
||||
```python
|
||||
ESI_SSO_CLIENT_ID = 'YOUR-ID'
|
||||
ESI_SSO_CLIENT_SECRET = 'YOUR_SECRET'
|
||||
ESI_SSO_CALLBACK_URL = 'http://localhost:8000/sso/callback'
|
||||
```
|
||||
|
||||
Disable email registration:
|
||||
|
||||
```python
|
||||
REGISTRATION_VERIFY_EMAIL = False
|
||||
```
|
||||
|
||||
### Migrations and superuser
|
||||
|
||||
Before we can start AA we need to run migrations:
|
||||
|
||||
```bash
|
||||
cd myauth
|
||||
python manage.py migrate
|
||||
```
|
||||
|
||||
We also need to create a superuser for our AA installation:
|
||||
|
||||
```bash
|
||||
python /home/allianceserver/myauth/manage.py createsuperuser
|
||||
```
|
||||
|
||||
## Running Alliance Auth
|
||||
|
||||
## AA instance
|
||||
|
||||
We are now ready to run out AA instance with the following command:
|
||||
|
||||
```bash
|
||||
python manage.py runserver
|
||||
```
|
||||
|
||||
Once running you can access your auth site on the browser under `http://localhost:8000`. Or the admin site under `http://localhost:8000/admin`
|
||||
|
||||
```eval_rst
|
||||
.. hint::
|
||||
You can start your AA server directly from a terminal window in VSC or with a VSC debug config (see chapter about debugging for details).
|
||||
```
|
||||
|
||||
```eval_rst
|
||||
.. note::
|
||||
**Debug vs. Non-Debug mode**
|
||||
Usually it is best to run your dev AA instance in debug mode, so you get all the detailed error messages that helps a lot for finding errors. But there might be cases where you want to test features that do not exist in debug mode (e.g. error pages) or just want to see how your app behaves in non-debug / production mode.
|
||||
|
||||
When you turn off debug mode you will see a problem though: Your pages will not render correctly. The reason is that Django will stop serving your static files in production mode and expect you to serve them from a real web server. Luckily, there is an option that forces Django to continue serving your static files directly even when not in debug mode. Just start your server with the following option: ``python manage.py runserver --insecure``
|
||||
```
|
||||
|
||||
### Celery
|
||||
|
||||
In addition you can start a celery worker instance for myauth. For development purposed it makes sense to only start one instance and add some additional logging.
|
||||
|
||||
This can be done from the command line with the following command in the myauth folder (where manage.py is located):
|
||||
|
||||
```bash
|
||||
celery -E -A myauth worker -l info -P solo
|
||||
```
|
||||
|
||||
Same as AA itself you can start Celery from any terminal session, from a terminal window within VSC or as a debug config in VSC (see chapter about debugging for details). For convenience we recommend starting Celery as debug config.
|
||||
|
||||
## Debugging setup
|
||||
|
||||
To be able to debug your code you need to add debugging configuration to VSC. At least one for AA and one for celery.
|
||||
|
||||
### Breakpoints
|
||||
|
||||
By default VSC will break on any uncaught exception. Since every error raised by your tests will cause an uncaught exception we recommend to deactivate this feature.
|
||||
|
||||
To deactivate open click on the debug icon to switch to the debug view. Then un-check "Uncaught Exceptions" on the breakpoints window.
|
||||
|
||||
### AA debug config
|
||||
|
||||
In VSC click on Debug / Add Configuration and choose "Django". Should Django not appear as option make sure to first open a Django file (e.g. the local.py settings) to help VSC detect that you are using Django.
|
||||
|
||||
The result should look something like this:
|
||||
|
||||
```python
|
||||
{
|
||||
"name": "Python: Django",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/myauth/manage.py",
|
||||
"args": [
|
||||
"runserver",
|
||||
"--noreload"
|
||||
],
|
||||
"django": true
|
||||
}
|
||||
```
|
||||
|
||||
### Debug celery
|
||||
|
||||
For celery we need another debug config, so that we can run it in parallel to our AA instance.
|
||||
|
||||
Here is an example debug config for Celery:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"name": "Python: Celery",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"module": "celery",
|
||||
"cwd": "${workspaceFolder}/myauth",
|
||||
"console": "integratedTerminal",
|
||||
"args": [
|
||||
"-E",
|
||||
"-A",
|
||||
"myauth",
|
||||
"worker",
|
||||
"-l",
|
||||
"info",
|
||||
"-P",
|
||||
"solo",
|
||||
],
|
||||
"django": true
|
||||
},
|
||||
```
|
||||
|
||||
### Debug config for unit tests
|
||||
|
||||
Finally it makes sense to have a dedicated debug config for running unit tests. Here is an example config for running all tests of the app `example`.
|
||||
|
||||
```javascript
|
||||
{
|
||||
"name": "Python: myauth unit tests",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/myauth/manage.py",
|
||||
"args": [
|
||||
"test",
|
||||
"-v 2",
|
||||
"--keepdb",
|
||||
"--debug-mode",
|
||||
"--failfast",
|
||||
"example",
|
||||
],
|
||||
|
||||
"django": true
|
||||
},
|
||||
```
|
||||
|
||||
You can also specify to run just a part of your test suite down to a test method. Just give the full path to the test you want to run, e.g. `example.test.test_models.TestDemoModel.test_this_method`
|
||||
|
||||
### Debugging normal python scripts
|
||||
|
||||
Finally you may also want to have a debug config to debug a non-Django Python script:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"name": "Python: Current File",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"program": "${file}",
|
||||
"console": "integratedTerminal"
|
||||
},
|
||||
```
|
||||
|
||||
## Additional tools
|
||||
|
||||
The following additional tools are very helpful when developing for AA.
|
||||
|
||||
### Code Spell Checker
|
||||
|
||||
Typos in your user facing comments can be quite embarrassing. This spell checker helps you avoid them.
|
||||
|
||||
Install from here: [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker)
|
||||
|
||||
### DBeaver
|
||||
|
||||
DBeaver is a free universal database tool and works with many different kinds of databases include MySQL. It can be installed on Windows 10 and will be able to help manage your MySQL databases running on WSL.
|
||||
|
||||
Install from here. [DBeaver](https://dbeaver.io/)
|
||||
|
||||
### django-extensions
|
||||
|
||||
[django-extensions](https://django-extensions.readthedocs.io/en/latest/) is a swiss army knife for django developers with adds a lot of very useful features to your Django site. Here are a few highlights:
|
||||
|
||||
- shell_plus - An enhanced version of the Django shell. It will auto-load all your models at startup so you don't have to import anything and can use them right away.
|
||||
- graph_models - Creates a dependency graph of Django models. Visualizing a model dependency structure can be very useful for trying to understand how an existing Django app works, or e.g. how all the AA models work together.
|
||||
- runserver_plus - The standard runserver stuff but with the Werkzeug debugger baked in. This is a must have for any serious debugging.
|
||||
|
||||
## Adding apps for development
|
||||
|
||||
The idea behind the particular folder structure of aa-dev is to have each and every app in its own folder and git repo. To integrate them with the AA instance they need to be installed once using the -e option that enabled editing of the package. And then added to the INSTALLED_APPS settings.
|
||||
|
||||
To demonstrate let's add the example plugin to our environment.
|
||||
|
||||
Open a WSL bash and navigate to the aa-dev folder. Make sure you have activate your virtual environment. (`source venv/bin/activate`)
|
||||
|
||||
Run these commands:
|
||||
|
||||
```bash
|
||||
git clone https://gitlab.com/ErikKalkoken/allianceauth-example-plugin.git
|
||||
pip install -e allianceauth-example-plugin
|
||||
```
|
||||
|
||||
Add `'example'` to INSTALLED_APPS in your `local.py` settings.
|
||||
|
||||
Run migrations and restart your AA server, e.g.:
|
||||
|
||||
```bash
|
||||
cd myauth
|
||||
python manage.py migrate
|
||||
```
|
||||
10
docs/development/dev_setup/index.md
Normal file
10
docs/development/dev_setup/index.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Setup dev environment for AA
|
||||
|
||||
Here you find guides on how to setup your development environment for AA.
|
||||
|
||||
```eval_rst
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
aa-dev-setup-wsl-vsc-v2
|
||||
```
|
||||
@@ -8,4 +8,6 @@
|
||||
|
||||
custom/index
|
||||
aa_core/index
|
||||
dev_setup/index
|
||||
tech_docu/index
|
||||
```
|
||||
|
||||
39
docs/development/tech_docu/api/esi.rst
Normal file
39
docs/development/tech_docu/api/esi.rst
Normal file
@@ -0,0 +1,39 @@
|
||||
======================
|
||||
django-esi
|
||||
======================
|
||||
|
||||
The django-esi package provides an interface for easy access to the ESI.
|
||||
|
||||
Location: ``esi``
|
||||
|
||||
This is an external package. Please also see `here <https://gitlab.com/allianceauth/django-esi>`_ for it's official documentation.
|
||||
|
||||
clients
|
||||
===========
|
||||
|
||||
.. automodule:: esi.clients
|
||||
:members: esi_client_factory
|
||||
:undoc-members:
|
||||
|
||||
decorators
|
||||
===========
|
||||
|
||||
.. automodule:: esi.decorators
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
errors
|
||||
===========
|
||||
|
||||
.. automodule:: esi.errors
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
|
||||
models
|
||||
===========
|
||||
|
||||
.. automodule:: esi.models
|
||||
:members: Scope, Token
|
||||
:exclude-members: objects, provider
|
||||
:undoc-members:
|
||||
30
docs/development/tech_docu/api/evelinks.rst
Normal file
30
docs/development/tech_docu/api/evelinks.rst
Normal file
@@ -0,0 +1,30 @@
|
||||
===============================
|
||||
evelinks
|
||||
===============================
|
||||
|
||||
This package generates profile URLs for eve entities on 3rd party websites like evewho and zKillboard.
|
||||
|
||||
Location: ``allianceauth.eveonline.evelinks``
|
||||
|
||||
dotlan
|
||||
===============
|
||||
|
||||
.. automodule:: allianceauth.eveonline.evelinks.dotlan
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
eveho
|
||||
==============
|
||||
|
||||
.. automodule:: allianceauth.eveonline.evelinks.evewho
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
|
||||
zkillboard
|
||||
===================
|
||||
|
||||
.. automodule:: allianceauth.eveonline.evelinks.zkillboard
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
15
docs/development/tech_docu/api/eveonline.rst
Normal file
15
docs/development/tech_docu/api/eveonline.rst
Normal file
@@ -0,0 +1,15 @@
|
||||
======================
|
||||
eveonline
|
||||
======================
|
||||
|
||||
The eveonline package provides models for commonly used Eve Online entities like characters, corporations and alliances. All models have the ability to be loaded from ESI.
|
||||
|
||||
Location: ``allianceauth.eveonline``
|
||||
|
||||
models
|
||||
======
|
||||
|
||||
.. automodule:: allianceauth.eveonline.models
|
||||
:members:
|
||||
:exclude-members: objects, provider
|
||||
:undoc-members:
|
||||
13
docs/development/tech_docu/api/index.md
Normal file
13
docs/development/tech_docu/api/index.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# API
|
||||
|
||||
To reduce redundancy and help speed up development we encourage developers to utilize the following packages when developing apps for Alliance Auth.
|
||||
|
||||
```eval_rst
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
esi
|
||||
evelinks
|
||||
eveonline
|
||||
testutils
|
||||
```
|
||||
14
docs/development/tech_docu/api/testutils.rst
Normal file
14
docs/development/tech_docu/api/testutils.rst
Normal file
@@ -0,0 +1,14 @@
|
||||
=============================
|
||||
tests
|
||||
=============================
|
||||
|
||||
Here you find utility functions and classes, which can help speed up writing test cases for AA.
|
||||
|
||||
Location: ``allianceauth.tests.auth_utils``
|
||||
|
||||
auth_utils
|
||||
===========
|
||||
|
||||
.. automodule:: allianceauth.tests.auth_utils
|
||||
:members:
|
||||
:undoc-members:
|
||||
204
docs/development/tech_docu/celery.md
Normal file
204
docs/development/tech_docu/celery.md
Normal file
@@ -0,0 +1,204 @@
|
||||
# Celery FAQ
|
||||
|
||||
**Alliance Auth** uses Celery for asynchronous task management. This page aims to give developers some guidance on how to use Celery when developing apps for Alliance Auth.
|
||||
|
||||
For a complete documentation of Celery please refer to the [official Celery documentation](http://docs.celeryproject.org/en/latest/index.html).
|
||||
|
||||
## When should I use Celery in my app?
|
||||
|
||||
There are two main cases for using celery. Long duration of a process and recurrence of a process.
|
||||
|
||||
### Duration
|
||||
|
||||
Alliance Auth is an online web application and as such the user expects fast and immediate responses to any of his clicks or actions. Same as with any other good web site. Good response times are measures in ms and a user will perceive everything that takes longer than 1 sec as an interruption of his flow of thought (see also [Response Times: The 3 Important Limits](https://www.nngroup.com/articles/response-times-3-important-limits/)).
|
||||
|
||||
As a rule of thumb we therefore recommend to use celery tasks for every process that can take longer than 1 sec to complete (also think about how long your process might take with large amounts of data).
|
||||
|
||||
```eval_rst
|
||||
.. note::
|
||||
Another solution for dealing with long response time in particular when loading pages is to load parts of a page asynchronously, for example with AJAX.
|
||||
```
|
||||
|
||||
### Recurrence
|
||||
|
||||
Another case for using celery tasks is when you need recurring execution of tasks. For example you may want to update the list of characters in a corporation from ESI every hour.
|
||||
|
||||
These are called periodic tasks and Alliance Auth uses [celery beat](https://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html) to implement them.
|
||||
|
||||
## What is a celery task?
|
||||
|
||||
For the most part a celery task is a Python functions that is configured to be executed asynchronously and controlled by Celery. Celery tasks can be automatically retried, executed periodically, executed in work flows and much more. See the [celery docs](https://docs.celeryproject.org/en/latest/userguide/tasks.html) for a more detailed description.
|
||||
|
||||
## How should I use Celery in my app?
|
||||
|
||||
Please use the following approach to ensure your tasks are working properly with Alliance Auth:
|
||||
|
||||
- All tasks should be defined in a module of your app's package called `tasks.py`
|
||||
- Every task is a Python function with has the `@shared_task` decorator.
|
||||
- Task functions and the tasks module should be kept slim, just like views by mostly utilizing business logic defined in your models/managers.
|
||||
- Tasks should always have logging, so their function and potential errors can be monitored properly
|
||||
|
||||
Here is an example implementation of a task:
|
||||
|
||||
```Python
|
||||
import logging
|
||||
from celery import shared_task
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@shared_task
|
||||
def example():
|
||||
logger.info('example task started')
|
||||
```
|
||||
|
||||
This task can then be started from any another Python module like so:
|
||||
|
||||
```Python
|
||||
from .tasks import example
|
||||
|
||||
example.delay()
|
||||
```
|
||||
|
||||
## How should I use celery tasks in the UI?
|
||||
|
||||
There is a well established pattern for integrating asynchronous processes in the UI, for example when the user asks your app to perform a longer running action:
|
||||
|
||||
1. Notify the user immediately (with a Django message) that the process for completing the action has been started and that he will receive a report once completed.
|
||||
|
||||
2. Start the celery task
|
||||
|
||||
3. Once the celery task is completed it should send a notification containing the result of the action to the user. It's important to send that notification also in case of errors.
|
||||
|
||||
## Can I use long running tasks?
|
||||
|
||||
Long running tasks are possible, but in general Celery works best with short running tasks. Therefore we strongly recommend to try and break down long running tasks into smaller tasks if possible.
|
||||
|
||||
If contextually possible try to break down your long running task in shorter tasks that can run in parallel.
|
||||
|
||||
However, many long running tasks consist of several smaller processes that need to run one after the other. For example you may have a loop where you perform the same action on hundreds of objects. In those cases you can define each of the smaller processes as it's own task and then link them together, so that they are run one after the other. That is called chaining in Celery and is the preferred approach for implementing long running processes.
|
||||
|
||||
Example implementation for a celery chain:
|
||||
|
||||
```Python
|
||||
import logging
|
||||
from celery import shared_task, chain
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@shared_task
|
||||
def example():
|
||||
logger.info('example task')
|
||||
|
||||
@shared_task
|
||||
def long_runner():
|
||||
logger.info('started long runner')
|
||||
my_tasks = list()
|
||||
for _ in range(10):
|
||||
task_signature = example.si()
|
||||
my_task.append(task_signature)
|
||||
|
||||
chain(my_tasks).delay()
|
||||
```
|
||||
|
||||
In this example we fist add 10 example tasks that need to run one after the other to a list. This can be done by creating a so called signature for a task. Those signature are a kind of wrapper for tasks and can be used in various ways to compose work flow for tasks.
|
||||
|
||||
The list of task signatures is then converted to a chain and started asynchronously.
|
||||
|
||||
```eval_rst
|
||||
.. hint::
|
||||
In our example we use ``si()``, which is a shortcut for "immutable signatures" and prevents us from having to deal with result sharing between tasks.
|
||||
|
||||
For more information on signature and work flows see the official documentation on `Canvas <https://docs.celeryproject.org/en/latest/userguide/canvas.html>`_.
|
||||
|
||||
In this context please note that Alliance Auth currently only supports chaining, because all other variants require a so called results back, which Alliance Auth does not have.
|
||||
```
|
||||
|
||||
## How can I define periodic tasks for my app?
|
||||
|
||||
Periodic tasks are normal celery tasks which are added the scheduler for periodic execution. The convention for defining periodic tasks for an app is to define them in the local settings. So user will need to add those settings manually to his local settings during the installation process.
|
||||
|
||||
Example setting:
|
||||
|
||||
```Python
|
||||
CELERYBEAT_SCHEDULE['structures_update_all_structures'] = {
|
||||
'task': 'structures.tasks.update_all_structures',
|
||||
'schedule': crontab(minute='*/30'),
|
||||
}
|
||||
```
|
||||
|
||||
- `structures_update_all_structures` is the name of the scheduling entry. You can chose any name, but the convention is name of your app plus name of the task.
|
||||
|
||||
- `'task'`: Name of your task (full path)
|
||||
- `'schedule'`: Schedule definition (see Celery documentation on [Periodic Tasks](https://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html) for details)
|
||||
|
||||
## How can I use priorities for tasks?
|
||||
|
||||
In Alliance Auth we have defined task priorities from 0 - 9 as follows:
|
||||
|
||||
```eval_rst
|
||||
====== ========= ===========
|
||||
Number Priority Description
|
||||
====== ========= ===========
|
||||
0 Reserved Reserved for Auth and may not be used by apps
|
||||
1, 2 Highest Needs to run right now
|
||||
3, 4 High needs to run as soon as practical
|
||||
5 Normal default priority for most tasks
|
||||
6, 7 Low needs to run soonish, but is less urgent than most tasks
|
||||
8, 9 Lowest not urgent, can be run whenever there is time
|
||||
====== ========= ===========
|
||||
```
|
||||
|
||||
```eval_rst
|
||||
.. warning::
|
||||
Please make sure to use task priorities with care and especially do not use higher priorities without a good reason. All apps including Alliance Auth share the same task queues, so using higher task priorities excessively can potentially prevent more important tasks (of other apps) from completing on time.
|
||||
|
||||
You also want to make sure to run use lower priorities if you have a large amount of tasks or long running tasks, which are not super urgent. (e.g. the regular update of all Eve characters from ESI runs with priority 7)
|
||||
```
|
||||
|
||||
```eval_rst
|
||||
.. hint::
|
||||
If no priority is specified all tasks will be started with the default priority, which is 5.
|
||||
```
|
||||
|
||||
To run a task with a different priority you need to specify it when starting it.
|
||||
|
||||
Example for starting a task with priority 3:
|
||||
|
||||
```Python
|
||||
example.apply_async(priority=3)
|
||||
```
|
||||
|
||||
```eval_rst
|
||||
.. hint::
|
||||
For defining a priority to tasks you can not use the convenient shortcut ``delay()``, but instead need to start a task with ``apply_async()``, which also requires you to pass parameters to your task function differently. Please check out the `official docs <https://docs.celeryproject.org/en/stable/reference/celery.app.task.html#celery.app.task.Task.apply_async>`_ for details.
|
||||
```
|
||||
|
||||
## What special features should I be aware of?
|
||||
|
||||
Every Alliance Auth installation will come with a couple of special celery related features "out-of-the-box" that you can make use of in your apps.
|
||||
|
||||
### celery-once
|
||||
|
||||
Celery-once is a celery extension "that allows you to prevent multiple execution and queuing of celery tasks". What that means is that you can ensure that only one instance of a celery task runs at any given time. This can be useful for example if you do not want multiple instances of you task to talk to the same external service at the same time.
|
||||
|
||||
We use a custom backend for celery_once in Alliance Auth defined [here](https://gitlab.com/allianceauth/allianceauth/-/blob/master/allianceauth/services/tasks.py#L14)
|
||||
You can import it for use like so:
|
||||
|
||||
```Python
|
||||
from allianceauth.services.tasks import QueueOnce
|
||||
```
|
||||
|
||||
An example of AllianceAuth's use within the `@sharedtask` decorator, can be seen [here](https://gitlab.com/allianceauth/allianceauth/-/blob/master/allianceauth/services/modules/discord/tasks.py#L62) in the discord module
|
||||
You can use it like so:
|
||||
|
||||
```Python
|
||||
@shared_task(bind=True, name='your_modules.update_task', base=QueueOnce)
|
||||
```
|
||||
|
||||
Please see the [official documentation](hhttps://pypi.org/project/celery_once/) of celery-once for details.
|
||||
|
||||
### task priorities
|
||||
|
||||
Alliance Auth is using task priorities to enable priority based scheduling of task execution. Please see [How can I use priorities for tasks?](#how-can-i-use-priorities-for-tasks) for details.
|
||||
5
docs/development/tech_docu/core_models.md
Normal file
5
docs/development/tech_docu/core_models.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Core models
|
||||
|
||||
The following diagram shows the core models of AA and Django and their relationships:
|
||||
|
||||

|
||||
13
docs/development/tech_docu/index.md
Normal file
13
docs/development/tech_docu/index.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Developing apps
|
||||
|
||||
In this section you find topics useful for app developers.
|
||||
|
||||
```eval_rst
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
api/index
|
||||
celery
|
||||
core_models
|
||||
templatetags
|
||||
```
|
||||
16
docs/development/tech_docu/templatetags.rst
Normal file
16
docs/development/tech_docu/templatetags.rst
Normal file
@@ -0,0 +1,16 @@
|
||||
=============
|
||||
Template Tags
|
||||
=============
|
||||
|
||||
The following template tags are available to be used by all apps. To use them just load the respeetive template tag in your template like so:
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
{% load evelinks %}
|
||||
|
||||
evelinks
|
||||
========
|
||||
|
||||
.. automodule:: allianceauth.eveonline.templatetags.evelinks
|
||||
:members:
|
||||
:undoc-members:
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This module is used to check the registration status of Corp members and to determine character relationships, being mains or alts.
|
||||
|
||||

|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
@@ -1,50 +1,93 @@
|
||||
# Mumble
|
||||
|
||||
## Prepare Your Settings
|
||||
In your auth project's settings file, do the following:
|
||||
- Add `'allianceauth.services.modules.mumble',` to your `INSTALLED_APPS` list
|
||||
- Append the following to your local.py settings file:
|
||||
|
||||
```python
|
||||
# Mumble Configuration
|
||||
MUMBLE_URL = ""
|
||||
```
|
||||
|
||||
## Overview
|
||||
Mumble is a free voice chat server. While not as flashy as TeamSpeak, it has all the functionality and is easier to customize. And is better. I may be slightly biased.
|
||||
|
||||
## Dependencies
|
||||
The mumble server package can be retrieved from a repository we need to add, mumble/release.
|
||||
```eval_rst
|
||||
.. note::
|
||||
Note that this guide assumes that you have installed Auth with the official :doc:`/installation/allianceauth` guide under ``/home/allianceserver`` and that it is called ``myauth``. Accordingly it assumes that you have a service user called ``allianceserver`` that is used to run all Auth services under supervisor.
|
||||
```
|
||||
|
||||
apt-add-repository ppa:mumble/release
|
||||
apt-get update
|
||||
```eval_rst
|
||||
.. note::
|
||||
Same as the official installation guide this guide is assuming you are performing all steps as ``root`` user.
|
||||
```
|
||||
|
||||
Now two packages need to be installed:
|
||||
```eval_rst
|
||||
.. warning::
|
||||
This guide is currently for Ubuntu only.
|
||||
```
|
||||
|
||||
apt-get install python-software-properties mumble-server
|
||||
## Installations
|
||||
|
||||
Download the appropriate authenticator release from [the authenticator repository](https://gitlab.com/allianceauth/mumble-authenticator) and install the python dependencies for it:
|
||||
### Installing Mumble Server
|
||||
|
||||
pip install -r requirements.txt
|
||||
The mumble server package can be retrieved from a repository, which we need to add:
|
||||
|
||||
## Configuring Mumble
|
||||
Mumble ships with a configuration file that needs customization. By default it’s located at /etc/mumble-server.ini. Open it with your favourite text editor:
|
||||
```bash
|
||||
apt-add-repository ppa:mumble/release
|
||||
```
|
||||
|
||||
nano /etc/mumble-server.ini
|
||||
```bash
|
||||
apt-get update
|
||||
```
|
||||
|
||||
REQUIRED: To enable the ICE authenticator, edit the following:
|
||||
Now three packages need to be installed:
|
||||
|
||||
- `icesecretwrite=MY_CLEVER_PASSWORD`, obviously choosing a secure password
|
||||
- ensure the line containing `Ice="tcp -h 127.0.0.1 -p 6502"` is uncommented
|
||||
```bash
|
||||
apt-get install python-software-properties mumble-server libqt5sql5-mysql
|
||||
```
|
||||
|
||||
By default mumble operates on SQLite which is fine, but slower than a dedicated MySQL server. To customize the database, edit the following:
|
||||
### Installing Mumble Authenticator
|
||||
|
||||
- uncomment the database line, and change it to `database=alliance_mumble`
|
||||
- `dbDriver=QMYSQL`
|
||||
- `dbUsername=allianceserver` or whatever you called the Alliance Auth MySQL user
|
||||
- `dbPassword=` that user’s password
|
||||
- `dbPort=3306`
|
||||
- `dbPrefix=murmur_`
|
||||
Next, we need to download the latest authenticator release from the [authenticator repository](https://gitlab.com/allianceauth/mumble-authenticator).
|
||||
|
||||
```bash
|
||||
git clone https://gitlab.com/allianceauth/mumble-authenticator /home/allianceserver/mumble-authenticator
|
||||
```
|
||||
|
||||
We will now install the authenticator into your Auth virtual environment. Please make sure to activate it first:
|
||||
|
||||
```bash
|
||||
source /home/allianceserver/venv/auth/bin/activate
|
||||
```
|
||||
|
||||
Install the python dependencies for the mumble authenticator. Note that this process can take a couple minutes to complete.
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Configuring Mumble Server
|
||||
|
||||
The mumble server needs it's own database. Open an SQL shell with `mysql -u root -p` and execute the SQL commands to create it:
|
||||
|
||||
```sql
|
||||
CREATE DATABASE alliance_mumble CHARACTER SET utf8mb4;
|
||||
```
|
||||
|
||||
```sql
|
||||
GRANT ALL PRIVILEGES ON alliance_mumble . * TO 'allianceserver'@'localhost';
|
||||
```
|
||||
|
||||
Mumble ships with a configuration file that needs customization. By default it’s located at `/etc/mumble-server.ini`. Open it with your favorite text editor:
|
||||
|
||||
```bash
|
||||
nano /etc/mumble-server.ini
|
||||
```
|
||||
|
||||
We need to enable the ICE authenticator. Edit the following:
|
||||
|
||||
- `icesecretwrite=MY_CLEVER_PASSWORD`, obviously choosing a secure password
|
||||
- ensure the line containing `Ice="tcp -h 127.0.0.1 -p 6502"` is uncommented
|
||||
|
||||
We also want to enable Mumble to use the previously created MySQL / MariaDB database, edit the following:
|
||||
|
||||
- uncomment the database line, and change it to `database=alliance_mumble`
|
||||
- `dbDriver=QMYSQL`
|
||||
- `dbUsername=allianceserver` or whatever you called the Alliance Auth MySQL user
|
||||
- `dbPassword=` that user’s password
|
||||
- `dbPort=3306`
|
||||
- `dbPrefix=murmur_`
|
||||
|
||||
To name your root channel, uncomment and set `registerName=` to whatever cool name you want
|
||||
|
||||
@@ -52,55 +95,123 @@ Save and close the file.
|
||||
|
||||
To get Mumble superuser account credentials, run the following:
|
||||
|
||||
dpkg-reconfigure mumble-server
|
||||
```bash
|
||||
dpkg-reconfigure mumble-server
|
||||
```
|
||||
|
||||
Set the password to something you’ll remember and write it down. This is needed to manage ACLs.
|
||||
Set the password to something you’ll remember and write it down. This is your superuser password and later needed to manage ACLs.
|
||||
|
||||
Now restart the server to see the changes reflected.
|
||||
|
||||
service mumble-server restart
|
||||
```bash
|
||||
service mumble-server restart
|
||||
```
|
||||
|
||||
That’s it! Your server is ready to be connected to at example.com:64738
|
||||
|
||||
## Configuring the Authenticator
|
||||
## Configuring Mumble Authenticator
|
||||
|
||||
The ICE authenticator lives in the mumble-authenticator repository, cd to the directory where you cloned it.
|
||||
|
||||
Make a copy of the default config:
|
||||
|
||||
cp authenticator.ini.example authenticator.ini
|
||||
```bash
|
||||
cp authenticator.ini.example authenticator.ini
|
||||
```
|
||||
|
||||
Edit `authenticator.ini` and change these values:
|
||||
|
||||
- `[database]`
|
||||
- `user = ` your allianceserver MySQL user
|
||||
- `password = ` your allianceserver MySQL user's password
|
||||
- `[ice]`
|
||||
- `secret = ` the `icewritesecret` password set earlier
|
||||
- `[database]`
|
||||
- `user =` your allianceserver MySQL user
|
||||
- `password =` your allianceserver MySQL user's password
|
||||
- `[ice]`
|
||||
- `secret =` the `icewritesecret` password set earlier
|
||||
|
||||
Test your configuration by starting it: `python authenticator.py`
|
||||
Test your configuration by starting it:
|
||||
|
||||
## Running the Authenticator
|
||||
```bash
|
||||
python /home/allianceserver/mumble-authenticator/authenticator.py
|
||||
```
|
||||
|
||||
And finally ensure the allianceserver user has read/write permissions to the mumble authenticator files before proceeding:
|
||||
|
||||
```bash
|
||||
chown -R allianceserver:allianceserver /home/allianceserver/mumble-authenticator
|
||||
```
|
||||
|
||||
The authenticator needs to be running 24/7 to validate users on Mumble. This can be achieved by adding a section to your auth project's supervisor config file like the following example:
|
||||
|
||||
```
|
||||
```text
|
||||
[program:authenticator]
|
||||
command=/path/to/venv/bin/python authenticator.py
|
||||
directory=/path/to/authenticator/directory/
|
||||
command=/home/allianceserver/venv/auth/bin/python authenticator.py
|
||||
directory=/home/allianceserver/mumble-authenticator
|
||||
user=allianceserver
|
||||
stdout_logfile=/path/to/authenticator/directory/authenticator.log
|
||||
stderr_logfile=/path/to/authenticator/directory/authenticator.log
|
||||
stdout_logfile=/home/allianceserver/myauth/log/authenticator.log
|
||||
stderr_logfile=/home/allianceserver/myauth/log/authenticator.log
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startsecs=10
|
||||
priority=998
|
||||
priority=996
|
||||
```
|
||||
|
||||
In addition we'd recommend to add the authenticator to Auth's restart group in your supervisor conf. For that you need to add it to the group line as shown in the following example:
|
||||
|
||||
Note that groups will only be created on Mumble automatically when a user joins who is in the group.
|
||||
```text
|
||||
[group:myauth]
|
||||
programs=beat,worker,gunicorn,authenticator
|
||||
priority=999
|
||||
```
|
||||
|
||||
## Prepare Auth
|
||||
In your project's settings file, set `MUMBLE_URL` to the public address of your mumble server. Do not include any leading `http://` or `mumble://`.
|
||||
To enable the changes in your supervisor configuration you need to restart the supervisor process itself. And before we do that we are shutting down the current Auth supervisors gracefully:
|
||||
|
||||
Run migrations and restart Gunicorn and Celery to complete setup.
|
||||
```bash
|
||||
supervisor stop myauth:
|
||||
systemctl restart supervisor
|
||||
```
|
||||
|
||||
## Configuring Auth
|
||||
|
||||
In your auth project's settings file (`myauth/settings/local.py`), do the following:
|
||||
|
||||
- Add `'allianceauth.services.modules.mumble',` to your `INSTALLED_APPS` list
|
||||
- set `MUMBLE_URL` to the public address of your mumble server. Do not include any leading `http://` or `mumble://`.
|
||||
|
||||
Example config:
|
||||
|
||||
```python
|
||||
# Installed apps
|
||||
INSTALLED_APPS += [
|
||||
# ...
|
||||
'allianceauth.services.modules.mumble'
|
||||
# ...
|
||||
]
|
||||
|
||||
# Mumble Configuration
|
||||
MUMBLE_URL = "mumble.example.com"
|
||||
```
|
||||
|
||||
Finally, run migrations and restart your supervisor to complete the setup:
|
||||
|
||||
```bash
|
||||
python /home/allianceserver/myauth/manage.py migrate
|
||||
```
|
||||
|
||||
```bash
|
||||
supervisorctl restart myauth:
|
||||
```
|
||||
|
||||
## Permissions on Auth
|
||||
|
||||
To enable the mumble service for users on Auth you need to give them the `access_mumble` permission. This permission is often added to the `Member` state.
|
||||
|
||||
```eval_rst
|
||||
.. note::
|
||||
Note that groups will only be created on Mumble automatically when a user joins who is in the group.
|
||||
```
|
||||
|
||||
## ACL configuration
|
||||
|
||||
On a freshly installed mumble server only your superuser has the right to configure ACLs and create channels. The credentials for logging in with your superuser are:
|
||||
|
||||
- user: `SuperUser`
|
||||
- password: *what you defined when configuring your mumble server*
|
||||
|
||||
@@ -15,6 +15,7 @@ Welcome to the official documentation for **Alliance Auth**!
|
||||
installation/index
|
||||
features/index
|
||||
maintenance/index
|
||||
development/index
|
||||
support/index
|
||||
customizing/index
|
||||
development/index
|
||||
```
|
||||
|
||||
@@ -9,7 +9,7 @@ This document describes how to install **Alliance Auth** from scratch.
|
||||
|
||||
```eval_rst
|
||||
.. note::
|
||||
There are additional installation steps for activating services and apps that come with **Alliance Auth**. Please see the page for the respective service or apps in chapter **Features** for details.
|
||||
There are additional installation steps for activating services and apps that come with **Alliance Auth**. Please see the page for the respective service or apps in chapter :doc:`/features/index` for details.
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
@@ -28,7 +28,7 @@ Alliance Auth can be installed on any Unix like operating system. Dependencies a
|
||||
|
||||
### Python
|
||||
|
||||
Alliance Auth requires python3.5 or higher. Ensure it is installed on your server before proceeding.
|
||||
Alliance Auth requires Python 3.6 or higher. Ensure it is installed on your server before proceeding.
|
||||
|
||||
Ubuntu:
|
||||
|
||||
@@ -83,7 +83,8 @@ apt-get install unzip git redis-server curl libssl-dev libbz2-dev libffi-dev
|
||||
CentOS:
|
||||
|
||||
```bash
|
||||
yum install gcc gcc-c++ unzip git redis curl bzip2-devel
|
||||
yum install gcc gcc-c++ unzip git redis curl
|
||||
2-devel
|
||||
```
|
||||
|
||||
```eval_rst
|
||||
@@ -113,7 +114,7 @@ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
|
||||
```eval_rst
|
||||
.. note::
|
||||
You may see errors when you add the timezone tables. To make sure that they were correctly added run the following commands and check for the ``time_zone`` tables::
|
||||
|
||||
|
||||
mysql -u root -p
|
||||
use mysql;
|
||||
show tables;
|
||||
|
||||
@@ -97,10 +97,10 @@ If you unsure which apps you have installed from repos check `INSTALLED_APPS` in
|
||||
pip list
|
||||
```
|
||||
|
||||
Some AA installations might still be running an older version of django_celery_beat. We would recommend to upgrade to the current version before doing the Python update:
|
||||
Some AA installations might still be running an older version of django-celery-beat. We would recommend to upgrade to the current version before doing the Python update:
|
||||
|
||||
```bash
|
||||
pip install -U django_celery_beat
|
||||
pip install -U 'django-celery-beat<2.00'
|
||||
```
|
||||
|
||||
```bash
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Maintenance & Customizing
|
||||
# Maintenance
|
||||
|
||||
In the maintenance chapter you find details about where important log files are found, how you can customize your AA installation and how to solve common issues.
|
||||
|
||||
@@ -7,8 +7,7 @@ In the maintenance chapter you find details about where important log files are
|
||||
:maxdepth: 1
|
||||
|
||||
apps
|
||||
customizing
|
||||
project
|
||||
troubleshooting
|
||||
|
||||
tuning/index
|
||||
```
|
||||
|
||||
160
docs/maintenance/tuning/celery.md
Normal file
160
docs/maintenance/tuning/celery.md
Normal file
@@ -0,0 +1,160 @@
|
||||
# Celery
|
||||
|
||||
```eval_rst
|
||||
.. hint::
|
||||
Most tunings will require a change to your supervisor configuration in your `supervisor.conf` file. Note that you need to restart the supervisor daemon in order for any changes to take effect. And before restarting the daemon you may want to make sure your supervisors stop gracefully:(Ubuntu):
|
||||
|
||||
::
|
||||
|
||||
supervisor stop myauth:
|
||||
systemctl supervisor restart
|
||||
```
|
||||
|
||||
## Task Logging
|
||||
|
||||
By default task logging is deactivated. Enabling task logging allows you to monitor what tasks are doing in addition to getting all warnings and error messages. To enable info logging for tasks add the following to the command configuration of your worker in the `supervisor.conf` file:
|
||||
|
||||
```text
|
||||
-l info
|
||||
```
|
||||
|
||||
Full example:
|
||||
|
||||
```text
|
||||
command=/home/allianceserver/venv/auth/bin/celery -A myauth worker -l info
|
||||
```
|
||||
|
||||
## Protection against memory leaks
|
||||
|
||||
Celery workers often have memory leaks and will therefore grow in size over time. While the Alliance Auth team is working hard to ensure Auth is free of memory leaks some may still be cause by bugs in different versions of libraries or community apps. It is therefore good practice to enable features that protect against potential memory leaks.
|
||||
|
||||
There are two ways to protect against memory leaks:
|
||||
|
||||
- Worker
|
||||
- Supervisor
|
||||
|
||||
### Worker
|
||||
|
||||
Celery workers can be configured to automatically restart if they grow above a defined memory threshold. Restarts will be graceful, so current tasks will be allowed to complete before the restart happens.
|
||||
|
||||
To add protection against memory leaks add the following to the command configuration of your worker in the `supervisor.conf` file. This sets the upper limit to 256MB.
|
||||
|
||||
```text
|
||||
--max-memory-per-child 262144
|
||||
```
|
||||
|
||||
Full example:
|
||||
|
||||
```text
|
||||
command=/home/allianceserver/venv/auth/bin/celery -A myauth worker --max-memory-per-child 262144
|
||||
```
|
||||
|
||||
```eval_rst
|
||||
.. hint::
|
||||
The 256 MB limit is just an example and should be adjusted to your system configuration. We would suggest to not go below 128MB though, since new workers start with around 80 MB already. Also take into consideration that this value is per worker and that you properly have more than one worker running in your system (if your workers run as processes, which is the default).
|
||||
```
|
||||
|
||||
```eval_rst
|
||||
.. warning::
|
||||
The ``max-memory-per-child`` parameter only works when workers run as processes (which is the default). It does not work for threads.
|
||||
```
|
||||
|
||||
```eval_rst
|
||||
.. note::
|
||||
Alternatively, you can also limit the number of runs per worker until a restart is performed with the worker parameter ``max-tasks-per-child``. This can also protect against memory leaks if you set the threshold is low enough. However, it is less precise since than using ``max-memory-per-child``.
|
||||
```
|
||||
|
||||
See also the [official Celery documentation](https://docs.celeryproject.org/en/stable/userguide/workers.html#max-memory-per-child-setting) for more information about these two worker parameters.
|
||||
|
||||
### Supervisor
|
||||
|
||||
It is also possible to configure your supervisor to monitor and automatically restart programs that exceed a memory threshold.
|
||||
|
||||
This is not a built in feature and requires the 3rd party extension [superlance](https://superlance.readthedocs.io/en/latest/), which includes a set of plugin utilities for supervisor. The one that watches memory consumption is [memmon](https://superlance.readthedocs.io/en/latest/memmon.html).
|
||||
|
||||
To setup install superlance into your venv with:
|
||||
|
||||
```bash
|
||||
pip install superlance
|
||||
```
|
||||
|
||||
You can then add `memmon` to your `supervisor.conf`. Here is an example setup with a worker that runs with gevent:
|
||||
|
||||
```text
|
||||
[eventlistener:memmon]
|
||||
command=/home/allianceserver/venv/auth/bin/memmon -p worker=512MB
|
||||
directory=/home/allianceserver/myauth
|
||||
events=TICK_60
|
||||
```
|
||||
|
||||
This setup will check the memory consumption of the program "worker" every 60 secs and automatically restart it if is goes above 512 MB. Note that it will use the stop signal configured in supervisor, which is `TERM` by default. `TERM` will cause a "warm shutdown" of your worker, so all currently running tasks are completed before the restart.
|
||||
|
||||
Again, the 512 MB is just an example and should be adjusted to fit your system configuration.
|
||||
|
||||
## Increasing task throughput
|
||||
|
||||
Celery tasks are designed to run concurrently, so one obvious way to increase task throughput is run more tasks in parallel.
|
||||
|
||||
### Concurrency
|
||||
|
||||
This can be achieved by the setting the concurrency parameter of the celery worker to a higher number. For example:
|
||||
|
||||
```text
|
||||
--concurrency=4
|
||||
```
|
||||
|
||||
However, there is a catch: In the default configuration each worker will spawn as it's own process. So increasing the number of workers will increase both CPU load and memory consumption in your system.
|
||||
|
||||
The recommended number of workers is one per core, which is what you get automatically with the default configuration. Going beyond that can quickly reduce you overall system performance. i.e. the response time for Alliance Auth or other apps running on the same system may take a hit while many tasks are running.
|
||||
|
||||
```eval_rst
|
||||
.. hint::
|
||||
The optimal number will hugely depend on your individual system configuration and you may want to experiment with different settings to find the optimal. One way to generate task load and verify your configuration is to run a model update with the following command:
|
||||
|
||||
::
|
||||
|
||||
celery -A myauth call allianceauth.eveonline.tasks.run_model_update
|
||||
|
||||
```
|
||||
|
||||
### Processes vs. Threads
|
||||
|
||||
A better way to increase concurrency without impacting is to switch from processes to threads for celery workers. In general celery workers perform better with processes when tasks are primarily CPU bound. And they perform better with threads when tasks that are primarily I/O bound.
|
||||
|
||||
Alliance Auth tasks are primarily I/O bound (most tasks are fetching data from ESI and/or updating the local database), so threads are clearly the better choice for Alliance Auth. However, there is a catch. Celery's out-of-the-box support for threads is limited and additional packages and configurations is required to make it work. Nonetheless, the performance gain - especially in smaller systems - is significant, so it may well be worth the additional configuration complexity.
|
||||
|
||||
```eval_rst
|
||||
.. warning::
|
||||
One important feature that no longer works with threads is the worker parameter ``--max-memory-per-child`` that protects against memory leaks. But you can alternatively use supervisor_ to monitor and restart your workers.
|
||||
```
|
||||
|
||||
See also the also [this guide](https://www.distributedpython.com/2018/10/26/celery-execution-pool/) on more information about how to configure the execution pool for workers.
|
||||
|
||||
### Setting up for threads
|
||||
|
||||
First, you need to install a threads packages. Celery supports both gevent and eventlet. We will go with gevent, since it's newer and better supported. Should you encounter any issues with gevent, you may want to try eventlet.
|
||||
|
||||
To install gevent make sure you are in your venv and install the following:
|
||||
|
||||
```bash
|
||||
pip install gevent
|
||||
```
|
||||
|
||||
Next we need to reconfigure the workers to use gevent threads. For that add the following parameters to your worker config:
|
||||
|
||||
```text
|
||||
--pool=gevent --concurrency=10
|
||||
```
|
||||
|
||||
Full example:
|
||||
|
||||
```text
|
||||
command=/home/allianceserver/venv/auth/bin/celery -A myauth worker --pool=gevent --concurrency=10
|
||||
```
|
||||
|
||||
Make sure to restart supervisor to activate the changes.
|
||||
|
||||
```eval_rst
|
||||
.. hint::
|
||||
The optimal number of concurrent workers will be different for every system and we recommend experimenting with different figures to find the optimal for your system. Note, that the example of 10 threads is conservative and should work even with smaller systems.
|
||||
```
|
||||
13
docs/maintenance/tuning/gunicorn.md
Normal file
13
docs/maintenance/tuning/gunicorn.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Gunicorn
|
||||
|
||||
## Number of workers
|
||||
|
||||
The default installation will have 3 workers configured for Gunicorn. This will be fine on most system, but if your system as more than one core than you might want to increase the number of workers to get better response times. Note that more workers will also need more RAM though.
|
||||
|
||||
The number you set this to will depend on your own server environment, how many visitors you have etc. Gunicorn suggests `(2 x $num_cores) + 1` for the number of workers. So for example if you have 2 cores you want 2 x 2 + 1 = 5 workers. See [here](https://docs.gunicorn.org/en/stable/design.html#how-many-workers) for the official discussion on this topic.
|
||||
|
||||
For example to get 5 workers change the setting `--workers=5` in your `supervisor.conf` file and then reload the supervisor with the following command to activate the change (Ubuntu):
|
||||
|
||||
```bash
|
||||
systemctl restart supervisor
|
||||
```
|
||||
16
docs/maintenance/tuning/index.md
Normal file
16
docs/maintenance/tuning/index.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Tuning
|
||||
|
||||
The official installation guide will install a stable version of Alliance Auth that will work fine for most cases. However, there are a lot of levels that can be used to optimize a system. For example some installations may we short on RAM and want to reduce the total memory footprint, even though that may reduce system performance. Others are fine with further increasing the memory footprint to get better system performance.
|
||||
|
||||
```eval_rst
|
||||
.. warning::
|
||||
Tuning usually has benefits and costs and should only be performed by experienced Linux administrators who understand the impact of tuning decisions on to their system.
|
||||
```
|
||||
|
||||
```eval_rst
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
gunicorn
|
||||
celery
|
||||
```
|
||||
5
setup.py
5
setup.py
@@ -53,7 +53,7 @@ setup(
|
||||
extras_require={
|
||||
'testing': testing_extras
|
||||
},
|
||||
python_requires='~=3.5',
|
||||
python_requires='~=3.6',
|
||||
license='GPLv2',
|
||||
packages=['allianceauth'],
|
||||
url='https://gitlab.com/allianceauth/allianceauth',
|
||||
@@ -71,8 +71,7 @@ setup(
|
||||
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
|
||||
'Operating System :: POSIX :: Linux',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
|
||||
@@ -12,4 +12,7 @@ urlpatterns += [
|
||||
url(r'^second-page/$', views.page, name='p1'),
|
||||
]
|
||||
|
||||
|
||||
handler500 = 'allianceauth.views.Generic500Redirect'
|
||||
handler404 = 'allianceauth.views.Generic404Redirect'
|
||||
handler403 = 'allianceauth.views.Generic403Redirect'
|
||||
handler400 = 'allianceauth.views.Generic400Redirect'
|
||||
|
||||
6
tox.ini
6
tox.ini
@@ -1,14 +1,13 @@
|
||||
[tox]
|
||||
skipsdist = true
|
||||
usedevelop = true
|
||||
envlist = py{35,36,37,38}-{all}
|
||||
envlist = py{36,37,38}-{all}
|
||||
|
||||
[testenv]
|
||||
setenv =
|
||||
all: DJANGO_SETTINGS_MODULE = tests.settings_all
|
||||
core: DJANGO_SETTINGS_MODULE = tests.settings_core
|
||||
basepython =
|
||||
py35: python3.5
|
||||
basepython =
|
||||
py36: python3.6
|
||||
py37: python3.7
|
||||
py38: python3.8
|
||||
@@ -19,5 +18,6 @@ install_command = pip install -e ".[testing]" -U {opts} {packages}
|
||||
commands =
|
||||
all: coverage run runtests.py -v 2
|
||||
all: coverage report -m
|
||||
all: coverage xml
|
||||
core: coverage run runtests.py allianceauth.authentication.tests.test_app_settings -v 2
|
||||
all: coverage xml
|
||||
|
||||
Reference in New Issue
Block a user