Major refactor: unified launcher, paramiko SSH, DirectorService, diagnostics, and map warning banner
- Merge setup and start scripts into unified launcher (launcher.ps1 / start.sh) with menu: Start Dashboard, Run Setup, Run Diagnostics, Quit - Migrate SSHService from subprocess to paramiko for connection reuse - Extract Director API into dedicated DirectorService class - Centralize SSH key resolution in app/utils/ssh_key.py - Add pagination to player list (50 per page) - Add comprehensive diagnostics with port-forward troubleshooting guide - Add 17 new tests (43 total, all passing) - Fix Director page loading (point to local port-forward instead of remote IP) - Add experimental warning banner to map page with Dune-themed joke - Remove dead Flask-Talisman dependency, upgrade cryptography to >=42.0.0 - Fix PowerShell launcher parsing errors (Unicode chars, variable delimiters) - Update start.bat/setup.bat to point to unified launcher
This commit is contained in:
1 parent
9ddaa5f667
commit
1959a013ab
19 files changed
+2200
-844
No files matched your search
+37
-3
@@ -7,6 +7,39 @@ logger = logging.getLogger(__name__)
|
||||
LIKE_PC = '%DunePlayerCharacter_C'
|
||||
|
||||
|
||||
def _build_player_filters(search='', faction_id='', guild_id='', map_filter='', online_filter=''):
|
||||
"""Build WHERE clause and params for player queries.
|
||||
|
||||
Returns (where_clause, params) tuple.
|
||||
"""
|
||||
where = ["a.class LIKE %s"]
|
||||
params = [LIKE_PC]
|
||||
|
||||
if search:
|
||||
where.append("""(
|
||||
ps.character_name ILIKE %s
|
||||
OR acc.funcom_id ILIKE %s
|
||||
OR ea.user ILIKE %s
|
||||
OR a.properties::text ILIKE %s
|
||||
)""")
|
||||
params.extend([f'%{search}%'] * 4)
|
||||
if faction_id:
|
||||
where.append("pf.faction_id = %s")
|
||||
params.append(faction_id)
|
||||
if guild_id:
|
||||
where.append("gm.guild_id = %s")
|
||||
params.append(guild_id)
|
||||
if map_filter:
|
||||
where.append("a.map = %s")
|
||||
params.append(map_filter)
|
||||
if online_filter == 'online':
|
||||
where.append("ps.online_status::text = 'Online'")
|
||||
elif online_filter == 'offline':
|
||||
where.append("ps.online_status::text = 'Offline'")
|
||||
|
||||
return ' AND '.join(where), params
|
||||
|
||||
|
||||
class PlayerService:
|
||||
def __init__(self, db_service):
|
||||
self.db = db_service
|
||||
@@ -60,7 +93,8 @@ class PlayerService:
|
||||
ORDER BY ps.character_name
|
||||
""")
|
||||
|
||||
def get_players_list(self, search='', faction_id='', guild_id='', map_filter='', online_filter='', limit=200):
|
||||
def get_players_list(self, search='', faction_id='', guild_id='', map_filter='',
|
||||
online_filter='', limit=200, offset=0):
|
||||
where = ["a.class LIKE %s"]
|
||||
params = [LIKE_PC]
|
||||
|
||||
@@ -110,8 +144,8 @@ class PlayerService:
|
||||
LEFT JOIN dune.player_ips pi ON ps.player_controller_id = pi.player_id
|
||||
WHERE {where_clause}
|
||||
ORDER BY player_name
|
||||
LIMIT %s
|
||||
""", params + [limit])
|
||||
LIMIT %s OFFSET %s
|
||||
""", params + [limit, offset])
|
||||
|
||||
if not players:
|
||||
return []
|
||||
|
||||
Reference in new issue
Block a user