aa-hangar-ready 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aa_hangar_ready-0.3.1/LICENSE +21 -0
- aa_hangar_ready-0.3.1/PKG-INFO +198 -0
- aa_hangar_ready-0.3.1/README.md +157 -0
- aa_hangar_ready-0.3.1/hangarready/__init__.py +12 -0
- aa_hangar_ready-0.3.1/hangarready/admin.py +86 -0
- aa_hangar_ready-0.3.1/hangarready/app_settings.py +34 -0
- aa_hangar_ready-0.3.1/hangarready/apps.py +18 -0
- aa_hangar_ready-0.3.1/hangarready/auth_hooks.py +51 -0
- aa_hangar_ready-0.3.1/hangarready/helpers.py +167 -0
- aa_hangar_ready-0.3.1/hangarready/management/__init__.py +0 -0
- aa_hangar_ready-0.3.1/hangarready/management/commands/__init__.py +0 -0
- aa_hangar_ready-0.3.1/hangarready/management/commands/hangarready_add_existing_characters.py +126 -0
- aa_hangar_ready-0.3.1/hangarready/management/commands/hangarready_fetch_structures.py +160 -0
- aa_hangar_ready-0.3.1/hangarready/management/commands/hangarready_grant_access.py +76 -0
- aa_hangar_ready-0.3.1/hangarready/migrations/0001_initial.py +92 -0
- aa_hangar_ready-0.3.1/hangarready/migrations/__init__.py +0 -0
- aa_hangar_ready-0.3.1/hangarready/models.py +318 -0
- aa_hangar_ready-0.3.1/hangarready/signals.py +90 -0
- aa_hangar_ready-0.3.1/hangarready/static/hangarready/hangarready.css +33 -0
- aa_hangar_ready-0.3.1/hangarready/tasks.py +343 -0
- aa_hangar_ready-0.3.1/hangarready/templates/hangarready/base.html +380 -0
- aa_hangar_ready-0.3.1/hangarready/templates/hangarready/index.html +264 -0
- aa_hangar_ready-0.3.1/hangarready/templates/hangarready/manage_characters.html +170 -0
- aa_hangar_ready-0.3.1/hangarready/templates/hangarready/saved_searches.html +92 -0
- aa_hangar_ready-0.3.1/hangarready/templates/hangarready/search_results.html +198 -0
- aa_hangar_ready-0.3.1/hangarready/templates/hangarready/ship_report.html +515 -0
- aa_hangar_ready-0.3.1/hangarready/test_settings.py +18 -0
- aa_hangar_ready-0.3.1/hangarready/tests/__init__.py +1 -0
- aa_hangar_ready-0.3.1/hangarready/tests/test_helpers.py +61 -0
- aa_hangar_ready-0.3.1/hangarready/tests/test_models.py +194 -0
- aa_hangar_ready-0.3.1/hangarready/tests/test_views.py +80 -0
- aa_hangar_ready-0.3.1/hangarready/urls.py +32 -0
- aa_hangar_ready-0.3.1/hangarready/views.py +961 -0
- aa_hangar_ready-0.3.1/pyproject.toml +87 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 AA Hangar Ready Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aa-hangar-ready
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: AA Hangar Ready - Alliance Auth Plugin
|
|
5
|
+
Author-email: Milkshak3s <milkshak3s@pm.me>
|
|
6
|
+
Requires-Python: ~=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Classifier: Environment :: Web Environment
|
|
9
|
+
Classifier: Framework :: Django
|
|
10
|
+
Classifier: Framework :: Django :: 4.0
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
21
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: allianceauth>=4.0.0
|
|
24
|
+
Requires-Dist: django-esi>=7.0.0
|
|
25
|
+
Requires-Dist: django>=4.0
|
|
26
|
+
Requires-Dist: django-eveuniverse>=1.0.0
|
|
27
|
+
Requires-Dist: black>=24.0.0 ; extra == "dev"
|
|
28
|
+
Requires-Dist: coverage>=7.0.0 ; extra == "dev"
|
|
29
|
+
Requires-Dist: django-webtest ; extra == "dev"
|
|
30
|
+
Requires-Dist: flake8>=7.0.0 ; extra == "dev"
|
|
31
|
+
Requires-Dist: isort>=5.13.0 ; extra == "dev"
|
|
32
|
+
Requires-Dist: pylint-django>=2.5.0 ; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest>=8.0.0 ; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-django>=4.0.0 ; extra == "dev"
|
|
35
|
+
Project-URL: Documentation, https://github.com/Milkshak3s/aa-hangar-ready
|
|
36
|
+
Project-URL: Homepage, https://github.com/Milkshak3s/aa-hangar-ready
|
|
37
|
+
Project-URL: Source, https://github.com/Milkshak3s/aa-hangar-ready
|
|
38
|
+
Project-URL: Tracker, https://github.com/Milkshak3s/aa-hangar-ready/issues
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
|
|
41
|
+
# AA Hangar Ready
|
|
42
|
+
|
|
43
|
+
[](https://pypi.org/project/aa-hangar-ready/)
|
|
44
|
+
[](https://github.com/Milkshak3s/aa-hangar-ready/blob/master/LICENSE)
|
|
45
|
+
[](https://pypi.org/project/aa-hangar-ready/)
|
|
46
|
+
[](https://pypi.org/project/aa-hangar-ready/)
|
|
47
|
+
|
|
48
|
+
Track member ship assets across your organization. Search for specific ship types and classes in specific hangar locations via ESI.
|
|
49
|
+
|
|
50
|
+
## Key Features
|
|
51
|
+
|
|
52
|
+
- 🚀 **Ship Search** - Find who has specific ships or ship classes across all members
|
|
53
|
+
- 📊 **Ship Reports** - Generate custom reports by ship type, class, or location
|
|
54
|
+
- 💾 **Saved Reports** - Save frequently-used reports for quick access
|
|
55
|
+
- 🔄 **Auto-Updates** - Periodic automatic asset updates via Celery
|
|
56
|
+
- 👥 **Admin Tools** - Bulk-add characters, view all tracked characters, fetch structure names
|
|
57
|
+
- 🎨 **Modern UI** - Clean, responsive Bootstrap 5 interface with dark mode support
|
|
58
|
+
|
|
59
|
+
## Requirements
|
|
60
|
+
|
|
61
|
+
- Alliance Auth 4.0.0+
|
|
62
|
+
- Python 3.8+
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
### 1. Install Package
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install aa-hangar-ready
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 2. Add to Settings
|
|
73
|
+
|
|
74
|
+
Add to `INSTALLED_APPS` in your Alliance Auth `local.py`:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
INSTALLED_APPS += [
|
|
78
|
+
'hangarready',
|
|
79
|
+
]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 3. Run Migrations
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
python manage.py migrate hangarready
|
|
86
|
+
python manage.py collectstatic --noinput
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 4. Restart Services
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
supervisorctl restart myauth:
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 5. Setup Permissions
|
|
96
|
+
|
|
97
|
+
Grant permissions in Alliance Auth admin:
|
|
98
|
+
|
|
99
|
+
| Permission | Purpose |
|
|
100
|
+
|------------|---------|
|
|
101
|
+
| `hangarready.basic_access` | Access the plugin (grant to all members) |
|
|
102
|
+
| `hangarready.view_all_characters` | Admin features - view/manage all characters |
|
|
103
|
+
|
|
104
|
+
### 6. (Optional) Configure Auto-Updates
|
|
105
|
+
|
|
106
|
+
Add to `local.py` for automatic asset updates:
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from celery.schedules import crontab
|
|
110
|
+
|
|
111
|
+
CELERYBEAT_SCHEDULE['hangarready_update_stale_assets'] = {
|
|
112
|
+
'task': 'hangarready.tasks.update_stale_character_assets',
|
|
113
|
+
'schedule': crontab(hour='*/6'), # Every 6 hours
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Usage
|
|
118
|
+
|
|
119
|
+
### For Members
|
|
120
|
+
|
|
121
|
+
1. Navigate to **Hangar Ready** in the sidebar
|
|
122
|
+
2. Click **Manage Characters**
|
|
123
|
+
3. Add your characters (requires ESI scope: `esi-assets.read_assets.v1`)
|
|
124
|
+
4. Assets will be fetched and updated automatically
|
|
125
|
+
|
|
126
|
+
**Search for Ships:**
|
|
127
|
+
- Use the dashboard search form to find ships by type and hangar location
|
|
128
|
+
- Or use **Ship Report** to generate detailed reports by ship class
|
|
129
|
+
|
|
130
|
+
**Save Reports:**
|
|
131
|
+
- Create custom reports and save them for quick re-running
|
|
132
|
+
|
|
133
|
+
### For Admins
|
|
134
|
+
|
|
135
|
+
**Bulk Add Characters:**
|
|
136
|
+
- Click **Bulk Add Characters** on the Manage Characters page
|
|
137
|
+
- Automatically adds all characters that have already granted required ESI scopes
|
|
138
|
+
|
|
139
|
+
**View All Characters:**
|
|
140
|
+
- Dashboard shows an admin-only section with all tracked characters across all accounts
|
|
141
|
+
- See character ownership, status, and last update times
|
|
142
|
+
|
|
143
|
+
**Fetch Structure Names:**
|
|
144
|
+
- Click **Fetch Structures** to resolve structure IDs to names via ESI
|
|
145
|
+
- Individual structure name refresh buttons available in search results
|
|
146
|
+
|
|
147
|
+
## Configuration
|
|
148
|
+
|
|
149
|
+
Optional settings in `local.py`:
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
# Update frequency (hours)
|
|
153
|
+
HANGAR_READY_UPDATE_INTERVAL = 6
|
|
154
|
+
|
|
155
|
+
# Maximum cache age before marked stale (hours)
|
|
156
|
+
HANGAR_READY_MAX_CACHE_AGE = 24
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## ESI Scopes Required
|
|
160
|
+
|
|
161
|
+
- `esi-assets.read_assets.v1` - Read character assets
|
|
162
|
+
- `esi-universe.read_structures.v1` - Resolve structure names (optional, for better UX)
|
|
163
|
+
|
|
164
|
+
## Supported Hangar Locations
|
|
165
|
+
|
|
166
|
+
- Main Hangar
|
|
167
|
+
- Ship Maintenance Bay
|
|
168
|
+
- Fleet Hangar
|
|
169
|
+
- Corp Hangars 1-7
|
|
170
|
+
|
|
171
|
+
## Troubleshooting
|
|
172
|
+
|
|
173
|
+
**Assets not updating?**
|
|
174
|
+
- Check Celery is running: `supervisorctl status`
|
|
175
|
+
- Verify ESI token is valid (re-add character if needed)
|
|
176
|
+
- Check Celery logs: `tail -f /var/log/myauth/celery.log`
|
|
177
|
+
|
|
178
|
+
**Permission denied?**
|
|
179
|
+
- Ensure user has `hangarready.basic_access` permission
|
|
180
|
+
|
|
181
|
+
**Missing ship types?**
|
|
182
|
+
```bash
|
|
183
|
+
python manage.py eveuniverse_load_types --type_id <TYPE_ID>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Support
|
|
187
|
+
|
|
188
|
+
- **Issues**: [GitHub Issues](https://github.com/Milkshak3s/aa-hangar-ready/issues)
|
|
189
|
+
- **Discord**: [Alliance Auth Discord](https://discord.gg/allianceauth)
|
|
190
|
+
|
|
191
|
+
## License
|
|
192
|
+
|
|
193
|
+
MIT License - see [LICENSE](LICENSE) file
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
**Built for [Alliance Auth](https://gitlab.com/allianceauth/allianceauth)** | Uses [django-esi](https://gitlab.com/allianceauth/django-esi) & [django-eveuniverse](https://gitlab.com/ErikKalkoken/django-eveuniverse)
|
|
198
|
+
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# AA Hangar Ready
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/aa-hangar-ready/)
|
|
4
|
+
[](https://github.com/Milkshak3s/aa-hangar-ready/blob/master/LICENSE)
|
|
5
|
+
[](https://pypi.org/project/aa-hangar-ready/)
|
|
6
|
+
[](https://pypi.org/project/aa-hangar-ready/)
|
|
7
|
+
|
|
8
|
+
Track member ship assets across your organization. Search for specific ship types and classes in specific hangar locations via ESI.
|
|
9
|
+
|
|
10
|
+
## Key Features
|
|
11
|
+
|
|
12
|
+
- 🚀 **Ship Search** - Find who has specific ships or ship classes across all members
|
|
13
|
+
- 📊 **Ship Reports** - Generate custom reports by ship type, class, or location
|
|
14
|
+
- 💾 **Saved Reports** - Save frequently-used reports for quick access
|
|
15
|
+
- 🔄 **Auto-Updates** - Periodic automatic asset updates via Celery
|
|
16
|
+
- 👥 **Admin Tools** - Bulk-add characters, view all tracked characters, fetch structure names
|
|
17
|
+
- 🎨 **Modern UI** - Clean, responsive Bootstrap 5 interface with dark mode support
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
|
|
21
|
+
- Alliance Auth 4.0.0+
|
|
22
|
+
- Python 3.8+
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
### 1. Install Package
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install aa-hangar-ready
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 2. Add to Settings
|
|
33
|
+
|
|
34
|
+
Add to `INSTALLED_APPS` in your Alliance Auth `local.py`:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
INSTALLED_APPS += [
|
|
38
|
+
'hangarready',
|
|
39
|
+
]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 3. Run Migrations
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
python manage.py migrate hangarready
|
|
46
|
+
python manage.py collectstatic --noinput
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 4. Restart Services
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
supervisorctl restart myauth:
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 5. Setup Permissions
|
|
56
|
+
|
|
57
|
+
Grant permissions in Alliance Auth admin:
|
|
58
|
+
|
|
59
|
+
| Permission | Purpose |
|
|
60
|
+
|------------|---------|
|
|
61
|
+
| `hangarready.basic_access` | Access the plugin (grant to all members) |
|
|
62
|
+
| `hangarready.view_all_characters` | Admin features - view/manage all characters |
|
|
63
|
+
|
|
64
|
+
### 6. (Optional) Configure Auto-Updates
|
|
65
|
+
|
|
66
|
+
Add to `local.py` for automatic asset updates:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from celery.schedules import crontab
|
|
70
|
+
|
|
71
|
+
CELERYBEAT_SCHEDULE['hangarready_update_stale_assets'] = {
|
|
72
|
+
'task': 'hangarready.tasks.update_stale_character_assets',
|
|
73
|
+
'schedule': crontab(hour='*/6'), # Every 6 hours
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Usage
|
|
78
|
+
|
|
79
|
+
### For Members
|
|
80
|
+
|
|
81
|
+
1. Navigate to **Hangar Ready** in the sidebar
|
|
82
|
+
2. Click **Manage Characters**
|
|
83
|
+
3. Add your characters (requires ESI scope: `esi-assets.read_assets.v1`)
|
|
84
|
+
4. Assets will be fetched and updated automatically
|
|
85
|
+
|
|
86
|
+
**Search for Ships:**
|
|
87
|
+
- Use the dashboard search form to find ships by type and hangar location
|
|
88
|
+
- Or use **Ship Report** to generate detailed reports by ship class
|
|
89
|
+
|
|
90
|
+
**Save Reports:**
|
|
91
|
+
- Create custom reports and save them for quick re-running
|
|
92
|
+
|
|
93
|
+
### For Admins
|
|
94
|
+
|
|
95
|
+
**Bulk Add Characters:**
|
|
96
|
+
- Click **Bulk Add Characters** on the Manage Characters page
|
|
97
|
+
- Automatically adds all characters that have already granted required ESI scopes
|
|
98
|
+
|
|
99
|
+
**View All Characters:**
|
|
100
|
+
- Dashboard shows an admin-only section with all tracked characters across all accounts
|
|
101
|
+
- See character ownership, status, and last update times
|
|
102
|
+
|
|
103
|
+
**Fetch Structure Names:**
|
|
104
|
+
- Click **Fetch Structures** to resolve structure IDs to names via ESI
|
|
105
|
+
- Individual structure name refresh buttons available in search results
|
|
106
|
+
|
|
107
|
+
## Configuration
|
|
108
|
+
|
|
109
|
+
Optional settings in `local.py`:
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
# Update frequency (hours)
|
|
113
|
+
HANGAR_READY_UPDATE_INTERVAL = 6
|
|
114
|
+
|
|
115
|
+
# Maximum cache age before marked stale (hours)
|
|
116
|
+
HANGAR_READY_MAX_CACHE_AGE = 24
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## ESI Scopes Required
|
|
120
|
+
|
|
121
|
+
- `esi-assets.read_assets.v1` - Read character assets
|
|
122
|
+
- `esi-universe.read_structures.v1` - Resolve structure names (optional, for better UX)
|
|
123
|
+
|
|
124
|
+
## Supported Hangar Locations
|
|
125
|
+
|
|
126
|
+
- Main Hangar
|
|
127
|
+
- Ship Maintenance Bay
|
|
128
|
+
- Fleet Hangar
|
|
129
|
+
- Corp Hangars 1-7
|
|
130
|
+
|
|
131
|
+
## Troubleshooting
|
|
132
|
+
|
|
133
|
+
**Assets not updating?**
|
|
134
|
+
- Check Celery is running: `supervisorctl status`
|
|
135
|
+
- Verify ESI token is valid (re-add character if needed)
|
|
136
|
+
- Check Celery logs: `tail -f /var/log/myauth/celery.log`
|
|
137
|
+
|
|
138
|
+
**Permission denied?**
|
|
139
|
+
- Ensure user has `hangarready.basic_access` permission
|
|
140
|
+
|
|
141
|
+
**Missing ship types?**
|
|
142
|
+
```bash
|
|
143
|
+
python manage.py eveuniverse_load_types --type_id <TYPE_ID>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Support
|
|
147
|
+
|
|
148
|
+
- **Issues**: [GitHub Issues](https://github.com/Milkshak3s/aa-hangar-ready/issues)
|
|
149
|
+
- **Discord**: [Alliance Auth Discord](https://discord.gg/allianceauth)
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
MIT License - see [LICENSE](LICENSE) file
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
**Built for [Alliance Auth](https://gitlab.com/allianceauth/allianceauth)** | Uses [django-esi](https://gitlab.com/allianceauth/django-esi) & [django-eveuniverse](https://gitlab.com/ErikKalkoken/django-eveuniverse)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AA Hangar Ready - Alliance Auth Plugin
|
|
3
|
+
|
|
4
|
+
Tracks character assets via ESI to check which characters have specific ships
|
|
5
|
+
in specific hangar locations.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
default_app_config = "hangarready.apps.HangarReadyConfig"
|
|
9
|
+
|
|
10
|
+
__version__ = "0.3.1"
|
|
11
|
+
__title__ = "Hangar Ready"
|
|
12
|
+
__description__ = "Alliance Auth plugin to track character ship assets in hangars via ESI"
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""Django admin configuration for Hangar Ready"""
|
|
2
|
+
|
|
3
|
+
from django.contrib import admin
|
|
4
|
+
|
|
5
|
+
from .models import AssetItem, CharacterAssets, Location, SavedSearch
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@admin.register(CharacterAssets)
|
|
9
|
+
class CharacterAssetsAdmin(admin.ModelAdmin):
|
|
10
|
+
"""Admin for CharacterAssets model"""
|
|
11
|
+
|
|
12
|
+
list_display = [
|
|
13
|
+
"character",
|
|
14
|
+
"token_character",
|
|
15
|
+
"last_update",
|
|
16
|
+
"is_active",
|
|
17
|
+
"has_error",
|
|
18
|
+
]
|
|
19
|
+
list_filter = ["is_active", "last_update"]
|
|
20
|
+
search_fields = [
|
|
21
|
+
"character__character_name",
|
|
22
|
+
"token_character__user__username",
|
|
23
|
+
]
|
|
24
|
+
readonly_fields = ["last_update", "update_error"]
|
|
25
|
+
raw_id_fields = ["character", "token_character"]
|
|
26
|
+
|
|
27
|
+
def has_error(self, obj):
|
|
28
|
+
"""Check if last update had error"""
|
|
29
|
+
return bool(obj.update_error)
|
|
30
|
+
|
|
31
|
+
has_error.boolean = True
|
|
32
|
+
has_error.short_description = "Error"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@admin.register(AssetItem)
|
|
36
|
+
class AssetItemAdmin(admin.ModelAdmin):
|
|
37
|
+
"""Admin for AssetItem model"""
|
|
38
|
+
|
|
39
|
+
list_display = [
|
|
40
|
+
"type_name",
|
|
41
|
+
"character_name",
|
|
42
|
+
"location_flag",
|
|
43
|
+
"location_name",
|
|
44
|
+
"quantity",
|
|
45
|
+
"is_ship",
|
|
46
|
+
]
|
|
47
|
+
list_filter = ["is_ship", "location_flag", "location_type"]
|
|
48
|
+
search_fields = [
|
|
49
|
+
"type_name",
|
|
50
|
+
"character_assets__character__character_name",
|
|
51
|
+
"location_name",
|
|
52
|
+
]
|
|
53
|
+
readonly_fields = ["item_id", "type_id", "type_name"]
|
|
54
|
+
raw_id_fields = ["character_assets"]
|
|
55
|
+
|
|
56
|
+
def character_name(self, obj):
|
|
57
|
+
"""Get character name"""
|
|
58
|
+
return obj.character_assets.character.character_name
|
|
59
|
+
|
|
60
|
+
character_name.short_description = "Character"
|
|
61
|
+
character_name.admin_order_field = "character_assets__character__character_name"
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@admin.register(SavedSearch)
|
|
65
|
+
class SavedSearchAdmin(admin.ModelAdmin):
|
|
66
|
+
"""Admin for SavedSearch model"""
|
|
67
|
+
|
|
68
|
+
list_display = ["name", "user", "created_at", "updated_at"]
|
|
69
|
+
list_filter = ["created_at", "updated_at"]
|
|
70
|
+
search_fields = ["name", "user__username"]
|
|
71
|
+
readonly_fields = ["created_at", "updated_at"]
|
|
72
|
+
raw_id_fields = ["user"]
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@admin.register(Location)
|
|
76
|
+
class LocationAdmin(admin.ModelAdmin):
|
|
77
|
+
"""Admin for Location model"""
|
|
78
|
+
|
|
79
|
+
list_display = ["name", "location_id", "location_type", "last_updated"]
|
|
80
|
+
list_filter = ["location_type", "last_updated"]
|
|
81
|
+
search_fields = ["name", "location_id"]
|
|
82
|
+
readonly_fields = ["last_updated"]
|
|
83
|
+
|
|
84
|
+
def has_add_permission(self, request):
|
|
85
|
+
"""Locations are auto-populated, disable manual add"""
|
|
86
|
+
return False
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Application settings for Hangar Ready"""
|
|
2
|
+
|
|
3
|
+
from django.conf import settings
|
|
4
|
+
|
|
5
|
+
# How often to update character assets (in hours)
|
|
6
|
+
HANGAR_READY_UPDATE_INTERVAL = getattr(settings, "HANGAR_READY_UPDATE_INTERVAL", 6)
|
|
7
|
+
|
|
8
|
+
# Maximum age of cached asset data before requiring refresh (in hours)
|
|
9
|
+
HANGAR_READY_MAX_CACHE_AGE = getattr(settings, "HANGAR_READY_MAX_CACHE_AGE", 24)
|
|
10
|
+
|
|
11
|
+
# Hangar location flags mapping
|
|
12
|
+
HANGAR_FLAGS = {
|
|
13
|
+
"Hangar": "Main Hangar",
|
|
14
|
+
"ShipHangar": "Ship Maintenance Bay",
|
|
15
|
+
"FleetHangar": "Fleet Hangar",
|
|
16
|
+
"CorpSAG1": "Corp Hangar 1",
|
|
17
|
+
"CorpSAG2": "Corp Hangar 2",
|
|
18
|
+
"CorpSAG3": "Corp Hangar 3",
|
|
19
|
+
"CorpSAG4": "Corp Hangar 4",
|
|
20
|
+
"CorpSAG5": "Corp Hangar 5",
|
|
21
|
+
"CorpSAG6": "Corp Hangar 6",
|
|
22
|
+
"CorpSAG7": "Corp Hangar 7",
|
|
23
|
+
"HangarAll": "All Hangars",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
# Ship category ID from EVE SDE
|
|
27
|
+
SHIP_CATEGORY_ID = 6
|
|
28
|
+
|
|
29
|
+
# ESI required scopes
|
|
30
|
+
ESI_SCOPE_ASSETS = "esi-assets.read_assets.v1"
|
|
31
|
+
ESI_SCOPE_STRUCTURES = "esi-universe.read_structures.v1"
|
|
32
|
+
|
|
33
|
+
# Combined scopes for full functionality
|
|
34
|
+
ESI_SCOPES_ALL = [ESI_SCOPE_ASSETS, ESI_SCOPE_STRUCTURES]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Django app configuration for Hangar Ready"""
|
|
2
|
+
|
|
3
|
+
from django.apps import AppConfig
|
|
4
|
+
|
|
5
|
+
from . import __version__
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class HangarReadyConfig(AppConfig):
|
|
9
|
+
"""Django app configuration"""
|
|
10
|
+
|
|
11
|
+
name = "hangarready"
|
|
12
|
+
label = "hangarready"
|
|
13
|
+
verbose_name = f"Hangar Ready v{__version__}"
|
|
14
|
+
|
|
15
|
+
def ready(self):
|
|
16
|
+
"""App initialization"""
|
|
17
|
+
# Import signals to register them
|
|
18
|
+
from . import signals # noqa: F401
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""Alliance Auth hooks for Hangar Ready"""
|
|
2
|
+
|
|
3
|
+
from allianceauth import hooks
|
|
4
|
+
from allianceauth.services.hooks import MenuItemHook, UrlHook
|
|
5
|
+
|
|
6
|
+
from . import urls
|
|
7
|
+
from .app_settings import ESI_SCOPES_ALL
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class HangarReadyMenuItem(MenuItemHook):
|
|
11
|
+
"""Menu item hook for Hangar Ready"""
|
|
12
|
+
|
|
13
|
+
def __init__(self):
|
|
14
|
+
MenuItemHook.__init__(
|
|
15
|
+
self,
|
|
16
|
+
"Hangar Ready",
|
|
17
|
+
"fa-solid fa-warehouse",
|
|
18
|
+
"hangarready:index",
|
|
19
|
+
navactive=["hangarready:"],
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
def render(self, request):
|
|
23
|
+
"""Check permissions before rendering"""
|
|
24
|
+
if request.user.has_perm("hangarready.basic_access"):
|
|
25
|
+
return MenuItemHook.render(self, request)
|
|
26
|
+
return ""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@hooks.register("menu_item_hook")
|
|
30
|
+
def register_menu():
|
|
31
|
+
"""Register menu item"""
|
|
32
|
+
return HangarReadyMenuItem()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@hooks.register("url_hook")
|
|
36
|
+
def register_urls():
|
|
37
|
+
"""Register URL patterns"""
|
|
38
|
+
return UrlHook(urls, "hangarready", r"^hangarready/")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@hooks.register("secure_group_filters")
|
|
42
|
+
def register_secure_group_filters():
|
|
43
|
+
"""Register required ESI scopes for secure groups"""
|
|
44
|
+
# This makes the scope available for groups to require
|
|
45
|
+
return []
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# Make the required scopes visible to Alliance Auth
|
|
49
|
+
def get_required_scopes():
|
|
50
|
+
"""Return list of required ESI scopes"""
|
|
51
|
+
return ESI_SCOPES_ALL
|