Initial release - Dune Awakening Dashboard beta
This commit is contained in:
commit
59cc98133c
51 files changed
+8428
No files matched your search
@@ -0,0 +1 @@
|
||||
"""Utils package"""
|
||||
@@ -0,0 +1,51 @@
|
||||
"""Simple TTL-based cache"""
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TTLCache:
|
||||
def __init__(self, ttl_seconds=60):
|
||||
self._data = None
|
||||
self._timestamp = 0
|
||||
self._ttl = ttl_seconds
|
||||
|
||||
def get(self):
|
||||
current_time = datetime.datetime.now().timestamp()
|
||||
if self._data and (current_time - self._timestamp) < self._ttl:
|
||||
return self._data
|
||||
return None
|
||||
|
||||
def set(self, data):
|
||||
self._data = data
|
||||
self._timestamp = datetime.datetime.now().timestamp()
|
||||
|
||||
def invalidate(self):
|
||||
self._data = None
|
||||
self._timestamp = 0
|
||||
|
||||
|
||||
class MultiCache:
|
||||
def __init__(self, ttl_seconds=60):
|
||||
self._cache = {}
|
||||
self._ttl = ttl_seconds
|
||||
|
||||
def get(self, key):
|
||||
entry = self._cache.get(key)
|
||||
if not entry:
|
||||
return None
|
||||
current_time = datetime.datetime.now().timestamp()
|
||||
if (current_time - entry['timestamp']) < self._ttl:
|
||||
return entry['data']
|
||||
return None
|
||||
|
||||
def set(self, key, data):
|
||||
self._cache[key] = {'data': data, 'timestamp': datetime.datetime.now().timestamp()}
|
||||
|
||||
def invalidate(self, key=None):
|
||||
if key:
|
||||
self._cache.pop(key, None)
|
||||
else:
|
||||
self._cache = {}
|
||||
@@ -0,0 +1,41 @@
|
||||
"""Shared data constants and helpers"""
|
||||
|
||||
INVENTORY_TYPE_LABELS = {
|
||||
0: 'Main Inventory',
|
||||
1: 'Equipped Items',
|
||||
5: 'Hotbar',
|
||||
12: 'Storage',
|
||||
14: 'Recipes',
|
||||
15: 'Key Items',
|
||||
20: 'Crafting Queue',
|
||||
25: 'Schematics',
|
||||
27: 'Emotes',
|
||||
29: 'Quest Items',
|
||||
30: 'Bank',
|
||||
31: 'Power Pack Slots',
|
||||
32: 'Module Slots',
|
||||
33: 'Augment Slots',
|
||||
}
|
||||
|
||||
CURRENCY_ID_LABELS = {
|
||||
0: 'Solari Credits',
|
||||
1: 'House Script',
|
||||
2: 'Spice',
|
||||
}
|
||||
|
||||
GUILD_ROLES = {100: 'Leader', 90: 'Officer', 80: 'Officer', 50: 'Member', 1: 'Member'}
|
||||
|
||||
NAV_PAGES = [
|
||||
('/', 'Overview'),
|
||||
('/server', 'Server'),
|
||||
('/director', 'Director'),
|
||||
('/shell', 'Shell'),
|
||||
('/files', 'Files'),
|
||||
('/events', 'Events'),
|
||||
('/chat', 'Chat'),
|
||||
('/players', 'Players'),
|
||||
('/vehicles', 'Vehicles'),
|
||||
('/guilds', 'Guilds'),
|
||||
('/buildings', 'Buildings'),
|
||||
('/admin', 'Admin'),
|
||||
]
|
||||
Reference in new issue
Block a user