Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4ee1b85cf |
No files matched your search
+11
-12
@@ -24,6 +24,7 @@ from app.services.chat import ChatService
|
|||||||
from app.services.admin import AdminService
|
from app.services.admin import AdminService
|
||||||
from app.services.updater import UpdateService
|
from app.services.updater import UpdateService
|
||||||
from app.services.director import DirectorService
|
from app.services.director import DirectorService
|
||||||
|
from app.services.rmq import RmqService
|
||||||
from app.utils.cache import MultiCache
|
from app.utils.cache import MultiCache
|
||||||
from app.routes.main import register_routes
|
from app.routes.main import register_routes
|
||||||
from app.routes.api import register_api_routes
|
from app.routes.api import register_api_routes
|
||||||
@@ -45,6 +46,7 @@ def create_app(settings_path=None):
|
|||||||
app.config['SECRET_KEY'] = settings['dashboard']['secret_key']
|
app.config['SECRET_KEY'] = settings['dashboard']['secret_key']
|
||||||
app.config['SESSION_COOKIE_HTTPONLY'] = True
|
app.config['SESSION_COOKIE_HTTPONLY'] = True
|
||||||
app.config['SESSION_COOKIE_SAMESITE'] = 'Lax'
|
app.config['SESSION_COOKIE_SAMESITE'] = 'Lax'
|
||||||
|
app.config['PERMANENT_SESSION_LIFETIME'] = 28800 # 8 hours
|
||||||
app.config['WTF_CSRF_ENABLED'] = True
|
app.config['WTF_CSRF_ENABLED'] = True
|
||||||
app.config['WTF_CSRF_TIME_LIMIT'] = None
|
app.config['WTF_CSRF_TIME_LIMIT'] = None
|
||||||
|
|
||||||
@@ -58,7 +60,6 @@ def create_app(settings_path=None):
|
|||||||
and settings['dashboard']['ssl_key'] != 'null'
|
and settings['dashboard']['ssl_key'] != 'null'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Set SESSION_COOKIE_SECURE conditional on SSL being enabled
|
|
||||||
app.config['SESSION_COOKIE_SECURE'] = ssl_enabled
|
app.config['SESSION_COOKIE_SECURE'] = ssl_enabled
|
||||||
|
|
||||||
# Add security headers manually (replaces deprecated Flask-Talisman)
|
# Add security headers manually (replaces deprecated Flask-Talisman)
|
||||||
@@ -252,6 +253,13 @@ def create_app(settings_path=None):
|
|||||||
namespace=settings['kubernetes']['namespace'],
|
namespace=settings['kubernetes']['namespace'],
|
||||||
)
|
)
|
||||||
logging.debug(f"DirectorService initialized: port={settings.get('director', {}).get('port', 32479)}")
|
logging.debug(f"DirectorService initialized: port={settings.get('director', {}).get('port', 32479)}")
|
||||||
|
rmq_svc = RmqService(
|
||||||
|
admin_port=settings.get('rabbitmq', {}).get('admin_port', 30325),
|
||||||
|
game_port=settings.get('rabbitmq', {}).get('game_port', 32716),
|
||||||
|
username=settings.get('rabbitmq', {}).get('username', 'dashboard_admin'),
|
||||||
|
password=settings.get('rabbitmq', {}).get('password', ''),
|
||||||
|
)
|
||||||
|
logging.debug(f"RmqService initialized: admin=localhost:{settings.get('rabbitmq', {}).get('admin_port', 30325)} game=localhost:{settings.get('rabbitmq', {}).get('game_port', 32716)}")
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
'db': db_service,
|
'db': db_service,
|
||||||
@@ -265,6 +273,7 @@ def create_app(settings_path=None):
|
|||||||
'static_cache': static_cache,
|
'static_cache': static_cache,
|
||||||
'updater': updater_svc,
|
'updater': updater_svc,
|
||||||
'director': director_svc,
|
'director': director_svc,
|
||||||
|
'rmq': rmq_svc,
|
||||||
}
|
}
|
||||||
logging.debug(f"All services registered: {list(services.keys())}")
|
logging.debug(f"All services registered: {list(services.keys())}")
|
||||||
|
|
||||||
@@ -284,7 +293,7 @@ def create_app(settings_path=None):
|
|||||||
limiter = Limiter(
|
limiter = Limiter(
|
||||||
app=app,
|
app=app,
|
||||||
key_func=get_remote_address,
|
key_func=get_remote_address,
|
||||||
default_limits=[],
|
default_limits=["200 per day", "50 per hour"],
|
||||||
storage_uri="memory://",
|
storage_uri="memory://",
|
||||||
)
|
)
|
||||||
app.limiter = limiter
|
app.limiter = limiter
|
||||||
@@ -292,16 +301,6 @@ def create_app(settings_path=None):
|
|||||||
if settings['auth']['enabled']:
|
if settings['auth']['enabled']:
|
||||||
init_auth(app, settings, limiter, audit_svc)
|
init_auth(app, settings, limiter, audit_svc)
|
||||||
|
|
||||||
# Auto-login for SPA frontend — bypasses login page
|
|
||||||
from flask_login import login_user
|
|
||||||
from app.routes.auth import AdminUser
|
|
||||||
|
|
||||||
@app.before_request
|
|
||||||
def auto_login_dev():
|
|
||||||
if not current_user.is_authenticated:
|
|
||||||
cfg_user = str(settings.get("auth", {}).get("username", "dune"))
|
|
||||||
login_user(AdminUser(cfg_user))
|
|
||||||
|
|
||||||
register_routes(app, services, settings)
|
register_routes(app, services, settings)
|
||||||
register_api_routes(app, services, settings)
|
register_api_routes(app, services, settings)
|
||||||
register_websocket_handlers(socketio, settings)
|
register_websocket_handlers(socketio, settings)
|
||||||
|
|||||||
@@ -1732,6 +1732,118 @@ def register_api_routes(app, services, settings):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
return jsonify({'success': False, 'error': str(e)})
|
return jsonify({'success': False, 'error': str(e)})
|
||||||
|
|
||||||
|
# ── Admin Experimental: RMQ Explorer ─────────────────────────────
|
||||||
|
@app.route('/api/admin-experimental/rmq/overview')
|
||||||
|
@auth_req
|
||||||
|
def admin_rmq_overview():
|
||||||
|
try:
|
||||||
|
rmq = services.get('rmq')
|
||||||
|
if not rmq:
|
||||||
|
return jsonify({'success': False, 'error': 'RMQ service not available'}), 503
|
||||||
|
data = rmq.combined_overview()
|
||||||
|
return jsonify({'success': True, 'data': data})
|
||||||
|
except Exception as e:
|
||||||
|
return jsonify({'success': False, 'error': str(e)})
|
||||||
|
|
||||||
|
@app.route('/api/admin-experimental/rmq/queues')
|
||||||
|
@auth_req
|
||||||
|
def admin_rmq_queues():
|
||||||
|
try:
|
||||||
|
rmq = services.get('rmq')
|
||||||
|
if not rmq:
|
||||||
|
return jsonify({'success': False, 'error': 'RMQ service not available'}), 503
|
||||||
|
data = rmq.combined_queues()
|
||||||
|
return jsonify({'success': True, 'data': data})
|
||||||
|
except Exception as e:
|
||||||
|
return jsonify({'success': False, 'error': str(e)})
|
||||||
|
|
||||||
|
@app.route('/api/admin-experimental/rmq/exchanges')
|
||||||
|
@auth_req
|
||||||
|
def admin_rmq_exchanges():
|
||||||
|
try:
|
||||||
|
rmq = services.get('rmq')
|
||||||
|
if not rmq:
|
||||||
|
return jsonify({'success': False, 'error': 'RMQ service not available'}), 503
|
||||||
|
data = rmq.combined_exchanges()
|
||||||
|
return jsonify({'success': True, 'data': data})
|
||||||
|
except Exception as e:
|
||||||
|
return jsonify({'success': False, 'error': str(e)})
|
||||||
|
|
||||||
|
@app.route('/api/admin-experimental/rmq/bindings')
|
||||||
|
@auth_req
|
||||||
|
def admin_rmq_bindings():
|
||||||
|
try:
|
||||||
|
rmq = services.get('rmq')
|
||||||
|
if not rmq:
|
||||||
|
return jsonify({'success': False, 'error': 'RMQ service not available'}), 503
|
||||||
|
data = rmq.bindings()
|
||||||
|
return jsonify({'success': True, 'data': data})
|
||||||
|
except Exception as e:
|
||||||
|
return jsonify({'success': False, 'error': str(e)})
|
||||||
|
|
||||||
|
@app.route('/api/admin-experimental/rmq/consumers')
|
||||||
|
@auth_req
|
||||||
|
def admin_rmq_consumers():
|
||||||
|
try:
|
||||||
|
rmq = services.get('rmq')
|
||||||
|
if not rmq:
|
||||||
|
return jsonify({'success': False, 'error': 'RMQ service not available'}), 503
|
||||||
|
data = rmq.consumers()
|
||||||
|
return jsonify({'success': True, 'data': data})
|
||||||
|
except Exception as e:
|
||||||
|
return jsonify({'success': False, 'error': str(e)})
|
||||||
|
|
||||||
|
@app.route('/api/admin-experimental/rmq/peek', methods=['POST'])
|
||||||
|
@auth_req
|
||||||
|
def admin_rmq_peek():
|
||||||
|
try:
|
||||||
|
rmq = services.get('rmq')
|
||||||
|
if not rmq:
|
||||||
|
return jsonify({'success': False, 'error': 'RMQ service not available'}), 503
|
||||||
|
cfg = request.get_json() or {}
|
||||||
|
queue_name = cfg.get('queue', '')
|
||||||
|
count = int(cfg.get('count', 5))
|
||||||
|
if not queue_name:
|
||||||
|
return jsonify({'success': False, 'error': 'queue name required'}), 400
|
||||||
|
data = rmq.peek_messages(queue_name, count=count)
|
||||||
|
return jsonify({'success': True, 'data': data})
|
||||||
|
except Exception as e:
|
||||||
|
return jsonify({'success': False, 'error': str(e)})
|
||||||
|
|
||||||
|
@app.route('/api/admin-experimental/rmq/publish', methods=['POST'])
|
||||||
|
@auth_req
|
||||||
|
def admin_rmq_publish():
|
||||||
|
try:
|
||||||
|
rmq = services.get('rmq')
|
||||||
|
if not rmq:
|
||||||
|
return jsonify({'success': False, 'error': 'RMQ service not available'}), 503
|
||||||
|
cfg = request.get_json() or {}
|
||||||
|
exchange = cfg.get('exchange', '')
|
||||||
|
routing_key = cfg.get('routing_key', '')
|
||||||
|
message = cfg.get('message', '')
|
||||||
|
side = cfg.get('side', 'admin')
|
||||||
|
if not exchange:
|
||||||
|
return jsonify({'success': False, 'error': 'exchange name required'}), 400
|
||||||
|
if side == 'game':
|
||||||
|
result = rmq.game_publish(exchange, routing_key, message)
|
||||||
|
else:
|
||||||
|
result = rmq.publish(exchange, routing_key, message)
|
||||||
|
return jsonify({'success': True, 'data': result})
|
||||||
|
except Exception as e:
|
||||||
|
return jsonify({'success': False, 'error': str(e)})
|
||||||
|
|
||||||
|
@app.route('/api/admin-experimental/rmq/health')
|
||||||
|
@auth_req
|
||||||
|
def admin_rmq_health():
|
||||||
|
try:
|
||||||
|
rmq = services.get('rmq')
|
||||||
|
if not rmq:
|
||||||
|
return jsonify({'success': False, 'error': 'RMQ service not available'}), 503
|
||||||
|
data = rmq.health()
|
||||||
|
return jsonify({'success': True, 'data': data})
|
||||||
|
except Exception as e:
|
||||||
|
return jsonify({'success': False, 'error': str(e)})
|
||||||
|
|
||||||
# ── Admin Experimental: Function Explorer ─────────────────────────
|
# ── Admin Experimental: Function Explorer ─────────────────────────
|
||||||
@app.route('/api/admin-experimental/functions', methods=['GET'])
|
@app.route('/api/admin-experimental/functions', methods=['GET'])
|
||||||
@auth_req
|
@auth_req
|
||||||
|
|||||||
+36
-22
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
from flask import render_template, request, redirect, url_for, flash
|
from flask import render_template, request, redirect, url_for, flash, session, make_response
|
||||||
from flask_login import LoginManager, UserMixin, login_user, logout_user, login_required, current_user
|
from flask_login import LoginManager, UserMixin, login_user, logout_user, login_required, current_user
|
||||||
from flask_limiter import Limiter
|
from flask_limiter import Limiter
|
||||||
from flask_limiter.util import get_remote_address
|
from flask_limiter.util import get_remote_address
|
||||||
@@ -14,6 +14,15 @@ login_manager.login_message = 'Please log in.'
|
|||||||
# In-memory failed login tracker: {ip: {"count": int, "first_attempt": float}}
|
# In-memory failed login tracker: {ip: {"count": int, "first_attempt": float}}
|
||||||
_failed_attempts = {}
|
_failed_attempts = {}
|
||||||
_failed_lock = threading.Lock()
|
_failed_lock = threading.Lock()
|
||||||
|
|
||||||
|
# Reusable Argon2 verifier (created once, not per-request)
|
||||||
|
try:
|
||||||
|
from argon2 import PasswordHasher, exceptions as argon2_exceptions
|
||||||
|
_password_hasher = PasswordHasher(time_cost=3, memory_cost=65536)
|
||||||
|
except ImportError:
|
||||||
|
_password_hasher = None
|
||||||
|
argon2_exceptions = None
|
||||||
|
_failed_lock = threading.Lock()
|
||||||
_MAX_FAILED_ATTEMPTS = 5
|
_MAX_FAILED_ATTEMPTS = 5
|
||||||
_BLOCK_DURATION = 900 # 15 minutes
|
_BLOCK_DURATION = 900 # 15 minutes
|
||||||
|
|
||||||
@@ -82,39 +91,41 @@ def init_auth(app, settings, limiter=None, audit_svc=None):
|
|||||||
u = request.form.get('username', '')
|
u = request.form.get('username', '')
|
||||||
p = request.form.get('password', '')
|
p = request.form.get('password', '')
|
||||||
auth = settings.get('auth', {})
|
auth = settings.get('auth', {})
|
||||||
|
|
||||||
cfg_u = str(auth.get('username', ''))
|
cfg_u = str(auth.get('username', ''))
|
||||||
password_hash = auth.get('password_hash')
|
password_hash = auth.get('password_hash')
|
||||||
|
|
||||||
if u != cfg_u:
|
if not password_hash:
|
||||||
if audit_svc:
|
flash('Authentication not configured. Please run setup.')
|
||||||
audit_svc.log('login_failed', {'username': u, 'reason': 'invalid_username'}, user='unknown', severity='warning')
|
|
||||||
_record_failed_attempt(client_ip)
|
|
||||||
flash('Invalid username or password')
|
|
||||||
return render_template('login.html')
|
return render_template('login.html')
|
||||||
|
|
||||||
if password_hash:
|
|
||||||
try:
|
try:
|
||||||
from argon2 import PasswordHasher, exceptions
|
# Always run Argon2 verify regardless of username (prevents timing enumeration)
|
||||||
ph = PasswordHasher(time_cost=3, memory_cost=65536)
|
from argon2 import exceptions
|
||||||
if ph.verify(password_hash, p):
|
_DUMMY = '$argon2id$v=19$m=65536,t=3,p=4$AAAAAAAAAAAAAAAAAAAAAA$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
|
||||||
|
hash_to_verify = password_hash if u == cfg_u else _DUMMY
|
||||||
|
verified = _password_hasher.verify(hash_to_verify, p)
|
||||||
|
|
||||||
|
if verified and u == cfg_u:
|
||||||
_clear_failed_attempts(client_ip)
|
_clear_failed_attempts(client_ip)
|
||||||
login_user(AdminUser(u))
|
login_user(AdminUser(u))
|
||||||
if audit_svc:
|
if audit_svc:
|
||||||
audit_svc.log('login_success', {'username': u}, user=u, severity='info')
|
audit_svc.log('login_success', {'username': u}, user=u, severity='info')
|
||||||
return redirect(url_for('overview'))
|
return redirect(url_for('overview'))
|
||||||
else:
|
else:
|
||||||
if audit_svc:
|
# Dummy always fails; wrong password also fails here
|
||||||
|
_record_failed_attempt(client_ip)
|
||||||
|
if u == cfg_u and audit_svc:
|
||||||
audit_svc.log('login_failed', {'username': u, 'reason': 'invalid_password'}, user=u, severity='warning')
|
audit_svc.log('login_failed', {'username': u, 'reason': 'invalid_password'}, user=u, severity='warning')
|
||||||
except exceptions.VerifyMismatchError:
|
elif audit_svc:
|
||||||
if audit_svc:
|
audit_svc.log('login_failed', {'username': u, 'reason': 'invalid_credentials'}, user='unknown', severity='warning')
|
||||||
audit_svc.log('login_failed', {'username': u, 'reason': 'invalid_password'}, user=u, severity='warning')
|
flash('Invalid username or password')
|
||||||
pass
|
|
||||||
except Exception:
|
|
||||||
flash('Authentication error. Please try again.')
|
|
||||||
return render_template('login.html')
|
return render_template('login.html')
|
||||||
else:
|
except exceptions.VerifyMismatchError:
|
||||||
flash('Authentication not configured. Please run setup.')
|
_record_failed_attempt(client_ip)
|
||||||
|
flash('Invalid username or password')
|
||||||
|
return render_template('login.html')
|
||||||
|
except Exception as e:
|
||||||
|
flash('Authentication error. Please try again.')
|
||||||
return render_template('login.html')
|
return render_template('login.html')
|
||||||
|
|
||||||
_record_failed_attempt(client_ip)
|
_record_failed_attempt(client_ip)
|
||||||
@@ -123,10 +134,13 @@ def init_auth(app, settings, limiter=None, audit_svc=None):
|
|||||||
return render_template('login.html')
|
return render_template('login.html')
|
||||||
|
|
||||||
@app.route('/logout')
|
@app.route('/logout')
|
||||||
@login_required
|
|
||||||
def logout():
|
def logout():
|
||||||
user = current_user.id if current_user.is_authenticated else 'unknown'
|
user = current_user.id if current_user.is_authenticated else 'unknown'
|
||||||
logout_user()
|
logout_user()
|
||||||
|
session.clear()
|
||||||
if audit_svc:
|
if audit_svc:
|
||||||
audit_svc.log('logout', {}, user=user, severity='info')
|
audit_svc.log('logout', {}, user=user, severity='info')
|
||||||
return redirect(url_for('login'))
|
resp = make_response(redirect(url_for('login')))
|
||||||
|
resp.delete_cookie('session')
|
||||||
|
resp.delete_cookie('remember_token')
|
||||||
|
return resp
|
||||||
+47
-16
@@ -6,6 +6,7 @@ from flask import Blueprint, render_template, request, jsonify
|
|||||||
from flask_login import login_required, current_user
|
from flask_login import login_required, current_user
|
||||||
from app.utils.constants import NAV_PAGES, GUILD_ROLES
|
from app.utils.constants import NAV_PAGES, GUILD_ROLES
|
||||||
from app.utils.debug_logging import sanitize_for_log
|
from app.utils.debug_logging import sanitize_for_log
|
||||||
|
from app.services.player import LIKE_PC
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -326,20 +327,32 @@ def register_routes(app, services, settings):
|
|||||||
try:
|
try:
|
||||||
buildings_list = db.query("""
|
buildings_list = db.query("""
|
||||||
SELECT a.id, a.class, a.map, a.transform::text as transform_text,
|
SELECT a.id, a.class, a.map, a.transform::text as transform_text,
|
||||||
COALESCE(NULLIF(ps.character_name, ''), NULLIF(ea.platform_name, ''), 'ID:' || b.owner_id::text) as owner_name,
|
COALESCE(NULLIF(owner.character_name, ''), 'Base ' || b.id::text) as owner_name,
|
||||||
(SELECT COUNT(*)::int FROM dune.building_instances bi WHERE bi.building_id = b.id) as instance_count,
|
(SELECT COUNT(*)::int FROM dune.building_instances bi WHERE bi.building_id = b.id) as instance_count,
|
||||||
a.properties->>'m_bIsPowered' as is_powered,
|
a.properties->>'m_bIsPowered' as is_powered,
|
||||||
a.properties->>'m_PowerLevel' as power_level,
|
a.properties->>'m_PowerLevel' as power_level,
|
||||||
a.properties->'PowerComponent'->>'m_PowerGridID' as power_grid_id
|
a.properties->'PowerComponent'->>'m_PowerGridID' as power_grid_id
|
||||||
FROM dune.buildings b
|
FROM dune.buildings b
|
||||||
JOIN dune.actors a ON b.id = a.id
|
JOIN dune.actors a ON b.id = a.id
|
||||||
LEFT JOIN dune.player_state ps ON b.owner_id = ps.player_pawn_id
|
LEFT JOIN LATERAL (
|
||||||
LEFT JOIN dune.encrypted_accounts ea ON ea.id = (
|
SELECT DISTINCT afe_totem.actor_id as totem_actor_id
|
||||||
SELECT ps2.account_id FROM dune.player_state ps2 WHERE ps2.player_pawn_id = b.owner_id LIMIT 1
|
FROM dune.building_instances bi
|
||||||
)
|
JOIN dune.actor_fgl_entities afe_totem ON afe_totem.entity_id = bi.owner_entity_id
|
||||||
|
WHERE bi.building_id = b.id
|
||||||
|
LIMIT 1
|
||||||
|
) totem ON true
|
||||||
|
LEFT JOIN LATERAL (
|
||||||
|
SELECT ps.character_name
|
||||||
|
FROM dune.actors pawn
|
||||||
|
JOIN dune.player_state ps ON pawn.id = ps.player_pawn_id
|
||||||
|
WHERE pawn.id BETWEEN totem.totem_actor_id - 6 AND totem.totem_actor_id - 1
|
||||||
|
AND pawn.class LIKE %s
|
||||||
|
ORDER BY totem.totem_actor_id - pawn.id
|
||||||
|
LIMIT 1
|
||||||
|
) owner ON true
|
||||||
ORDER BY owner_name
|
ORDER BY owner_name
|
||||||
LIMIT 200
|
LIMIT 200
|
||||||
""") or []
|
""", [LIKE_PC]) or []
|
||||||
return render_template('buildings.html', buildings=buildings_list)
|
return render_template('buildings.html', buildings=buildings_list)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception("Error in buildings route")
|
logger.exception("Error in buildings route")
|
||||||
@@ -552,7 +565,7 @@ def register_routes(app, services, settings):
|
|||||||
name: cfg for name, cfg in map_config.items()
|
name: cfg for name, cfg in map_config.items()
|
||||||
if isinstance(cfg, dict) and cfg.get('image') and cfg.get('bounds')
|
if isinstance(cfg, dict) and cfg.get('image') and cfg.get('bounds')
|
||||||
}
|
}
|
||||||
default_map = map_config.get('default_map', 'DeepDesert')
|
default_map = map_config.get('default_map', 'HaggaBasin')
|
||||||
|
|
||||||
return map_config, configured_maps, default_map
|
return map_config, configured_maps, default_map
|
||||||
|
|
||||||
@@ -563,6 +576,7 @@ def register_routes(app, services, settings):
|
|||||||
map_options = []
|
map_options = []
|
||||||
for key, cfg in configured_maps.items():
|
for key, cfg in configured_maps.items():
|
||||||
image_size = cfg.get('image_size', {})
|
image_size = cfg.get('image_size', {})
|
||||||
|
bounds = cfg.get('bounds', {})
|
||||||
map_options.append({
|
map_options.append({
|
||||||
'key': key,
|
'key': key,
|
||||||
'label': cfg.get('label') or key,
|
'label': cfg.get('label') or key,
|
||||||
@@ -570,6 +584,7 @@ def register_routes(app, services, settings):
|
|||||||
'width': image_size.get('width', 1000),
|
'width': image_size.get('width', 1000),
|
||||||
'height': image_size.get('height', 1000),
|
'height': image_size.get('height', 1000),
|
||||||
'default_zoom': cfg.get('default_zoom', 0.5),
|
'default_zoom': cfg.get('default_zoom', 0.5),
|
||||||
|
'bounds': bounds,
|
||||||
'counts': {
|
'counts': {
|
||||||
'players': sum(1 for p in player_locations if p.get('map') == key and p.get('in_bounds')),
|
'players': sum(1 for p in player_locations if p.get('map') == key and p.get('in_bounds')),
|
||||||
'vehicles': sum(1 for v in vehicle_locations if v.get('map') == key and v.get('in_bounds')),
|
'vehicles': sum(1 for v in vehicle_locations if v.get('map') == key and v.get('in_bounds')),
|
||||||
@@ -597,27 +612,43 @@ def register_routes(app, services, settings):
|
|||||||
|
|
||||||
# Get vehicles with coordinates for configured map assets
|
# Get vehicles with coordinates for configured map assets
|
||||||
vehicles = db.query("""
|
vehicles = db.query("""
|
||||||
SELECT v.id, a.map, a.transform, a.class
|
SELECT DISTINCT ON (v.id)
|
||||||
|
v.id, a.map, a.transform, a.class,
|
||||||
|
COALESCE(NULLIF(ps.character_name, ''), 'Vehicle ' || v.id::text) as owner_name
|
||||||
FROM dune.vehicles v
|
FROM dune.vehicles v
|
||||||
JOIN dune.actors a ON v.id = a.id
|
JOIN dune.actors a ON v.id = a.id
|
||||||
|
LEFT JOIN dune.permission_actor_rank par ON par.permission_actor_id = v.id
|
||||||
|
LEFT JOIN dune.player_state ps ON par.player_id = ps.player_controller_id
|
||||||
WHERE a.transform IS NOT NULL AND a.map = ANY(%s)
|
WHERE a.transform IS NOT NULL AND a.map = ANY(%s)
|
||||||
ORDER BY a.map, a.class
|
ORDER BY v.id, par.rank ASC
|
||||||
""", [selected_map_keys]) or []
|
""", [selected_map_keys]) or []
|
||||||
|
|
||||||
# Get bases/buildings with coordinates for configured map assets
|
# Get bases/buildings with coordinates for configured map assets
|
||||||
buildings = db.query("""
|
buildings = db.query("""
|
||||||
SELECT b.id, a.map, a.transform, a.class,
|
SELECT b.id, a.map, a.transform, a.class,
|
||||||
COALESCE(NULLIF(ps.character_name, ''), NULLIF(ea.platform_name, ''), 'Base ' || b.id::text) as owner_name
|
COALESCE(NULLIF(owner.character_name, ''), 'Base ' || b.id::text) as owner_name
|
||||||
FROM dune.buildings b
|
FROM dune.buildings b
|
||||||
JOIN dune.actors a ON b.id = a.id
|
JOIN dune.actors a ON b.id = a.id
|
||||||
LEFT JOIN dune.player_state ps ON b.owner_id = ps.player_pawn_id
|
LEFT JOIN LATERAL (
|
||||||
LEFT JOIN dune.encrypted_accounts ea ON ea.id = (
|
SELECT DISTINCT afe_totem.actor_id as totem_actor_id
|
||||||
SELECT ps2.account_id FROM dune.player_state ps2 WHERE ps2.player_pawn_id = b.owner_id LIMIT 1
|
FROM dune.building_instances bi
|
||||||
)
|
JOIN dune.actor_fgl_entities afe_totem ON afe_totem.entity_id = bi.owner_entity_id
|
||||||
|
WHERE bi.building_id = b.id
|
||||||
|
LIMIT 1
|
||||||
|
) totem ON true
|
||||||
|
LEFT JOIN LATERAL (
|
||||||
|
SELECT ps.character_name
|
||||||
|
FROM dune.actors pawn
|
||||||
|
JOIN dune.player_state ps ON pawn.id = ps.player_pawn_id
|
||||||
|
WHERE pawn.id BETWEEN totem.totem_actor_id - 6 AND totem.totem_actor_id - 1
|
||||||
|
AND pawn.class LIKE %s
|
||||||
|
ORDER BY totem.totem_actor_id - pawn.id
|
||||||
|
LIMIT 1
|
||||||
|
) owner ON true
|
||||||
WHERE a.transform IS NOT NULL AND a.map = ANY(%s)
|
WHERE a.transform IS NOT NULL AND a.map = ANY(%s)
|
||||||
ORDER BY a.map
|
ORDER BY a.map
|
||||||
LIMIT 500
|
LIMIT 500
|
||||||
""", [selected_map_keys]) or []
|
""", [LIKE_PC, selected_map_keys]) or []
|
||||||
|
|
||||||
# Parse coordinates from transform field
|
# Parse coordinates from transform field
|
||||||
def parse_transform(t):
|
def parse_transform(t):
|
||||||
@@ -659,7 +690,7 @@ def register_routes(app, services, settings):
|
|||||||
if coords:
|
if coords:
|
||||||
vehicle_locations.append({
|
vehicle_locations.append({
|
||||||
'id': v['id'],
|
'id': v['id'],
|
||||||
'name': v.get('name', 'Unknown'),
|
'name': v.get('owner_name') or v.get('class', '').split('/')[-1] if v.get('class') else f'Vehicle {v["id"]}',
|
||||||
'map': v['map'],
|
'map': v['map'],
|
||||||
'class': v.get('class', '').split('/')[-1] if v.get('class') else '',
|
'class': v.get('class', '').split('/')[-1] if v.get('class') else '',
|
||||||
'x': coords['x'],
|
'x': coords['x'],
|
||||||
|
|||||||
+10
-5
@@ -798,17 +798,22 @@ class AdminService:
|
|||||||
try:
|
try:
|
||||||
import base64
|
import base64
|
||||||
import json as _json
|
import json as _json
|
||||||
title_json = _json.dumps(title)[1:-1]
|
import os
|
||||||
message_json = _json.dumps(message)[1:-1]
|
|
||||||
|
token = os.environ.get('DUNE_BROADCAST_TOKEN',
|
||||||
|
getattr(self, '_broadcast_token', None) or 'Nu6VmPWUMvdPMeB7qErr')
|
||||||
|
title_b64 = base64.b64encode(title.encode('utf-8')).decode()
|
||||||
|
message_b64 = base64.b64encode(message.encode('utf-8')).decode()
|
||||||
|
|
||||||
erl = (
|
erl = (
|
||||||
f'Title = unicode:characters_to_binary(<<"{title_json}">>, utf8), '
|
f'Title = base64:decode(<<"{title_b64}">>), '
|
||||||
f'Body = unicode:characters_to_binary(<<"{message_json}">>, utf8), '
|
f'Body = base64:decode(<<"{message_b64}">>), '
|
||||||
f'Duration = {duration}, '
|
f'Duration = {duration}, '
|
||||||
|
f'Token = <<"{token}">>, '
|
||||||
'EntryEn = #{<<"Key">> => <<"en">>, <<"Title">> => Title, <<"Body">> => Body}, '
|
'EntryEn = #{<<"Key">> => <<"en">>, <<"Title">> => Title, <<"Body">> => Body}, '
|
||||||
'EntryEnUs = #{<<"Key">> => <<"en-US">>, <<"Title">> => Title, <<"Body">> => Body}, '
|
'EntryEnUs = #{<<"Key">> => <<"en-US">>, <<"Title">> => Title, <<"Body">> => Body}, '
|
||||||
'Inner = iolist_to_binary(rabbit_json:encode(#{<<"ServerCommand">> => <<"ServiceBroadcast">>, <<"BroadcastType">> => <<"Generic">>, <<"BroadcastPayload">> => #{<<"BroadcastDuration">> => Duration, <<"LocalizedText">> => [EntryEn, EntryEnUs]}})), '
|
'Inner = iolist_to_binary(rabbit_json:encode(#{<<"ServerCommand">> => <<"ServiceBroadcast">>, <<"BroadcastType">> => <<"Generic">>, <<"BroadcastPayload">> => #{<<"BroadcastDuration">> => Duration, <<"LocalizedText">> => [EntryEn, EntryEnUs]}})), '
|
||||||
'Outer = iolist_to_binary(rabbit_json:encode(#{<<"Version">> => 2, <<"AuthToken">> => <<"Nu6VmPWUMvdPMeB7qErr">>, <<"MessageContent">> => Inner})), '
|
'Outer = iolist_to_binary(rabbit_json:encode(#{<<"Version">> => 2, <<"AuthToken">> => Token, <<"MessageContent">> => Inner})), '
|
||||||
'XName = rabbit_misc:r(<<"/">>, exchange, <<"heartbeats">>), '
|
'XName = rabbit_misc:r(<<"/">>, exchange, <<"heartbeats">>), '
|
||||||
'X = rabbit_exchange:lookup_or_die(XName), '
|
'X = rabbit_exchange:lookup_or_die(XName), '
|
||||||
'MsgId = list_to_binary("manual-service-broadcast-" ++ integer_to_list(erlang:system_time(millisecond))), '
|
'MsgId = list_to_binary("manual-service-broadcast-" ++ integer_to_list(erlang:system_time(millisecond))), '
|
||||||
|
|||||||
+17
-2
@@ -269,9 +269,24 @@ class PlayerService:
|
|||||||
(SELECT COUNT(*)::int FROM dune.building_instances bi WHERE bi.building_id = b.id) as instance_count
|
(SELECT COUNT(*)::int FROM dune.building_instances bi WHERE bi.building_id = b.id) as instance_count
|
||||||
FROM dune.buildings b
|
FROM dune.buildings b
|
||||||
JOIN dune.actors a ON b.id = a.id
|
JOIN dune.actors a ON b.id = a.id
|
||||||
WHERE b.owner_id = %s
|
JOIN LATERAL (
|
||||||
|
SELECT DISTINCT afe_totem.actor_id as totem_actor_id
|
||||||
|
FROM dune.building_instances bi
|
||||||
|
JOIN dune.actor_fgl_entities afe_totem ON afe_totem.entity_id = bi.owner_entity_id
|
||||||
|
WHERE bi.building_id = b.id
|
||||||
|
LIMIT 1
|
||||||
|
) totem ON true
|
||||||
|
JOIN LATERAL (
|
||||||
|
SELECT pawn.id as pawn_id
|
||||||
|
FROM dune.actors pawn
|
||||||
|
WHERE pawn.id BETWEEN totem.totem_actor_id - 6 AND totem.totem_actor_id - 1
|
||||||
|
AND pawn.class LIKE %s
|
||||||
|
ORDER BY totem.totem_actor_id - pawn.id
|
||||||
|
LIMIT 1
|
||||||
|
) owner ON true
|
||||||
|
WHERE owner.pawn_id = %s
|
||||||
ORDER BY a.map
|
ORDER BY a.map
|
||||||
""", [player_id]) or []
|
""", [LIKE_PC, player_id]) or []
|
||||||
except Exception:
|
except Exception:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,210 @@
|
|||||||
|
"""RMQ service - RabbitMQ Management HTTP API client."""
|
||||||
|
|
||||||
|
import json
|
||||||
|
import logging
|
||||||
|
import base64
|
||||||
|
import urllib.request
|
||||||
|
import urllib.error
|
||||||
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class RmqService:
|
||||||
|
"""RabbitMQ Management HTTP API client.
|
||||||
|
|
||||||
|
Communicates with RMQ Admin (port 30325) and RMQ Game (port 32716)
|
||||||
|
HTTP API endpoints via SSH tunnel (localhost).
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, admin_port: int = 30325, game_port: int = 32716,
|
||||||
|
username: str = 'dashboard_admin', password: str = ''):
|
||||||
|
self.admin_port = admin_port
|
||||||
|
self.game_port = game_port
|
||||||
|
self.username = username
|
||||||
|
self.password = password
|
||||||
|
self._auth = base64.b64encode(
|
||||||
|
f"{username}:{password}".encode()).decode()
|
||||||
|
logger.info("RmqService initialized: admin=localhost:%s game=localhost:%s",
|
||||||
|
admin_port, game_port)
|
||||||
|
|
||||||
|
def _request(self, port: int, path: str, method: str = 'GET',
|
||||||
|
body: Any = None, timeout: int = 15) -> Optional[Any]:
|
||||||
|
"""Execute an HTTP request against an RMQ API.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
port: Tunnel port (30325 for admin, 32716 for game).
|
||||||
|
path: API path (e.g., '/api/overview').
|
||||||
|
method: HTTP method.
|
||||||
|
body: Optional JSON-serializable request body.
|
||||||
|
timeout: Request timeout in seconds.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Parsed JSON response, or None on failure.
|
||||||
|
"""
|
||||||
|
url = f"http://127.0.0.1:{port}{path}"
|
||||||
|
headers = {
|
||||||
|
'Authorization': f'Basic {self._auth}',
|
||||||
|
}
|
||||||
|
if body is not None:
|
||||||
|
headers['Content-Type'] = 'application/json'
|
||||||
|
data = json.dumps(body).encode()
|
||||||
|
else:
|
||||||
|
data = None
|
||||||
|
|
||||||
|
req = urllib.request.Request(url, data=data, headers=headers)
|
||||||
|
|
||||||
|
if method != 'GET' and method != 'POST':
|
||||||
|
req.method = method
|
||||||
|
|
||||||
|
try:
|
||||||
|
with urllib.request.urlopen(req, timeout=timeout) as resp:
|
||||||
|
raw = resp.read().decode()
|
||||||
|
return json.loads(raw) if raw.strip() else {}
|
||||||
|
except urllib.error.HTTPError as e:
|
||||||
|
logger.warning("RMQ HTTP %s %s -> %s: %s", method, url, e.code,
|
||||||
|
e.read().decode()[:200] if e.fp else '')
|
||||||
|
return None
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning("RMQ request error %s %s: %s", method, url, e)
|
||||||
|
return None
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _encode_vhost(vhost: str = '/') -> str:
|
||||||
|
return vhost.replace('/', '%2F')
|
||||||
|
|
||||||
|
# ── Admin API (port 30325) ───────────────────────────────────────
|
||||||
|
|
||||||
|
def overview(self) -> Optional[Dict]:
|
||||||
|
"""Cluster overview: node info, message stats, queue totals."""
|
||||||
|
return self._request(self.admin_port, '/api/overview')
|
||||||
|
|
||||||
|
def nodes(self) -> Optional[List]:
|
||||||
|
"""List nodes with memory and disk info."""
|
||||||
|
return self._request(self.admin_port, '/api/nodes')
|
||||||
|
|
||||||
|
def exchanges(self) -> Optional[List]:
|
||||||
|
"""List all exchanges with message stats."""
|
||||||
|
return self._request(self.admin_port, '/api/exchanges')
|
||||||
|
|
||||||
|
def queues(self) -> Optional[List]:
|
||||||
|
"""List all queues with consumer counts and message depths."""
|
||||||
|
return self._request(self.admin_port, '/api/queues')
|
||||||
|
|
||||||
|
def bindings(self) -> Optional[List]:
|
||||||
|
"""List all bindings (source -> destination mappings)."""
|
||||||
|
return self._request(self.admin_port, '/api/bindings')
|
||||||
|
|
||||||
|
def consumers(self) -> Optional[List]:
|
||||||
|
"""List active consumers."""
|
||||||
|
return self._request(self.admin_port, '/api/consumers')
|
||||||
|
|
||||||
|
def connections(self) -> Optional[List]:
|
||||||
|
"""List active AMQP connections."""
|
||||||
|
return self._request(self.admin_port, '/api/connections')
|
||||||
|
|
||||||
|
def channels(self) -> Optional[List]:
|
||||||
|
"""List active channels."""
|
||||||
|
return self._request(self.admin_port, '/api/channels')
|
||||||
|
|
||||||
|
def health(self) -> Optional[Dict]:
|
||||||
|
"""Cluster health and alarm status."""
|
||||||
|
return self._request(self.admin_port,
|
||||||
|
'/api/health/checks/alarms')
|
||||||
|
|
||||||
|
def peek_messages(self, queue_name: str, vhost: str = '/',
|
||||||
|
count: int = 5) -> Optional[List]:
|
||||||
|
"""Peek at messages in a queue without consuming them."""
|
||||||
|
vh = self._encode_vhost(vhost)
|
||||||
|
body = {
|
||||||
|
'count': count,
|
||||||
|
'ackmode': 'ack_requeue_true',
|
||||||
|
'encoding': 'auto',
|
||||||
|
}
|
||||||
|
return self._request(self.admin_port,
|
||||||
|
f'/api/queues/{vh}/{queue_name}/get',
|
||||||
|
method='POST', body=body)
|
||||||
|
|
||||||
|
def publish(self, exchange: str, routing_key: str, message: Any,
|
||||||
|
vhost: str = '/') -> Optional[Dict]:
|
||||||
|
"""Publish a message to an exchange.
|
||||||
|
|
||||||
|
NOTE: RMQ HTTP API sets user_id to the authenticated username,
|
||||||
|
which the game server may reject. For ServerCommands on the
|
||||||
|
game RPC exchange, use the Erlang eval approach instead.
|
||||||
|
"""
|
||||||
|
vh = self._encode_vhost(vhost)
|
||||||
|
body = {
|
||||||
|
'properties': {},
|
||||||
|
'routing_key': routing_key,
|
||||||
|
'payload': json.dumps(message) if not isinstance(message, str)
|
||||||
|
else message,
|
||||||
|
'payload_encoding': 'string',
|
||||||
|
}
|
||||||
|
return self._request(self.admin_port,
|
||||||
|
f'/api/exchanges/{vh}/{exchange}/publish',
|
||||||
|
method='POST', body=body)
|
||||||
|
|
||||||
|
def get_queue_bindings(self, queue_name: str,
|
||||||
|
vhost: str = '/') -> Optional[List]:
|
||||||
|
vh = self._encode_vhost(vhost)
|
||||||
|
return self._request(self.admin_port,
|
||||||
|
f'/api/queues/{vh}/{queue_name}/bindings')
|
||||||
|
|
||||||
|
def get_exchange_bindings(self, exchange: str,
|
||||||
|
vhost: str = '/') -> Optional[List]:
|
||||||
|
vh = self._encode_vhost(vhost)
|
||||||
|
return self._request(self.admin_port,
|
||||||
|
f'/api/exchanges/{vh}/{exchange}/bindings/source')
|
||||||
|
|
||||||
|
# ── Game API (port 32716) ────────────────────────────────────────
|
||||||
|
|
||||||
|
def game_overview(self) -> Optional[Dict]:
|
||||||
|
"""Game RMQ cluster overview."""
|
||||||
|
return self._request(self.game_port, '/api/overview')
|
||||||
|
|
||||||
|
def game_queues(self) -> Optional[List]:
|
||||||
|
"""Game RMQ queues."""
|
||||||
|
return self._request(self.game_port, '/api/queues')
|
||||||
|
|
||||||
|
def game_exchanges(self) -> Optional[List]:
|
||||||
|
"""Game RMQ exchanges."""
|
||||||
|
return self._request(self.game_port, '/api/exchanges')
|
||||||
|
|
||||||
|
def game_publish(self, exchange: str, routing_key: str,
|
||||||
|
message: Any, vhost: str = '/') -> Optional[Dict]:
|
||||||
|
"""Publish a message to the game RMQ."""
|
||||||
|
vh = self._encode_vhost(vhost)
|
||||||
|
body = {
|
||||||
|
'properties': {},
|
||||||
|
'routing_key': routing_key,
|
||||||
|
'payload': json.dumps(message) if not isinstance(message, str)
|
||||||
|
else message,
|
||||||
|
'payload_encoding': 'string',
|
||||||
|
}
|
||||||
|
return self._request(self.game_port,
|
||||||
|
f'/api/exchanges/{vh}/{exchange}/publish',
|
||||||
|
method='POST', body=body)
|
||||||
|
|
||||||
|
# ── Combined / convenience ───────────────────────────────────────
|
||||||
|
|
||||||
|
def combined_overview(self) -> Dict[str, Any]:
|
||||||
|
"""Get overview from both RMQ instances."""
|
||||||
|
return {
|
||||||
|
'admin': self.overview(),
|
||||||
|
'game': self.game_overview(),
|
||||||
|
}
|
||||||
|
|
||||||
|
def combined_queues(self) -> Dict[str, Any]:
|
||||||
|
"""Get queues from both RMQ instances."""
|
||||||
|
return {
|
||||||
|
'admin': self.queues(),
|
||||||
|
'game': self.game_queues(),
|
||||||
|
}
|
||||||
|
|
||||||
|
def combined_exchanges(self) -> Dict[str, Any]:
|
||||||
|
"""Get exchanges from both RMQ instances."""
|
||||||
|
return {
|
||||||
|
'admin': self.exchanges(),
|
||||||
|
'game': self.game_exchanges(),
|
||||||
|
}
|
||||||
@@ -81,5 +81,5 @@ NAV_PAGES = [
|
|||||||
('/guilds', 'Guilds'),
|
('/guilds', 'Guilds'),
|
||||||
('/buildings', 'Buildings'),
|
('/buildings', 'Buildings'),
|
||||||
('/map', 'Map'),
|
('/map', 'Map'),
|
||||||
('/admin-experimental', 'Admin Experimental'),
|
('/admin-experimental', 'Experimental'),
|
||||||
]
|
]
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
@@ -93,7 +94,7 @@ class RmqGameService:
|
|||||||
}
|
}
|
||||||
body = {
|
body = {
|
||||||
"Version": 2,
|
"Version": 2,
|
||||||
"AuthToken": "Nu6VmPWUMvdPMeB7qErr",
|
"AuthToken": os.environ.get("DUNE_BROADCAST_TOKEN", "Nu6VmPWUMvdPMeB7qErr"),
|
||||||
"MessageContent": inner,
|
"MessageContent": inner,
|
||||||
}
|
}
|
||||||
return self.publish(
|
return self.publish(
|
||||||
|
|||||||
+39
-6
@@ -2069,6 +2069,10 @@ function Start-Dashboard {
|
|||||||
$Namespace = $settings.kubernetes.namespace
|
$Namespace = $settings.kubernetes.namespace
|
||||||
$DashboardPort = [int]$settings.dashboard.port
|
$DashboardPort = [int]$settings.dashboard.port
|
||||||
$DirectorPort = [int]$settings.director.port
|
$DirectorPort = [int]$settings.director.port
|
||||||
|
$RmqAdminPort = [int]($settings.rabbitmq | ForEach-Object { $_.admin_port })
|
||||||
|
if (-not $RmqAdminPort) { $RmqAdminPort = 30325 }
|
||||||
|
$RmqGamePort = [int]($settings.rabbitmq | ForEach-Object { $_.game_port })
|
||||||
|
if (-not $RmqGamePort) { $RmqGamePort = 32716 }
|
||||||
|
|
||||||
# Register sensitive values for log sanitization
|
# Register sensitive values for log sanitization
|
||||||
Register-SensitiveValue -Key "ServerIP" -Value $ServerHost
|
Register-SensitiveValue -Key "ServerIP" -Value $ServerHost
|
||||||
@@ -2173,13 +2177,19 @@ function Start-Dashboard {
|
|||||||
Write-Log -Message "Namespace: $Namespace" -Category "k8s"
|
Write-Log -Message "Namespace: $Namespace" -Category "k8s"
|
||||||
|
|
||||||
# Kill existing SSH tunnels on the DB/Director ports
|
# Kill existing SSH tunnels on the DB/Director ports
|
||||||
Write-Log -Message "Cleaning up existing SSH tunnels on ports $LocalPort and $DirectorPort" -Category "ssh"
|
Write-Log -Message "Cleaning up existing SSH tunnels on ports $LocalPort, $DirectorPort, $RmqAdminPort, $RmqGamePort" -Category "ssh"
|
||||||
Get-NetTCPConnection -LocalPort $LocalPort -ErrorAction SilentlyContinue | ForEach-Object {
|
Get-NetTCPConnection -LocalPort $LocalPort -ErrorAction SilentlyContinue | ForEach-Object {
|
||||||
Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue | Where-Object { $_.ProcessName -eq 'ssh' } | Stop-Process -Force -ErrorAction SilentlyContinue
|
Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue | Where-Object { $_.ProcessName -eq 'ssh' } | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
Get-NetTCPConnection -LocalPort $DirectorPort -ErrorAction SilentlyContinue | ForEach-Object {
|
Get-NetTCPConnection -LocalPort $DirectorPort -ErrorAction SilentlyContinue | ForEach-Object {
|
||||||
Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue | Where-Object { $_.ProcessName -eq 'ssh' } | Stop-Process -Force -ErrorAction SilentlyContinue
|
Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue | Where-Object { $_.ProcessName -eq 'ssh' } | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
|
Get-NetTCPConnection -LocalPort $RmqAdminPort -ErrorAction SilentlyContinue | ForEach-Object {
|
||||||
|
Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue | Where-Object { $_.ProcessName -eq 'ssh' } | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
Get-NetTCPConnection -LocalPort $RmqGamePort -ErrorAction SilentlyContinue | ForEach-Object {
|
||||||
|
Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue | Where-Object { $_.ProcessName -eq 'ssh' } | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
Start-Sleep 1
|
Start-Sleep 1
|
||||||
|
|
||||||
# [1/4] SSH Tunnel
|
# [1/4] SSH Tunnel
|
||||||
@@ -2193,6 +2203,8 @@ function Start-Dashboard {
|
|||||||
"-o", "ServerAliveCountMax=3",
|
"-o", "ServerAliveCountMax=3",
|
||||||
"-L", "${LocalPort}:localhost:${LocalPort}",
|
"-L", "${LocalPort}:localhost:${LocalPort}",
|
||||||
"-L", "${DirectorPort}:localhost:${DirectorPort}",
|
"-L", "${DirectorPort}:localhost:${DirectorPort}",
|
||||||
|
"-L", "${RmqAdminPort}:localhost:${RmqAdminPort}",
|
||||||
|
"-L", "${RmqGamePort}:localhost:${RmqGamePort}",
|
||||||
"-N", "${SSHUser}@${ServerHost}"
|
"-N", "${SSHUser}@${ServerHost}"
|
||||||
)
|
)
|
||||||
$sshTunnel = Start-Process ssh -ArgumentList $sshArgs -PassThru -WindowStyle Hidden
|
$sshTunnel = Start-Process ssh -ArgumentList $sshArgs -PassThru -WindowStyle Hidden
|
||||||
@@ -2237,7 +2249,7 @@ function Start-Dashboard {
|
|||||||
Stop-Process -Id $sshTunnel.Id -Force -ErrorAction SilentlyContinue
|
Stop-Process -Id $sshTunnel.Id -Force -ErrorAction SilentlyContinue
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Write-Host "[OK] SSH tunnel up on localhost:$LocalPort (DB), localhost:$DirectorPort (Director)" -ForegroundColor Green
|
Write-Host "[OK] SSH tunnel up on localhost:$LocalPort (DB), localhost:$DirectorPort (Director), localhost:$RmqAdminPort (RMQ Admin), localhost:$RmqGamePort (RMQ Game)" -ForegroundColor Green
|
||||||
Write-Log -Message "SSH tunnel connected successfully" -Category "ssh"
|
Write-Log -Message "SSH tunnel connected successfully" -Category "ssh"
|
||||||
|
|
||||||
# [2/4] DB Port-Forward
|
# [2/4] DB Port-Forward
|
||||||
@@ -2449,7 +2461,7 @@ function Start-Dashboard {
|
|||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "Stopping tunnels..." -ForegroundColor Cyan
|
Write-Host "Stopping tunnels..." -ForegroundColor Cyan
|
||||||
Stop-Process -Id $sshTunnel.Id -Force -ErrorAction SilentlyContinue
|
Stop-Process -Id $sshTunnel.Id -Force -ErrorAction SilentlyContinue
|
||||||
$pkillCmd = 'ssh -i "' + $SSHKey + '" -o StrictHostKeyChecking=accept-new ' + $SSHUser + '@' + $ServerHost + ' "sudo fuser -k 15433/tcp 32479/tcp 2>/dev/null"'
|
$pkillCmd = 'ssh -i "' + $SSHKey + '" -o StrictHostKeyChecking=accept-new ' + $SSHUser + '@' + $ServerHost + ' "sudo fuser -k 15433/tcp 32479/tcp 30325/tcp 32716/tcp 2>/dev/null"'
|
||||||
cmd /c $pkillCmd 2>$null
|
cmd /c $pkillCmd 2>$null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2600,6 +2612,10 @@ function Start-NewDashboard {
|
|||||||
$Namespace = $settings.kubernetes.namespace
|
$Namespace = $settings.kubernetes.namespace
|
||||||
$DashboardPort = [int]$settings.dashboard.port
|
$DashboardPort = [int]$settings.dashboard.port
|
||||||
$DirectorPort = [int]$settings.director.port
|
$DirectorPort = [int]$settings.director.port
|
||||||
|
$RmqAdminPort = [int]($settings.rabbitmq | ForEach-Object { $_.admin_port })
|
||||||
|
if (-not $RmqAdminPort) { $RmqAdminPort = 30325 }
|
||||||
|
$RmqGamePort = [int]($settings.rabbitmq | ForEach-Object { $_.game_port })
|
||||||
|
if (-not $RmqGamePort) { $RmqGamePort = 32716 }
|
||||||
|
|
||||||
Register-SensitiveValue -Key "ServerIP" -Value $ServerHost
|
Register-SensitiveValue -Key "ServerIP" -Value $ServerHost
|
||||||
Register-SensitiveValue -Key "Namespace" -Value $Namespace
|
Register-SensitiveValue -Key "Namespace" -Value $Namespace
|
||||||
@@ -2678,6 +2694,21 @@ function Start-NewDashboard {
|
|||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
# ── SSH Tunnel ────────────────────────────────────────────────────────
|
# ── SSH Tunnel ────────────────────────────────────────────────────────
|
||||||
|
Write-Log -Message "Cleaning up existing SSH tunnels on ports $LocalPort, $DirectorPort, $RmqAdminPort, $RmqGamePort" -Category "ssh"
|
||||||
|
Get-NetTCPConnection -LocalPort $LocalPort -ErrorAction SilentlyContinue | ForEach-Object {
|
||||||
|
Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue | Where-Object { $_.ProcessName -eq 'ssh' } | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
Get-NetTCPConnection -LocalPort $DirectorPort -ErrorAction SilentlyContinue | ForEach-Object {
|
||||||
|
Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue | Where-Object { $_.ProcessName -eq 'ssh' } | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
Get-NetTCPConnection -LocalPort $RmqAdminPort -ErrorAction SilentlyContinue | ForEach-Object {
|
||||||
|
Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue | Where-Object { $_.ProcessName -eq 'ssh' } | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
Get-NetTCPConnection -LocalPort $RmqGamePort -ErrorAction SilentlyContinue | ForEach-Object {
|
||||||
|
Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue | Where-Object { $_.ProcessName -eq 'ssh' } | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
Start-Sleep 1
|
||||||
|
|
||||||
Write-Host "[1/5] Starting SSH tunnel (localhost:$LocalPort -> VM)..." -ForegroundColor Yellow
|
Write-Host "[1/5] Starting SSH tunnel (localhost:$LocalPort -> VM)..." -ForegroundColor Yellow
|
||||||
|
|
||||||
Get-NetTCPConnection -LocalPort $LocalPort -ErrorAction SilentlyContinue | ForEach-Object {
|
Get-NetTCPConnection -LocalPort $LocalPort -ErrorAction SilentlyContinue | ForEach-Object {
|
||||||
@@ -2695,6 +2726,8 @@ function Start-NewDashboard {
|
|||||||
"-o", "ServerAliveCountMax=3",
|
"-o", "ServerAliveCountMax=3",
|
||||||
"-L", "${LocalPort}:localhost:${LocalPort}",
|
"-L", "${LocalPort}:localhost:${LocalPort}",
|
||||||
"-L", "${DirectorPort}:localhost:${DirectorPort}",
|
"-L", "${DirectorPort}:localhost:${DirectorPort}",
|
||||||
|
"-L", "${RmqAdminPort}:localhost:${RmqAdminPort}",
|
||||||
|
"-L", "${RmqGamePort}:localhost:${RmqGamePort}",
|
||||||
"-N", "${SSHUser}@${ServerHost}"
|
"-N", "${SSHUser}@${ServerHost}"
|
||||||
)
|
)
|
||||||
$sshTunnel = Start-Process ssh -ArgumentList $sshArgs -PassThru -WindowStyle Hidden
|
$sshTunnel = Start-Process ssh -ArgumentList $sshArgs -PassThru -WindowStyle Hidden
|
||||||
@@ -2720,7 +2753,7 @@ function Start-NewDashboard {
|
|||||||
Stop-Process -Id $sshTunnel.Id -Force -ErrorAction SilentlyContinue
|
Stop-Process -Id $sshTunnel.Id -Force -ErrorAction SilentlyContinue
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Write-Host "[OK] SSH tunnel up on localhost:$LocalPort" -ForegroundColor Green
|
Write-Host "[OK] SSH tunnel up on localhost:$LocalPort (DB), localhost:$DirectorPort (Director), localhost:$RmqAdminPort (RMQ Admin), localhost:$RmqGamePort (RMQ Game)" -ForegroundColor Green
|
||||||
|
|
||||||
# ── DB Port-Forward ───────────────────────────────────────────────────
|
# ── DB Port-Forward ───────────────────────────────────────────────────
|
||||||
Write-Host "[2/5] Starting DB port-forward on VM..." -ForegroundColor Yellow
|
Write-Host "[2/5] Starting DB port-forward on VM..." -ForegroundColor Yellow
|
||||||
@@ -2739,7 +2772,7 @@ function Start-NewDashboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$RemotePort = 15432
|
$RemotePort = 15432
|
||||||
ssh -i $SSHKey -o StrictHostKeyChecking=accept-new -o ConnectTimeout=10 ${SSHUser}@${ServerHost} "sudo fuser -k ${LocalPort}/tcp ${DirectorPort}/tcp 2>/dev/null; sleep 1" 2>$null
|
ssh -i $SSHKey -o StrictHostKeyChecking=accept-new -o ConnectTimeout=10 ${SSHUser}@${ServerHost} "sudo fuser -k ${LocalPort}/tcp ${DirectorPort}/tcp ${RmqAdminPort}/tcp ${RmqGamePort}/tcp 2>/dev/null; sleep 1" 2>$null
|
||||||
$pfCmd = "nohup sudo kubectl port-forward -n $Namespace svc/$DBService $LocalPort`:$RemotePort > /tmp/pf.log 2>`&1 `"&`""
|
$pfCmd = "nohup sudo kubectl port-forward -n $Namespace svc/$DBService $LocalPort`:$RemotePort > /tmp/pf.log 2>`&1 `"&`""
|
||||||
ssh -i $SSHKey -o StrictHostKeyChecking=accept-new -o ServerAliveInterval=30 "${SSHUser}@${ServerHost}" $pfCmd 2>$null
|
ssh -i $SSHKey -o StrictHostKeyChecking=accept-new -o ServerAliveInterval=30 "${SSHUser}@${ServerHost}" $pfCmd 2>$null
|
||||||
Start-Sleep -Seconds 2
|
Start-Sleep -Seconds 2
|
||||||
@@ -2883,7 +2916,7 @@ function Start-NewDashboard {
|
|||||||
Stop-Process -Id $frontendProcess.Id -Force -ErrorAction SilentlyContinue
|
Stop-Process -Id $frontendProcess.Id -Force -ErrorAction SilentlyContinue
|
||||||
Stop-Process -Id $backendProcess.Id -Force -ErrorAction SilentlyContinue
|
Stop-Process -Id $backendProcess.Id -Force -ErrorAction SilentlyContinue
|
||||||
Stop-Process -Id $sshTunnel.Id -Force -ErrorAction SilentlyContinue
|
Stop-Process -Id $sshTunnel.Id -Force -ErrorAction SilentlyContinue
|
||||||
$pkillCmd = 'ssh -i "' + $SSHKey + '" -o StrictHostKeyChecking=accept-new ' + $SSHUser + '@' + $ServerHost + ' "sudo fuser -k ' + $LocalPort + '/tcp ' + $DirectorPort + '/tcp 2>/dev/null"'
|
$pkillCmd = 'ssh -i "' + $SSHKey + '" -o StrictHostKeyChecking=accept-new ' + $SSHUser + '@' + $ServerHost + ' "sudo fuser -k ' + $LocalPort + '/tcp ' + $DirectorPort + '/tcp ' + $RmqAdminPort + '/tcp ' + $RmqGamePort + '/tcp 2>/dev/null"'
|
||||||
cmd /c $pkillCmd 2>$null
|
cmd /c $pkillCmd 2>$null
|
||||||
Write-Host " All services stopped." -ForegroundColor Green
|
Write-Host " All services stopped." -ForegroundColor Green
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|||||||
+2
-1
@@ -224,7 +224,8 @@ table {
|
|||||||
}
|
}
|
||||||
|
|
||||||
thead th {
|
thead th {
|
||||||
background: #f8f6f2;
|
background: var(--table-header);
|
||||||
|
color: var(--text);
|
||||||
padding: 10px 14px;
|
padding: 10px 14px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
|||||||
+88
-27
@@ -322,6 +322,24 @@
|
|||||||
--code-bg: #fafaf5;
|
--code-bg: #fafaf5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ===== Dark Variants (for light themes) ===== */
|
||||||
|
[data-theme="default-dark"] { --primary:#c9a24e; --primary-dark:#a8862e; --primary-light:#e0c97a; --bg:#1a1a1e; --card-bg:#252528; --text:#e0e0e0; --text-light:#a0a0a0; --text-muted:#707070; --border:#333; --accent:#c9a24e; --danger:#c0392b; --success:#27ae60; --nav-bg:#0d0d12; --nav-text:#c0c0c0; --nav-active:#c9a24e; --hover:#2a2a2e; --shadow:0 2px 8px rgba(0,0,0,0.35); --table-header:#2a2a2e; --code-bg:#1e1e22; }
|
||||||
|
[data-theme="atreides-dark"] { --primary:#2d5a27; --primary-dark:#1e3d19; --primary-light:#4a8c42; --bg:#1a1e1a; --card-bg:#252825; --text:#e0e0e0; --text-light:#a0a0a0; --text-muted:#707070; --border:#333; --accent:#3d7a37; --danger:#cc4422; --success:#4a8c42; --nav-bg:#0d120d; --nav-text:#c0c0c0; --nav-active:#6abf6a; --hover:#2a2e2a; --shadow:0 2px 8px rgba(0,0,0,0.35); --table-header:#2a2e2a; --code-bg:#1e221e; }
|
||||||
|
[data-theme="fremen-dark"] { --primary:#d4a853; --primary-dark:#b8913f; --primary-light:#e8c87a; --bg:#1e1a15; --card-bg:#282420; --text:#e0d8c8; --text-light:#a09888; --text-muted:#707058; --border:#38332a; --accent:#d4a853; --danger:#c45030; --success:#6b8e23; --nav-bg:#100c08; --nav-text:#c0b8a8; --nav-active:#d4a853; --hover:#2a2520; --shadow:0 2px 8px rgba(0,0,0,0.35); --table-header:#2a2520; --code-bg:#1e1c18; }
|
||||||
|
[data-theme="bene-gesserit-dark"] { --primary:#a8a8a8; --primary-dark:#888; --primary-light:#c8c8c8; --bg:#1a1a1c; --card-bg:#252528; --text:#e0e0e0; --text-light:#a0a0a0; --text-muted:#707070; --border:#333; --accent:#888; --danger:#c41e3a; --success:#2e8b57; --nav-bg:#0d0d0e; --nav-text:#c0c0c0; --nav-active:#ccc; --hover:#2a2a2c; --shadow:0 2px 8px rgba(0,0,0,0.35); --table-header:#2a2a2c; --code-bg:#1e1e20; }
|
||||||
|
[data-theme="corrino-dark"] { --primary:#b02020; --primary-dark:#8b0000; --primary-light:#d44040; --bg:#1e1a1a; --card-bg:#282525; --text:#e0d8d8; --text-light:#a09090; --text-muted:#705858; --border:#383333; --accent:#c43030; --danger:#c0392b; --success:#27ae60; --nav-bg:#120d0d; --nav-text:#c0b8b8; --nav-active:#ff6b6b; --hover:#2e2a2a; --shadow:0 2px 8px rgba(0,0,0,0.35); --table-header:#2e2a2a; --code-bg:#221e1e; }
|
||||||
|
[data-theme="mentat-dark"] { --primary:#008b8b; --primary-dark:#006666; --primary-light:#20b2aa; --bg:#1a1e1e; --card-bg:#252828; --text:#e0e0e0; --text-light:#a0a0a0; --text-muted:#707070; --border:#333; --accent:#008b8b; --danger:#c44569; --success:#20b2aa; --nav-bg:#0d1212; --nav-text:#c0c0c0; --nav-active:#00ced1; --hover:#2a2e2e; --shadow:0 2px 8px rgba(0,0,0,0.35); --table-header:#2a2e2e; --code-bg:#1e2222; }
|
||||||
|
[data-theme="sardaukar-dark"] { --primary:#cd853f; --primary-dark:#a0522d; --primary-light:#deb887; --bg:#1e1a15; --card-bg:#282420; --text:#e0d8c8; --text-light:#a09888; --text-muted:#707058; --border:#38332a; --accent:#cd853f; --danger:#cc4422; --success:#6b8e23; --nav-bg:#100c08; --nav-text:#c0b8a8; --nav-active:#cd853f; --hover:#2a2520; --shadow:0 2px 8px rgba(0,0,0,0.35); --table-header:#2a2520; --code-bg:#1e1c18; }
|
||||||
|
[data-theme="ordos-dark"] { --primary:#2e8b57; --primary-dark:#1c5c3a; --primary-light:#3cb371; --bg:#1a1e1c; --card-bg:#252825; --text:#e0e0d8; --text-light:#a0a090; --text-muted:#707060; --border:#333a33; --accent:#3cb371; --danger:#cc5c3a; --success:#3cb371; --nav-bg:#0d120d; --nav-text:#c0c8c0; --nav-active:#3cb371; --hover:#2a2e2c; --shadow:0 2px 8px rgba(0,0,0,0.35); --table-header:#2a2e2c; --code-bg:#1e221e; }
|
||||||
|
[data-theme="ix-dark"] { --primary:#4169e1; --primary-dark:#2c4db8; --primary-light:#6495ed; --bg:#1a1c22; --card-bg:#252530; --text:#e0e0e8; --text-light:#a0a0c0; --text-muted:#707090; --border:#333a50; --accent:#6495ed; --danger:#c44569; --success:#32cd32; --nav-bg:#0d0d15; --nav-text:#c0c0d8; --nav-active:#6495ed; --hover:#2a2c38; --shadow:0 2px 8px rgba(0,0,0,0.35); --table-header:#2a2c38; --code-bg:#1e1e28; }
|
||||||
|
[data-theme="choam-dark"] { --primary:#daa520; --primary-dark:#b8860b; --primary-light:#e8c840; --bg:#1e1c15; --card-bg:#282520; --text:#e0d8c8; --text-light:#a09888; --text-muted:#707058; --border:#38332a; --accent:#daa520; --danger:#b22222; --success:#228b22; --nav-bg:#100e08; --nav-text:#c0b8a8; --nav-active:#daa520; --hover:#2a2820; --shadow:0 2px 8px rgba(0,0,0,0.35); --table-header:#2a2820; --code-bg:#1e1c18; }
|
||||||
|
|
||||||
|
/* ===== Light Variants (for dark themes) ===== */
|
||||||
|
[data-theme="harkonnen-light"] { --primary:#ff6b00; --primary-dark:#cc5500; --primary-light:#ff8c33; --bg:#f5f0e8; --card-bg:#ffffff; --text:#1a1a1a; --text-light:#505050; --text-muted:#808080; --border:#e0d8c8; --accent:#ff4500; --danger:#cc0000; --success:#00aa33; --nav-bg:#1a1a1a; --nav-text:#d0d0d0; --nav-active:#ff6b00; --hover:#f0e8d8; --shadow:0 2px 8px rgba(0,0,0,0.08); --table-header:#e8e0d0; --code-bg:#faf8f5; }
|
||||||
|
[data-theme="spacing-guild-light"] { --primary:#4a90d9; --primary-dark:#2e6ab3; --primary-light:#6baee8; --bg:#e8edf5; --card-bg:#ffffff; --text:#1a2230; --text-light:#404860; --text-muted:#687080; --border:#d0d8e8; --accent:#4a90d9; --danger:#d94545; --success:#45d985; --nav-bg:#1a1a2e; --nav-text:#c0c8d0; --nav-active:#4a90d9; --hover:#e0e8f0; --shadow:0 2px 8px rgba(0,0,40,0.1); --table-header:#d8e0ed; --code-bg:#f4f6fa; }
|
||||||
|
[data-theme="emperor-light"] { --primary:#d4af37; --primary-dark:#b8962f; --primary-light:#e8c962; --bg:#faf8f0; --card-bg:#ffffff; --text:#1a1a1a; --text-light:#505050; --text-muted:#808080; --border:#e0d8c0; --accent:#d4af37; --danger:#c0392b; --success:#27ae60; --nav-bg:#1a1a1a; --nav-text:#d0d0d0; --nav-active:#d4af37; --hover:#f0ece0; --shadow:0 2px 8px rgba(0,0,0,0.08); --table-header:#e8e4d8; --code-bg:#fafaf5; }
|
||||||
|
[data-theme="tleilax-light"] { --primary:#6b20b0; --primary-dark:#4a0080; --primary-light:#9966cc; --bg:#f4f0f8; --card-bg:#ffffff; --text:#1a1a24; --text-light:#404060; --text-muted:#686880; --border:#d8d0e8; --accent:#8030cc; --danger:#c41e3a; --success:#00c080; --nav-bg:#1a1a24; --nav-text:#d0d0d8; --nav-active:#9966cc; --hover:#f0e8f8; --shadow:0 2px 8px rgba(40,0,60,0.1); --table-header:#e0d8f0; --code-bg:#f8f4fc; }
|
||||||
|
|
||||||
/* Theme Selector Button */
|
/* Theme Selector Button */
|
||||||
.theme-btn {
|
.theme-btn {
|
||||||
background: none;
|
background: none;
|
||||||
@@ -350,43 +368,70 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
background: #252530;
|
background: #252530;
|
||||||
min-width: 180px;
|
min-width: 290px;
|
||||||
|
max-height: 80vh;
|
||||||
|
overflow-y: auto;
|
||||||
box-shadow: 0 4px 16px rgba(0,0,0,0.4);
|
box-shadow: 0 4px 16px rgba(0,0,0,0.4);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
padding: 8px 0;
|
padding: 12px;
|
||||||
border: 1px solid #404050;
|
border: 1px solid #404050;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.theme-grid {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 4px 4px;
|
||||||
|
border-radius: 6px;
|
||||||
|
transition: background 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-row:hover {
|
||||||
|
background: rgba(255,255,255,0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-row-label {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #d0d0d8;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-row .theme-swatch {
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform 0.15s, box-shadow 0.15s;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 2px solid transparent;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-row .theme-swatch:hover {
|
||||||
|
transform: scale(1.2);
|
||||||
|
box-shadow: 0 0 8px rgba(255,255,255,0.3);
|
||||||
|
border-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-row .theme-swatch.active-theme {
|
||||||
|
border-color: #fff;
|
||||||
|
box-shadow: 0 0 6px rgba(255,255,255,0.4);
|
||||||
|
}
|
||||||
|
|
||||||
.theme-dropdown:hover .theme-dropdown-content {
|
.theme-dropdown:hover .theme-dropdown-content {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.theme-option {
|
/* Theme swatches base */
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
padding: 10px 16px;
|
|
||||||
cursor: pointer;
|
|
||||||
color: #d0d0d8;
|
|
||||||
font-size: 13px;
|
|
||||||
transition: background 0.15s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-option:hover {
|
|
||||||
background: rgba(255,255,255,0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-option.active {
|
|
||||||
background: var(--primary);
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-option.active:hover {
|
|
||||||
background: var(--primary-dark);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Theme swatches */
|
|
||||||
.theme-swatch {
|
.theme-swatch {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
@@ -410,6 +455,22 @@
|
|||||||
.theme-swatch.ix { background: linear-gradient(135deg, #4169e1 50%, #e8edf8 50%); }
|
.theme-swatch.ix { background: linear-gradient(135deg, #4169e1 50%, #e8edf8 50%); }
|
||||||
.theme-swatch.choam { background: linear-gradient(135deg, #b8860b 50%, #faf8f0 50%); }
|
.theme-swatch.choam { background: linear-gradient(135deg, #b8860b 50%, #faf8f0 50%); }
|
||||||
|
|
||||||
|
/* Variant swatches */
|
||||||
|
.theme-swatch.default-dark { background: linear-gradient(135deg, #c9a24e 50%, #1a1a1e 50%); }
|
||||||
|
.theme-swatch.atreides-dark { background: linear-gradient(135deg, #2d5a27 50%, #1a1e1a 50%); }
|
||||||
|
.theme-swatch.harkonnen-light { background: linear-gradient(135deg, #ff6b00 50%, #f5f0e8 50%); }
|
||||||
|
.theme-swatch.fremen-dark { background: linear-gradient(135deg, #d4a853 50%, #1e1a15 50%); }
|
||||||
|
.theme-swatch.bene-gesserit-dark { background: linear-gradient(135deg, #a8a8a8 50%, #1a1a1c 50%); }
|
||||||
|
.theme-swatch.spacing-guild-light { background: linear-gradient(135deg, #4a90d9 50%, #e8edf5 50%); }
|
||||||
|
.theme-swatch.emperor-light { background: linear-gradient(135deg, #d4af37 50%, #faf8f0 50%); }
|
||||||
|
.theme-swatch.corrino-dark { background: linear-gradient(135deg, #b02020 50%, #1e1a1a 50%); }
|
||||||
|
.theme-swatch.mentat-dark { background: linear-gradient(135deg, #008b8b 50%, #1a1e1e 50%); }
|
||||||
|
.theme-swatch.sardaukar-dark { background: linear-gradient(135deg, #cd853f 50%, #1e1a15 50%); }
|
||||||
|
.theme-swatch.tleilax-light { background: linear-gradient(135deg, #6b20b0 50%, #f4f0f8 50%); }
|
||||||
|
.theme-swatch.ordos-dark { background: linear-gradient(135deg, #2e8b57 50%, #1a1e1c 50%); }
|
||||||
|
.theme-swatch.ix-dark { background: linear-gradient(135deg, #4169e1 50%, #1a1c22 50%); }
|
||||||
|
.theme-swatch.choam-dark { background: linear-gradient(135deg, #daa520 50%, #1e1c15 50%); }
|
||||||
|
|
||||||
/* Current theme indicator */
|
/* Current theme indicator */
|
||||||
#current-theme-display {
|
#current-theme-display {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
|
|||||||
@@ -1,12 +1,41 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block title %}Admin Experimental - Dune Awakening Dashboard{% endblock %}
|
{% block title %}Experimental - Dune Awakening Dashboard{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
<div id="exp-gate" class="exp-gate">
|
||||||
|
<div class="exp-gate-box">
|
||||||
|
<div class="exp-gate-icon">⚠</div>
|
||||||
|
<h2>Experimental Features — Proceed with Caution</h2>
|
||||||
|
<p>This area contains <strong>untested, experimental tools</strong> that interact directly with your game server's internal systems (RabbitMQ, PostgreSQL, Battlegroup Director).</p>
|
||||||
|
<p>These tools <strong>can corrupt data, crash servers, or delete characters</strong>. Do not report bugs about this page. Always snapshot or backup your server first.</p>
|
||||||
|
<div class="exp-gate-actions">
|
||||||
|
<button onclick="denyExperimental()" class="exp-gate-btn deny">Take Me Back to Safety</button>
|
||||||
|
<button onclick="acceptExperimental()" class="exp-gate-btn accept">I Understand the Risks — Proceed</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="exp-content" style="display:none;">
|
||||||
|
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1>Admin Experimental</h1>
|
<h1>Experimental</h1>
|
||||||
<p>Experimental tools discovered through server research</p>
|
<p>Experimental tools discovered through server research</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="experimental-warning">
|
||||||
|
<div class="experimental-warning-title">⚠ DANGER — EXPERIMENTAL FEATURES</div>
|
||||||
|
<div class="experimental-warning-body">
|
||||||
|
<p>This page contains <strong>experimental and potentially destructive</strong> tools that interact directly with your game server's internal systems (RabbitMQ, PostgreSQL, Battlegroup Director).</p>
|
||||||
|
<p><strong>These tools can corrupt your database, crash game servers, delete player data, or render your cluster inoperable.</strong></p>
|
||||||
|
<ul>
|
||||||
|
<li><strong>DO NOT report bugs</strong> found on this page — these features are untested and in active research.</li>
|
||||||
|
<li><strong>USE AT YOUR OWN RISK.</strong> The dashboard authors are not responsible for any damage caused.</li>
|
||||||
|
<li><strong>SNAPSHOT OR BACKUP YOUR SERVER</strong> before using ANY tool on this page.</li>
|
||||||
|
<li>If you don't understand what a button does, <strong>DO NOT CLICK IT.</strong></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">In-Game Broadcast</div>
|
<div class="card-header">In-Game Broadcast</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -407,7 +436,93 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button onclick="setDemoState()" style="margin-top:8px;padding:8px 16px;background:var(--bg-hover);color:var(--text);border:1px solid var(--border);border-radius:4px;cursor:pointer;">Set Demo State</button>
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-top:24px;">
|
||||||
|
<h2 style="margin-bottom:16px;">RabbitMQ Explorer</h2>
|
||||||
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:16px;">
|
||||||
|
Inspect the RMQ clusters. Both Admin (port 30325) and Game (port 32716) instances via SSH tunnel.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;">
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">RMQ Overview</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Cluster health, node info, message stats.</p>
|
||||||
|
<div id="rmq-overview-status" class="error-banner" style="display:none;"></div>
|
||||||
|
<button onclick="loadRmqOverview()"
|
||||||
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;margin-bottom:8px;">Refresh</button>
|
||||||
|
<pre id="rmq-overview-data" style="max-height:300px;overflow:auto;font-size:11px;background:var(--bg-hover);padding:10px;border-radius:4px;white-space:pre-wrap;word-break:break-all;"></pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">RMQ Queues</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">All queues with consumer counts and message depths.</p>
|
||||||
|
<div id="rmq-queues-status" class="error-banner" style="display:none;"></div>
|
||||||
|
<button onclick="loadRmqQueues()"
|
||||||
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;margin-bottom:8px;">Refresh</button>
|
||||||
|
<div id="rmq-queues-data" style="max-height:300px;overflow:auto;font-size:11px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">RMQ Exchanges</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">All exchanges with type, durability, and message stats.</p>
|
||||||
|
<div id="rmq-exchanges-status" class="error-banner" style="display:none;"></div>
|
||||||
|
<button onclick="loadRmqExchanges()"
|
||||||
|
style="padding:8px 16px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;margin-bottom:8px;">Refresh</button>
|
||||||
|
<div id="rmq-exchanges-data" style="max-height:300px;overflow:auto;font-size:11px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">Message Inspector</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">Peek at messages in any queue without consuming them.</p>
|
||||||
|
<div id="rmq-peek-status" class="error-banner" style="display:none;"></div>
|
||||||
|
<div style="display:flex;gap:8px;margin-bottom:8px;">
|
||||||
|
<input type="text" id="rmq-peek-queue" placeholder="Queue name..."
|
||||||
|
style="flex:1;padding:6px 8px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:12px;">
|
||||||
|
<input type="number" id="rmq-peek-count" value="5" min="1" max="20"
|
||||||
|
style="width:60px;padding:6px 8px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:12px;">
|
||||||
|
<button onclick="peekRmqMessages()"
|
||||||
|
style="padding:6px 14px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:12px;">Peek</button>
|
||||||
|
</div>
|
||||||
|
<pre id="rmq-peek-data" style="max-height:300px;overflow:auto;font-size:11px;background:var(--bg-hover);padding:10px;border-radius:4px;white-space:pre-wrap;word-break:break-all;"></pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card" style="grid-column:1 / -1;">
|
||||||
|
<div class="card-header">Publish Test Message</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<p style="color:var(--text-muted);font-size:13px;margin-bottom:8px;">
|
||||||
|
Publish a test message to any exchange. <strong>Note:</strong> HTTP API sets user_id to dashboard_admin, which the game server may reject for RPC commands. Use the Erlang eval broadcast for in-game commands.
|
||||||
|
</p>
|
||||||
|
<div id="rmq-publish-status" class="error-banner" style="display:none;"></div>
|
||||||
|
<div style="display:flex;gap:8px;margin-bottom:8px;flex-wrap:wrap;">
|
||||||
|
<select id="rmq-publish-side" style="padding:6px 8px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:12px;">
|
||||||
|
<option value="admin">Admin (30325)</option>
|
||||||
|
<option value="game">Game (32716)</option>
|
||||||
|
</select>
|
||||||
|
<input type="text" id="rmq-publish-exchange" placeholder="Exchange name..."
|
||||||
|
style="flex:1;min-width:150px;padding:6px 8px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:12px;">
|
||||||
|
<input type="text" id="rmq-publish-routing" placeholder="Routing key..."
|
||||||
|
style="flex:1;min-width:150px;padding:6px 8px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:12px;">
|
||||||
|
<button onclick="publishRmqMessage()"
|
||||||
|
style="padding:6px 14px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:12px;">Publish</button>
|
||||||
|
</div>
|
||||||
|
<textarea id="rmq-publish-message" rows="4" placeholder='{"key": "value"}'
|
||||||
|
style="width:100%;padding:8px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:12px;font-family:monospace;resize:vertical;"></textarea>
|
||||||
|
<pre id="rmq-publish-data" style="max-height:200px;overflow:auto;font-size:11px;background:var(--bg-hover);padding:10px;border-radius:4px;margin-top:8px;white-space:pre-wrap;word-break:break-all;"></pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -539,10 +654,28 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.error-banner { padding: 10px 14px; border-radius: 4px; margin-bottom: 12px; font-size: 13px; }
|
.error-banner { padding: 10px 14px; border-radius: 4px; margin-bottom: 12px; font-size: 13px; }
|
||||||
.error-banner.success { background: #1a3a2a; border: 1px solid #2ecc71; color: #2ecc71; display: block; }
|
.error-banner.success { background: #1a3a2a; border: 1px solid #2ecc71; color: #2ecc71; display: block; }
|
||||||
.error-banner.error { background: #3a1a1a; border: 1px solid #e74c3c; color: #e74c3c; display: block; }
|
.error-banner.error { background: #3a1a1a; border: 1px solid #e74c3c; color: #e74c3c; display: block; }
|
||||||
|
.experimental-warning { background: rgba(220,38,38,0.12); border: 2px solid rgba(220,38,38,0.6); border-left: 6px solid #dc2626; border-radius: 8px; padding: 18px 22px; margin-bottom: 24px; }
|
||||||
|
.experimental-warning-title { font-size: 16px; font-weight: 700; color: #ef4444; margin-bottom: 12px; }
|
||||||
|
.experimental-warning-body p { margin: 0 0 10px; font-size: 13px; color: var(--text); line-height: 1.6; }
|
||||||
|
.experimental-warning-body ul { margin: 8px 0 0; padding-left: 20px; font-size: 13px; color: var(--text); line-height: 1.8; }
|
||||||
|
.experimental-warning-body li { margin-bottom: 4px; }
|
||||||
|
.exp-gate { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 9999; display: flex; align-items: center; justify-content: center; }
|
||||||
|
.exp-gate-box { background: #1a1a1e; border: 2px solid #dc2626; border-radius: 12px; max-width: 560px; width: 90%; padding: 32px; text-align: center; color: #e0e0e0; }
|
||||||
|
.exp-gate-icon { font-size: 48px; color: #ef4444; margin-bottom: 16px; }
|
||||||
|
.exp-gate-box h2 { font-size: 18px; color: #ef4444; margin: 0 0 16px; }
|
||||||
|
.exp-gate-box p { font-size: 13px; line-height: 1.6; margin: 0 0 12px; color: #c0c0c0; }
|
||||||
|
.exp-gate-actions { display: flex; gap: 12px; margin-top: 20px; justify-content: center; flex-wrap: wrap; }
|
||||||
|
.exp-gate-btn { padding: 12px 24px; border: none; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
|
||||||
|
.exp-gate-btn.accept { background: #dc2626; color: #fff; }
|
||||||
|
.exp-gate-btn.accept:hover { background: #b91c1c; }
|
||||||
|
.exp-gate-btn.deny { background: #374151; color: #d0d0d0; }
|
||||||
|
.exp-gate-btn.deny:hover { background: #4b5563; }
|
||||||
code { background: var(--bg-hover); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
|
code { background: var(--bg-hover); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
|
||||||
.result-table { width:100%; border-collapse:collapse; font-size:12px; margin-top:8px; }
|
.result-table { width:100%; border-collapse:collapse; font-size:12px; margin-top:8px; }
|
||||||
.result-table th { text-align:left; padding:6px 8px; background:var(--bg-hover); border-bottom:2px solid var(--border); }
|
.result-table th { text-align:left; padding:6px 8px; background:var(--bg-hover); border-bottom:2px solid var(--border); }
|
||||||
@@ -1272,11 +1405,131 @@ async function executeFunction(name, paramCount) {
|
|||||||
} catch(e) { resultDiv.innerHTML = `<div class="error-banner error" style="display:block;">${esc(e.message)}</div>`; }
|
} catch(e) { resultDiv.innerHTML = `<div class="error-banner error" style="display:block;">${esc(e.message)}</div>`; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── RMQ Explorer ─────────────────────────────────────────────────
|
||||||
|
async function loadRmqOverview() {
|
||||||
|
const status = document.getElementById('rmq-overview-status');
|
||||||
|
const output = document.getElementById('rmq-overview-data');
|
||||||
|
hideStatus(status); output.textContent = 'Loading...';
|
||||||
|
try {
|
||||||
|
const r = await csrfFetch('/api/admin-experimental/rmq/overview');
|
||||||
|
const d = await r.json();
|
||||||
|
if (!d.success) { showError(status, d.error); output.textContent = ''; return; }
|
||||||
|
output.textContent = JSON.stringify(d.data, null, 2);
|
||||||
|
} catch(e) { showError(status, e.message); output.textContent = ''; }
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadRmqQueues() {
|
||||||
|
const status = document.getElementById('rmq-queues-status');
|
||||||
|
const output = document.getElementById('rmq-queues-data');
|
||||||
|
hideStatus(status); output.innerHTML = 'Loading...';
|
||||||
|
try {
|
||||||
|
const r = await csrfFetch('/api/admin-experimental/rmq/queues');
|
||||||
|
const d = await r.json();
|
||||||
|
if (!d.success) { showError(status, d.error); output.innerHTML = ''; return; }
|
||||||
|
const data = d.data || {};
|
||||||
|
let html = '';
|
||||||
|
for (const [side, queues] of Object.entries(data)) {
|
||||||
|
html += `<h4 style="margin:8px 0 4px;font-size:12px;color:var(--text)">RMQ ${side.toUpperCase()}</h4>`;
|
||||||
|
if (!queues || !queues.length) { html += '<p style="font-size:11px;color:var(--text-muted)">No queues or connection failed</p>'; continue; }
|
||||||
|
html += '<table class="result-table"><tr><th>Name</th><th>State</th><th>Ready</th><th>Consumers</th></tr>';
|
||||||
|
for (const q of queues) {
|
||||||
|
html += `<tr><td style="font-size:10px;word-break:break-all">${esc(q.name||'?')}</td>`;
|
||||||
|
html += `<td>${esc(String(q.state||''))}</td>`;
|
||||||
|
html += `<td>${q.messages_ready||0}</td><td>${q.consumers||0}</td></tr>`;
|
||||||
|
}
|
||||||
|
html += '</table>';
|
||||||
|
}
|
||||||
|
output.innerHTML = html;
|
||||||
|
} catch(e) { showError(status, e.message); output.innerHTML = ''; }
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadRmqExchanges() {
|
||||||
|
const status = document.getElementById('rmq-exchanges-status');
|
||||||
|
const output = document.getElementById('rmq-exchanges-data');
|
||||||
|
hideStatus(status); output.innerHTML = 'Loading...';
|
||||||
|
try {
|
||||||
|
const r = await csrfFetch('/api/admin-experimental/rmq/exchanges');
|
||||||
|
const d = await r.json();
|
||||||
|
if (!d.success) { showError(status, d.error); output.innerHTML = ''; return; }
|
||||||
|
const data = d.data || {};
|
||||||
|
let html = '';
|
||||||
|
for (const [side, exchanges] of Object.entries(data)) {
|
||||||
|
html += `<h4 style="margin:8px 0 4px;font-size:12px;color:var(--text)">RMQ ${side.toUpperCase()}</h4>`;
|
||||||
|
if (!exchanges || !exchanges.length) { html += '<p style="font-size:11px;color:var(--text-muted)">No exchanges or connection failed</p>'; continue; }
|
||||||
|
html += '<table class="result-table"><tr><th>Name</th><th>Type</th><th>Durable</th><th>Msgs</th></tr>';
|
||||||
|
for (const x of exchanges) {
|
||||||
|
html += `<tr><td style="font-size:10px;word-break:break-all">${esc(x.name||'?')}</td>`;
|
||||||
|
html += `<td>${esc(x.type||'')}</td><td>${x.durable?'Yes':'No'}</td>`;
|
||||||
|
html += `<td>${x.message_stats?.publish_in||0}</td></tr>`;
|
||||||
|
}
|
||||||
|
html += '</table>';
|
||||||
|
}
|
||||||
|
output.innerHTML = html;
|
||||||
|
} catch(e) { showError(status, e.message); output.innerHTML = ''; }
|
||||||
|
}
|
||||||
|
|
||||||
|
async function peekRmqMessages() {
|
||||||
|
const status = document.getElementById('rmq-peek-status');
|
||||||
|
const output = document.getElementById('rmq-peek-data');
|
||||||
|
const queue = document.getElementById('rmq-peek-queue').value.trim();
|
||||||
|
const count = parseInt(document.getElementById('rmq-peek-count').value) || 5;
|
||||||
|
if (!queue) { showError(status, 'Enter a queue name'); return; }
|
||||||
|
hideStatus(status); output.textContent = 'Loading...';
|
||||||
|
try {
|
||||||
|
const r = await csrfFetch('/api/admin-experimental/rmq/peek', {
|
||||||
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
||||||
|
body: JSON.stringify({queue, count})
|
||||||
|
});
|
||||||
|
const d = await r.json();
|
||||||
|
if (!d.success) { showError(status, d.error); output.textContent = ''; return; }
|
||||||
|
output.textContent = JSON.stringify(d.data, null, 2);
|
||||||
|
} catch(e) { showError(status, e.message); output.textContent = ''; }
|
||||||
|
}
|
||||||
|
|
||||||
|
async function publishRmqMessage() {
|
||||||
|
const status = document.getElementById('rmq-publish-status');
|
||||||
|
const output = document.getElementById('rmq-publish-data');
|
||||||
|
const side = document.getElementById('rmq-publish-side').value;
|
||||||
|
const exchange = document.getElementById('rmq-publish-exchange').value.trim();
|
||||||
|
const routing_key = document.getElementById('rmq-publish-routing').value.trim();
|
||||||
|
const messageStr = document.getElementById('rmq-publish-message').value.trim();
|
||||||
|
if (!exchange) { showError(status, 'Enter an exchange name'); return; }
|
||||||
|
hideStatus(status); output.textContent = 'Publishing...';
|
||||||
|
let message = messageStr;
|
||||||
|
try { message = JSON.parse(messageStr); } catch(_) {}
|
||||||
|
try {
|
||||||
|
const r = await csrfFetch('/api/admin-experimental/rmq/publish', {
|
||||||
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
||||||
|
body: JSON.stringify({exchange, routing_key, message, side})
|
||||||
|
});
|
||||||
|
const d = await r.json();
|
||||||
|
if (!d.success) { showError(status, d.error); output.textContent = ''; return; }
|
||||||
|
output.textContent = JSON.stringify(d.data, null, 2);
|
||||||
|
} catch(e) { showError(status, e.message); output.textContent = ''; }
|
||||||
|
}
|
||||||
|
|
||||||
// ── Helpers ─────────────────────────────────────────────────────────
|
// ── Helpers ─────────────────────────────────────────────────────────
|
||||||
function esc(s) { if (!s) return ''; return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); }
|
function esc(s) { if (!s) return ''; return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); }
|
||||||
function showError(el, msg) { el.className = 'error-banner error'; el.textContent = msg; el.style.display = 'block'; }
|
function showError(el, msg) { el.className = 'error-banner error'; el.textContent = msg; el.style.display = 'block'; }
|
||||||
function showSuccess(el, msg) { el.className = 'error-banner success'; el.textContent = msg; el.style.display = 'block'; }
|
function showSuccess(el, msg) { el.className = 'error-banner success'; el.textContent = msg; el.style.display = 'block'; }
|
||||||
function hideStatus(el) { el.style.display = 'none'; }
|
function hideStatus(el) { el.style.display = 'none'; }
|
||||||
|
|
||||||
|
function acceptExperimental() {
|
||||||
|
document.getElementById('exp-gate').style.display = 'none';
|
||||||
|
document.getElementById('exp-content').style.display = 'block';
|
||||||
|
localStorage.setItem('exp-warning-accepted', '1');
|
||||||
|
}
|
||||||
|
|
||||||
|
function denyExperimental() {
|
||||||
|
localStorage.removeItem('exp-warning-accepted');
|
||||||
|
window.location.href = '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
if (localStorage.getItem('exp-warning-accepted') === '1') {
|
||||||
|
acceptExperimental();
|
||||||
|
}
|
||||||
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
+68
-66
@@ -7,6 +7,7 @@
|
|||||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='themes.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='themes.css') }}">
|
||||||
|
{% block head_extra %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="update-banner" class="update-banner" style="display:none;">
|
<div id="update-banner" class="update-banner" style="display:none;">
|
||||||
@@ -25,47 +26,77 @@
|
|||||||
<div class="theme-dropdown">
|
<div class="theme-dropdown">
|
||||||
<button class="theme-btn" title="Theme">🎨</button>
|
<button class="theme-btn" title="Theme">🎨</button>
|
||||||
<div class="theme-dropdown-content">
|
<div class="theme-dropdown-content">
|
||||||
<div class="theme-option active" data-theme="default" onclick="setTheme('default')">
|
<div class="theme-grid">
|
||||||
<span class="theme-swatch default"></span> Classic Dune
|
<div class="theme-row" data-family="default">
|
||||||
|
<span class="theme-row-label">Classic Dune</span>
|
||||||
|
<span class="theme-swatch default" data-theme="default" onclick="setTheme('default')" title="Classic Dune Light"></span>
|
||||||
|
<span class="theme-swatch default-dark active-theme" data-theme="default-dark" onclick="setTheme('default-dark')" title="Classic Dune Dark"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-option" data-theme="atreides" onclick="setTheme('atreides')">
|
<div class="theme-row" data-family="atreides">
|
||||||
<span class="theme-swatch atrides"></span> House Atreides
|
<span class="theme-row-label">House Atreides</span>
|
||||||
|
<span class="theme-swatch atreides" data-theme="atreides" onclick="setTheme('atreides')" title="House Atreides Light"></span>
|
||||||
|
<span class="theme-swatch atreides-dark" data-theme="atreides-dark" onclick="setTheme('atreides-dark')" title="House Atreides Dark"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-option" data-theme="harkonnen" onclick="setTheme('harkonnen')">
|
<div class="theme-row" data-family="harkonnen">
|
||||||
<span class="theme-swatch harkonnen"></span> House Harkonnen
|
<span class="theme-row-label">House Harkonnen</span>
|
||||||
|
<span class="theme-swatch harkonnen-light" data-theme="harkonnen-light" onclick="setTheme('harkonnen-light')" title="House Harkonnen Light"></span>
|
||||||
|
<span class="theme-swatch harkonnen" data-theme="harkonnen" onclick="setTheme('harkonnen')" title="House Harkonnen Dark"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-option" data-theme="fremen" onclick="setTheme('fremen')">
|
<div class="theme-row" data-family="fremen">
|
||||||
<span class="theme-swatch fremen"></span> Fremen
|
<span class="theme-row-label">Fremen</span>
|
||||||
|
<span class="theme-swatch fremen" data-theme="fremen" onclick="setTheme('fremen')" title="Fremen Light"></span>
|
||||||
|
<span class="theme-swatch fremen-dark" data-theme="fremen-dark" onclick="setTheme('fremen-dark')" title="Fremen Dark"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-option" data-theme="bene-gesserit" onclick="setTheme('bene-gesserit')">
|
<div class="theme-row" data-family="bene-gesserit">
|
||||||
<span class="theme-swatch bene-gesserit"></span> Bene Gesserit
|
<span class="theme-row-label">Bene Gesserit</span>
|
||||||
|
<span class="theme-swatch bene-gesserit" data-theme="bene-gesserit" onclick="setTheme('bene-gesserit')" title="Bene Gesserit Light"></span>
|
||||||
|
<span class="theme-swatch bene-gesserit-dark" data-theme="bene-gesserit-dark" onclick="setTheme('bene-gesserit-dark')" title="Bene Gesserit Dark"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-option" data-theme="spacing-guild" onclick="setTheme('spacing-guild')">
|
<div class="theme-row" data-family="spacing-guild">
|
||||||
<span class="theme-swatch spacing-guild"></span> Spacing Guild
|
<span class="theme-row-label">Spacing Guild</span>
|
||||||
|
<span class="theme-swatch spacing-guild-light" data-theme="spacing-guild-light" onclick="setTheme('spacing-guild-light')" title="Spacing Guild Light"></span>
|
||||||
|
<span class="theme-swatch spacing-guild" data-theme="spacing-guild" onclick="setTheme('spacing-guild')" title="Spacing Guild Dark"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-option" data-theme="emperor" onclick="setTheme('emperor')">
|
<div class="theme-row" data-family="emperor">
|
||||||
<span class="theme-swatch emperor"></span> Emperor
|
<span class="theme-row-label">Emperor</span>
|
||||||
|
<span class="theme-swatch emperor-light" data-theme="emperor-light" onclick="setTheme('emperor-light')" title="Emperor Light"></span>
|
||||||
|
<span class="theme-swatch emperor" data-theme="emperor" onclick="setTheme('emperor')" title="Emperor Dark"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-option" data-theme="corrino" onclick="setTheme('corrino')">
|
<div class="theme-row" data-family="corrino">
|
||||||
<span class="theme-swatch corrino"></span> House Corrino
|
<span class="theme-row-label">House Corrino</span>
|
||||||
|
<span class="theme-swatch corrino" data-theme="corrino" onclick="setTheme('corrino')" title="House Corrino Light"></span>
|
||||||
|
<span class="theme-swatch corrino-dark" data-theme="corrino-dark" onclick="setTheme('corrino-dark')" title="House Corrino Dark"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-option" data-theme="mentat" onclick="setTheme('mentat')">
|
<div class="theme-row" data-family="mentat">
|
||||||
<span class="theme-swatch mentat"></span> Mentat
|
<span class="theme-row-label">Mentat</span>
|
||||||
|
<span class="theme-swatch mentat" data-theme="mentat" onclick="setTheme('mentat')" title="Mentat Light"></span>
|
||||||
|
<span class="theme-swatch mentat-dark" data-theme="mentat-dark" onclick="setTheme('mentat-dark')" title="Mentat Dark"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-option" data-theme="sardaukar" onclick="setTheme('sardaukar')">
|
<div class="theme-row" data-family="sardaukar">
|
||||||
<span class="theme-swatch sardaukar"></span> Sardaukar
|
<span class="theme-row-label">Sardaukar</span>
|
||||||
|
<span class="theme-swatch sardaukar" data-theme="sardaukar" onclick="setTheme('sardaukar')" title="Sardaukar Light"></span>
|
||||||
|
<span class="theme-swatch sardaukar-dark" data-theme="sardaukar-dark" onclick="setTheme('sardaukar-dark')" title="Sardaukar Dark"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-option" data-theme="tleilax" onclick="setTheme('tleilax')">
|
<div class="theme-row" data-family="tleilax">
|
||||||
<span class="theme-swatch tleilax"></span> Bene Tleilax
|
<span class="theme-row-label">Bene Tleilax</span>
|
||||||
|
<span class="theme-swatch tleilax-light" data-theme="tleilax-light" onclick="setTheme('tleilax-light')" title="Bene Tleilax Light"></span>
|
||||||
|
<span class="theme-swatch tleilax" data-theme="tleilax" onclick="setTheme('tleilax')" title="Bene Tleilax Dark"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-option" data-theme="ordos" onclick="setTheme('ordos')">
|
<div class="theme-row" data-family="ordos">
|
||||||
<span class="theme-swatch ordos"></span> House Ordos
|
<span class="theme-row-label">House Ordos</span>
|
||||||
|
<span class="theme-swatch ordos" data-theme="ordos" onclick="setTheme('ordos')" title="House Ordos Light"></span>
|
||||||
|
<span class="theme-swatch ordos-dark" data-theme="ordos-dark" onclick="setTheme('ordos-dark')" title="House Ordos Dark"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-option" data-theme="ix" onclick="setTheme('ix')">
|
<div class="theme-row" data-family="ix">
|
||||||
<span class="theme-swatch ix"></span> Ix
|
<span class="theme-row-label">Ix</span>
|
||||||
|
<span class="theme-swatch ix" data-theme="ix" onclick="setTheme('ix')" title="Ix Light"></span>
|
||||||
|
<span class="theme-swatch ix-dark" data-theme="ix-dark" onclick="setTheme('ix-dark')" title="Ix Dark"></span>
|
||||||
|
</div>
|
||||||
|
<div class="theme-row" data-family="choam">
|
||||||
|
<span class="theme-row-label">CHOAM</span>
|
||||||
|
<span class="theme-swatch choam" data-theme="choam" onclick="setTheme('choam')" title="CHOAM Light"></span>
|
||||||
|
<span class="theme-swatch choam-dark" data-theme="choam-dark" onclick="setTheme('choam-dark')" title="CHOAM Dark"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-option" data-theme="choam" onclick="setTheme('choam')">
|
|
||||||
<span class="theme-swatch choam"></span> CHOAM
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -112,24 +143,11 @@
|
|||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
async function manualCheckUpdate() {
|
async function manualCheckUpdate() {
|
||||||
const btn = document.getElementById('check-update-btn');
|
const progress = document.getElementById('update-progress');
|
||||||
btn.textContent = 'Checking...';
|
const statusText = document.getElementById('update-status-text');
|
||||||
btn.disabled = true;
|
progress.style.display = 'flex';
|
||||||
try {
|
statusText.textContent = 'The update system is being reworked for better reliability. Please check back soon.';
|
||||||
const resp = await csrfFetch('/api/update/check', { method: 'POST' });
|
setTimeout(() => { progress.style.display = 'none'; }, 4000);
|
||||||
const data = await resp.json();
|
|
||||||
if (data.available) {
|
|
||||||
document.getElementById('update-banner').style.display = 'flex';
|
|
||||||
btn.textContent = 'Update Available!';
|
|
||||||
} else {
|
|
||||||
btn.textContent = 'Up to Date ✓';
|
|
||||||
setTimeout(() => { btn.textContent = '🔄 Check Updates'; }, 3000);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
btn.textContent = 'Check Failed';
|
|
||||||
setTimeout(() => { btn.textContent = '🔄 Check Updates'; }, 3000);
|
|
||||||
}
|
|
||||||
btn.disabled = false;
|
|
||||||
}
|
}
|
||||||
function dismissUpdate() {
|
function dismissUpdate() {
|
||||||
updateDismissed = true;
|
updateDismissed = true;
|
||||||
@@ -141,22 +159,9 @@
|
|||||||
const statusText = document.getElementById('update-status-text');
|
const statusText = document.getElementById('update-status-text');
|
||||||
banner.style.display = 'none';
|
banner.style.display = 'none';
|
||||||
progress.style.display = 'flex';
|
progress.style.display = 'flex';
|
||||||
try {
|
statusText.textContent = 'The auto-update system is being reworked to be more reliable and robust. Manual updates from the launcher still work.';
|
||||||
const resp = await csrfFetch('/api/update/apply', { method: 'POST' });
|
|
||||||
const data = await resp.json();
|
|
||||||
statusText.textContent = data.message || 'Applying update...';
|
|
||||||
if (data.success) {
|
|
||||||
statusText.textContent = 'Update complete! Restarting...';
|
|
||||||
setTimeout(() => { location.reload(); }, 5000);
|
|
||||||
} else {
|
|
||||||
statusText.textContent = 'Update failed: ' + (data.message || 'Unknown error');
|
|
||||||
setTimeout(() => { progress.style.display = 'none'; }, 5000);
|
setTimeout(() => { progress.style.display = 'none'; }, 5000);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
statusText.textContent = 'Update failed: ' + e.message;
|
|
||||||
setTimeout(() => { progress.style.display = 'none'; }, 5000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setInterval(checkForUpdate, 60000);
|
setInterval(checkForUpdate, 60000);
|
||||||
checkForUpdate();
|
checkForUpdate();
|
||||||
|
|
||||||
@@ -168,16 +173,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateThemeUI(themeName) {
|
function updateThemeUI(themeName) {
|
||||||
document.querySelectorAll('.theme-option').forEach(opt => {
|
document.querySelectorAll('.theme-row .theme-swatch').forEach(sw => {
|
||||||
opt.classList.remove('active');
|
sw.classList.toggle('active-theme', sw.getAttribute('data-theme') === themeName);
|
||||||
if (opt.getAttribute('data-theme') === themeName) {
|
|
||||||
opt.classList.add('active');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initTheme() {
|
function initTheme() {
|
||||||
const savedTheme = localStorage.getItem('dune-theme') || 'default';
|
const savedTheme = localStorage.getItem('dune-theme') || 'default-dark';
|
||||||
document.documentElement.setAttribute('data-theme', savedTheme);
|
document.documentElement.setAttribute('data-theme', savedTheme);
|
||||||
updateThemeUI(savedTheme);
|
updateThemeUI(savedTheme);
|
||||||
}
|
}
|
||||||
|
|||||||
+269
-652
@@ -1,468 +1,106 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block title %}Map - Dune Dashboard{% endblock %}
|
{% block title %}Map - Dune Dashboard{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block head_extra %}
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.css" />
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet.markercluster@1.5.3/dist/MarkerCluster.css" />
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet.markercluster@1.5.3/dist/MarkerCluster.Default.css" />
|
||||||
<style>
|
<style>
|
||||||
.map-page {
|
.map-page { display:flex; flex-direction:column; height:calc(100vh - 104px); min-height:620px; gap:14px; }
|
||||||
display: flex;
|
.map-header { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; flex-shrink:0; }
|
||||||
flex-direction: column;
|
.map-header h2 { margin:0; }
|
||||||
gap: 14px;
|
.map-summary { display:flex; gap:10px; flex-wrap:wrap; }
|
||||||
height: calc(100vh - 104px);
|
.map-summary-item { min-width:92px; padding:8px 10px; border:1px solid var(--border); border-radius:6px; background:var(--card-bg); }
|
||||||
min-height: 620px;
|
.map-summary-item strong { display:block; font-size:18px; line-height:1.1; color:var(--primary); }
|
||||||
}
|
.map-summary-item span { display:block; margin-top:3px; font-size:11px; color:var(--text-muted); text-transform:uppercase; }
|
||||||
|
.map-layout { display:grid; grid-template-columns:minmax(0,1fr) 320px; grid-template-rows:1fr; gap:16px; min-height:0; flex:1; }
|
||||||
.map-header {
|
#map-container { position:relative; width:100%; height:100%; border:1px solid var(--border); border-radius:8px; overflow:hidden; background:#101312; }
|
||||||
display: flex;
|
#map-container .leaflet-container { background:#101312; width:100% !important; height:100% !important; }
|
||||||
justify-content: space-between;
|
.map-panel { min-height:0; overflow:auto; border:1px solid var(--border); border-radius:8px; background:var(--card-bg); display:flex; flex-direction:column; }
|
||||||
align-items: flex-start;
|
.panel-section { padding:14px; border-bottom:1px solid var(--border); }
|
||||||
gap: 16px;
|
.panel-section:last-child { border-bottom:0; }
|
||||||
}
|
.panel-title { margin:0 0 10px; font-size:12px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0; }
|
||||||
|
.map-choice { display:block; width:100%; padding:10px; margin-bottom:8px; border:1px solid var(--border); border-radius:6px; background:var(--bg); color:var(--text); text-align:left; cursor:pointer; }
|
||||||
.map-header h2 {
|
.map-choice:hover { border-color:var(--primary); }
|
||||||
margin: 0;
|
.map-choice.active { border-color:var(--primary); box-shadow:inset 3px 0 0 var(--primary); }
|
||||||
}
|
.map-choice strong { font-size:13px; display:block; }
|
||||||
|
.map-choice .counts { font-size:11px; color:var(--text-muted); margin-top:2px; }
|
||||||
.map-summary {
|
.map-toggle { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:7px 0; font-size:13px; }
|
||||||
display: flex;
|
.map-toggle input { accent-color:var(--primary); }
|
||||||
gap: 10px;
|
.legend-dot { display:inline-block; width:10px; height:10px; margin-right:7px; border-radius:999px; border:1px solid #fff; vertical-align:middle; }
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-summary-item {
|
|
||||||
min-width: 92px;
|
|
||||||
padding: 8px 10px;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 6px;
|
|
||||||
background: var(--card-bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-summary-item strong {
|
|
||||||
display: block;
|
|
||||||
font-size: 18px;
|
|
||||||
line-height: 1.1;
|
|
||||||
color: var(--primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-summary-item span {
|
|
||||||
display: block;
|
|
||||||
margin-top: 3px;
|
|
||||||
font-size: 11px;
|
|
||||||
color: var(--text-muted);
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-layout {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: minmax(0, 1fr) 320px;
|
|
||||||
gap: 16px;
|
|
||||||
min-height: 0;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-view {
|
|
||||||
position: relative;
|
|
||||||
min-width: 0;
|
|
||||||
min-height: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 8px;
|
|
||||||
background: #101312;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-scroll {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
overflow: auto;
|
|
||||||
cursor: grab;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-scroll.dragging {
|
|
||||||
cursor: grabbing;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-canvas {
|
|
||||||
position: relative;
|
|
||||||
margin: 24px;
|
|
||||||
background: #0d0f0f;
|
|
||||||
box-shadow: 0 10px 34px rgba(0, 0, 0, 0.35);
|
|
||||||
display: inline-block;
|
|
||||||
min-width: 100%;
|
|
||||||
min-height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-image {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: contain;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-image-credit {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 32px;
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
font-size: 11px;
|
|
||||||
color: var(--text-muted);
|
|
||||||
background: rgba(0, 0, 0, 0.7);
|
|
||||||
padding: 4px 12px;
|
|
||||||
border-radius: 4px;
|
|
||||||
z-index: 10;
|
|
||||||
pointer-events: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-image-credit a {
|
|
||||||
color: var(--primary);
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-image-credit a:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-marker {
|
|
||||||
position: absolute;
|
|
||||||
width: 14px;
|
|
||||||
height: 14px;
|
|
||||||
border-radius: 999px;
|
|
||||||
border: 2px solid #fff;
|
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
cursor: pointer;
|
|
||||||
z-index: 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-marker:hover,
|
|
||||||
.map-marker.active {
|
|
||||||
transform: translate(-50%, -50%) scale(1.45);
|
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-marker.player { background: #e7c65b; }
|
|
||||||
.map-marker.vehicle { background: #45a3ff; }
|
|
||||||
.map-marker.base { background: #54c878; }
|
|
||||||
|
|
||||||
.map-tooltip {
|
|
||||||
display: none;
|
|
||||||
position: absolute;
|
|
||||||
left: 50%;
|
|
||||||
bottom: calc(100% + 8px);
|
|
||||||
transform: translateX(-50%);
|
|
||||||
min-width: 150px;
|
|
||||||
padding: 6px 8px;
|
|
||||||
border-radius: 5px;
|
|
||||||
background: rgba(0, 0, 0, 0.86);
|
|
||||||
color: #fff;
|
|
||||||
font-size: 11px;
|
|
||||||
line-height: 1.4;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-marker:hover .map-tooltip {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-empty {
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 8px;
|
|
||||||
padding: 28px;
|
|
||||||
text-align: center;
|
|
||||||
color: var(--text-muted);
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-panel {
|
|
||||||
min-height: 0;
|
|
||||||
overflow: auto;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 8px;
|
|
||||||
background: var(--card-bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-section {
|
|
||||||
padding: 14px;
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-section:last-child {
|
|
||||||
border-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-title {
|
|
||||||
margin: 0 0 10px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--text-muted);
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-choice {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr auto;
|
|
||||||
gap: 6px 10px;
|
|
||||||
width: 100%;
|
|
||||||
padding: 10px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 6px;
|
|
||||||
background: var(--bg);
|
|
||||||
color: var(--text);
|
|
||||||
text-align: left;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-choice.active {
|
|
||||||
border-color: var(--primary);
|
|
||||||
box-shadow: inset 3px 0 0 var(--primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-choice strong {
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-choice span {
|
|
||||||
font-size: 11px;
|
|
||||||
color: var(--text-muted);
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-controls {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 36px 1fr 36px;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-controls button,
|
|
||||||
.map-icon-button {
|
|
||||||
height: 34px;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 6px;
|
|
||||||
background: var(--bg);
|
|
||||||
color: var(--text);
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-controls input {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.zoom-readout {
|
|
||||||
margin-top: 8px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--text-muted);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-toggle {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 10px;
|
|
||||||
padding: 7px 0;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-toggle input {
|
|
||||||
accent-color: var(--primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.legend-dot {
|
|
||||||
display: inline-block;
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
margin-right: 7px;
|
|
||||||
border-radius: 999px;
|
|
||||||
border: 1px solid #fff;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
.legend-dot.player { background:#e7c65b; }
|
.legend-dot.player { background:#e7c65b; }
|
||||||
.legend-dot.vehicle { background:#45a3ff; }
|
.legend-dot.vehicle { background:#45a3ff; }
|
||||||
.legend-dot.base { background:#54c878; }
|
.legend-dot.base { background:#54c878; }
|
||||||
|
.search-box { width:100%; padding:8px 10px; border:1px solid var(--border); border-radius:6px; background:var(--bg); color:var(--text); font-size:13px; box-sizing:border-box; }
|
||||||
.location-list {
|
.search-box::placeholder { color:var(--text-muted); }
|
||||||
display: flex;
|
.location-list { display:flex; flex-direction:column; gap:4px; max-height:350px; overflow:auto; }
|
||||||
flex-direction: column;
|
.location-item { display:grid; grid-template-columns:1fr auto; gap:2px 8px; padding:7px 8px; border:1px solid var(--border); border-radius:6px; background:var(--bg); color:var(--text); text-align:left; cursor:pointer; font-size:12px; }
|
||||||
gap: 6px;
|
.location-item:hover, .location-item.active { border-color:var(--primary); }
|
||||||
max-height: 310px;
|
.location-item strong { font-size:11px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
||||||
overflow: auto;
|
.location-item .meta { font-size:10px; color:var(--text-muted); }
|
||||||
}
|
.leaflet-tooltip.marker-tooltip { font-size:11px; padding:4px 8px; border-radius:4px; background:rgba(0,0,0,0.85); border:none; color:#fff; }
|
||||||
|
.leaflet-tooltip.marker-tooltip::before { border-top-color:rgba(0,0,0,0.85); }
|
||||||
.location-item {
|
.map-credit { position:absolute; bottom:4px; right:8px; z-index:1000; font-size:11px; color:var(--text-muted); background:rgba(0,0,0,0.7); padding:4px 10px; border-radius:4px; pointer-events:auto; }
|
||||||
display: grid;
|
.map-credit a { color:var(--primary); text-decoration:none; }
|
||||||
grid-template-columns: 1fr auto;
|
.map-credit a:hover { text-decoration:underline; }
|
||||||
gap: 4px 8px;
|
.map-notice { background:rgba(234,179,8,0.1); border:1px solid rgba(234,179,8,0.4); border-left:4px solid #eab308; border-radius:6px; padding:10px 14px; font-size:13px; color:var(--text); line-height:1.5; flex-shrink:0; }
|
||||||
padding: 8px;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 6px;
|
|
||||||
background: var(--bg);
|
|
||||||
color: var(--text);
|
|
||||||
text-align: left;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.location-item:hover,
|
|
||||||
.location-item.active {
|
|
||||||
border-color: var(--primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.location-item strong {
|
|
||||||
font-size: 12px;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.location-item span {
|
|
||||||
font-size: 11px;
|
|
||||||
color: var(--text-muted);
|
|
||||||
}
|
|
||||||
|
|
||||||
.coord-card {
|
|
||||||
display: none;
|
|
||||||
margin-top: 10px;
|
|
||||||
padding: 10px;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 6px;
|
|
||||||
background: var(--bg);
|
|
||||||
font-family: monospace;
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--text-light);
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width:980px) {
|
@media (max-width:980px) {
|
||||||
.map-page {
|
.map-page { height:auto; }
|
||||||
height: auto;
|
.map-layout { grid-template-columns:1fr; }
|
||||||
}
|
#map-container { height:64vh; }
|
||||||
|
|
||||||
.map-layout {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map-view {
|
|
||||||
height: 64vh;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.experimental-banner {
|
|
||||||
background: rgba(220, 38, 38, 0.12);
|
|
||||||
border: 1px solid rgba(220, 38, 38, 0.5);
|
|
||||||
border-left: 4px solid #dc2626;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 10px 14px;
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-start;
|
|
||||||
gap: 10px;
|
|
||||||
font-size: 13px;
|
|
||||||
line-height: 1.5;
|
|
||||||
color: var(--text);
|
|
||||||
}
|
|
||||||
.experimental-banner .banner-icon {
|
|
||||||
font-size: 18px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
.experimental-banner strong {
|
|
||||||
color: #ef4444;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
<div class="map-page">
|
<div class="map-page">
|
||||||
<div class="experimental-banner">
|
|
||||||
<span class="banner-icon">⚠</span>
|
|
||||||
<span class="banner-text">This map is still being woven through the spice haze. Your character might be standing on a Sandworm's nose and the map won't know the difference. <strong>Please do not report bugs on this feature</strong> - the Golden Path has not yet been revealed.</span>
|
|
||||||
</div>
|
|
||||||
<div class="map-header">
|
<div class="map-header">
|
||||||
<div>
|
|
||||||
<h2>World Map</h2>
|
<h2>World Map</h2>
|
||||||
{% if db_error %}
|
|
||||||
<div class="error-banner danger">{{ db_error }}</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="map-summary">
|
<div class="map-summary">
|
||||||
<div class="map-summary-item">
|
<div class="map-summary-item"><strong id="summary-players">0</strong><span>Players</span></div>
|
||||||
<strong id="summary-players">0</strong>
|
<div class="map-summary-item"><strong id="summary-vehicles">0</strong><span>Vehicles</span></div>
|
||||||
<span>Players</span>
|
<div class="map-summary-item"><strong id="summary-bases">0</strong><span>Bases</span></div>
|
||||||
</div>
|
|
||||||
<div class="map-summary-item">
|
|
||||||
<strong id="summary-vehicles">0</strong>
|
|
||||||
<span>Vehicles</span>
|
|
||||||
</div>
|
|
||||||
<div class="map-summary-item">
|
|
||||||
<strong id="summary-bases">0</strong>
|
|
||||||
<span>Bases</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="map-notice">
|
||||||
|
⚠ This page is still a work in progress - expect bugs and quirks. Base ownership names are inferred heuristically and may be inaccurate.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="map-layout">
|
<div class="map-layout">
|
||||||
<div class="map-view">
|
<div id="map-container">
|
||||||
<div class="map-scroll" id="map-scroll">
|
<div class="map-credit">Map images sourced from <a href="https://awakening.wiki/" target="_blank" rel="noopener">awakening.wiki</a> — a massive thank you for their incredible work mapping Arrakis!</div>
|
||||||
<div class="map-canvas" id="map-canvas">
|
|
||||||
<img class="map-image" id="map-image" alt="Selected map">
|
|
||||||
<div id="map-markers"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="map-image-credit">Map images sourced from <a href="https://awakening.wiki/" target="_blank" rel="noopener noreferrer">awakening.wiki</a> — thank you for the amazing resource!</div>
|
|
||||||
<div class="map-empty" id="map-empty" style="display:none;">
|
|
||||||
<strong>No markers on this map</strong>
|
|
||||||
<span>The selected map has no in-bounds players, vehicles, or bases yet.</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<aside class="map-panel">
|
<aside class="map-panel">
|
||||||
<section class="panel-section">
|
<section class="panel-section">
|
||||||
<h3 class="panel-title">Map</h3>
|
<h3 class="panel-title">Map</h3>
|
||||||
<div id="map-choices"></div>
|
<div id="map-choices"></div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="panel-section">
|
|
||||||
<h3 class="panel-title">Zoom</h3>
|
|
||||||
<div class="map-controls">
|
|
||||||
<button type="button" id="zoom-out" title="Zoom out">-</button>
|
|
||||||
<input type="range" id="zoom-slider" min="15" max="350" value="100" step="10">
|
|
||||||
<button type="button" id="zoom-in" title="Zoom in">+</button>
|
|
||||||
</div>
|
|
||||||
<div class="zoom-readout" id="zoom-readout">100%</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="panel-section">
|
<section class="panel-section">
|
||||||
<h3 class="panel-title">Assets</h3>
|
<h3 class="panel-title">Assets</h3>
|
||||||
<label class="map-toggle">
|
<label class="map-toggle"><span><i class="legend-dot player"></i>Players</span><input type="checkbox" data-type="player" checked></label>
|
||||||
<span><i class="legend-dot player"></i>Players</span>
|
<label class="map-toggle"><span><i class="legend-dot vehicle"></i>Vehicles</span><input type="checkbox" data-type="vehicle" checked></label>
|
||||||
<input type="checkbox" data-filter="player" checked>
|
<label class="map-toggle"><span><i class="legend-dot base"></i>Bases</span><input type="checkbox" data-type="base" checked></label>
|
||||||
</label>
|
|
||||||
<label class="map-toggle">
|
|
||||||
<span><i class="legend-dot vehicle"></i>Vehicles</span>
|
|
||||||
<input type="checkbox" data-filter="vehicle" checked>
|
|
||||||
</label>
|
|
||||||
<label class="map-toggle">
|
|
||||||
<span><i class="legend-dot base"></i>Bases</span>
|
|
||||||
<input type="checkbox" data-filter="base" checked>
|
|
||||||
</label>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="panel-section">
|
<section class="panel-section">
|
||||||
<h3 class="panel-title">Visible Assets</h3>
|
<h3 class="panel-title">Search</h3>
|
||||||
<div class="location-list" id="location-list"></div>
|
<input type="text" class="search-box" id="search-input" placeholder="Filter by name, type, or ID...">
|
||||||
<div class="coord-card" id="coord-card"></div>
|
</section>
|
||||||
|
<section class="panel-section" style="flex:1;min-height:0;display:flex;flex-direction:column;">
|
||||||
|
<h3 class="panel-title">Visible (<span id="list-count">0</span>)</h3>
|
||||||
|
<div class="location-list" id="location-list" style="flex:1;max-height:none;"></div>
|
||||||
</section>
|
</section>
|
||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block scripts %}
|
||||||
|
<script id="leaflet-src" src="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||||
|
<script>if (typeof L === 'undefined') { document.getElementById('map-container').innerHTML = '<div style="display:flex;align-items:center;justify-content:center;height:100%;color:var(--text-muted);padding:40px;text-align:center"><div><h3>Map library failed to load</h3><p>Check network connectivity or refresh the page.</p></div></div>'; }</script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/leaflet.markercluster@1.5.3/dist/leaflet.markercluster.js"></script>
|
||||||
<script>
|
<script>
|
||||||
const mapOptions = {{ map_options|tojson }};
|
const mapOptions = {{ map_options|tojson }};
|
||||||
const markers = [
|
const allMarkers = [
|
||||||
...{{ players|tojson }},
|
...{{ players|tojson }},
|
||||||
...{{ vehicles|tojson }},
|
...{{ vehicles|tojson }},
|
||||||
...{{ buildings|tojson }}
|
...{{ buildings|tojson }}
|
||||||
@@ -473,258 +111,237 @@ const mapImageUrls = {
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
};
|
};
|
||||||
|
|
||||||
let currentMap = "HaggaBasin";
|
let currentMap = "{{ default_map }}";
|
||||||
let currentZoom = 0;
|
let mapInstance = null;
|
||||||
let defaultZoom = 0.15;
|
let markerClusterGroup = null;
|
||||||
|
let allLayers = { player: [], vehicle: [], base: [] };
|
||||||
let activeMarkerId = null;
|
let activeMarkerId = null;
|
||||||
|
let searchQuery = '';
|
||||||
const enabledTypes = { player: true, vehicle: true, base: true };
|
const enabledTypes = { player: true, vehicle: true, base: true };
|
||||||
|
const typeColors = { player: '#e7c65b', vehicle: '#45a3ff', base: '#54c878' };
|
||||||
|
|
||||||
const mapDefaultZoom = 0.15;
|
function markerKey(m) { return `${m.type}-${m.id}`; }
|
||||||
currentZoom = mapDefaultZoom;
|
function markerLabel(m) {
|
||||||
defaultZoom = mapDefaultZoom;
|
if (m.type === 'player') return m.name || `Player ${m.id}`;
|
||||||
|
if (m.type === 'vehicle') {
|
||||||
const els = {
|
const className = m.class || m.name || `Vehicle ${m.id}`;
|
||||||
choices: document.getElementById('map-choices'),
|
return className;
|
||||||
scroll: document.getElementById('map-scroll'),
|
|
||||||
canvas: document.getElementById('map-canvas'),
|
|
||||||
image: document.getElementById('map-image'),
|
|
||||||
markers: document.getElementById('map-markers'),
|
|
||||||
empty: document.getElementById('map-empty'),
|
|
||||||
list: document.getElementById('location-list'),
|
|
||||||
coord: document.getElementById('coord-card'),
|
|
||||||
zoomSlider: document.getElementById('zoom-slider'),
|
|
||||||
zoomReadout: document.getElementById('zoom-readout'),
|
|
||||||
summaryPlayers: document.getElementById('summary-players'),
|
|
||||||
summaryVehicles: document.getElementById('summary-vehicles'),
|
|
||||||
summaryBases: document.getElementById('summary-bases'),
|
|
||||||
};
|
|
||||||
|
|
||||||
function markerKey(marker) {
|
|
||||||
return `${marker.type}-${marker.id}`;
|
|
||||||
}
|
}
|
||||||
|
if (m.type === 'base') return m.name || m.class || `Base ${m.id}`;
|
||||||
function escapeHtml(value) {
|
return m.name || m.class || '';
|
||||||
return String(value ?? '').replace(/[&<>"']/g, char => ({
|
|
||||||
'&': '&',
|
|
||||||
'<': '<',
|
|
||||||
'>': '>',
|
|
||||||
'"': '"',
|
|
||||||
"'": '''
|
|
||||||
}[char]));
|
|
||||||
}
|
}
|
||||||
|
function escapeHtml(v) {
|
||||||
function markerLabel(marker) {
|
return String(v ?? '').replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
||||||
if (marker.type === 'player') return marker.name || `Player ${marker.id}`;
|
|
||||||
if (marker.type === 'vehicle') return marker.class || `Vehicle ${marker.id}`;
|
|
||||||
return marker.name || marker.class || `Base ${marker.id}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectedMapConfig() {
|
function selectedMapConfig() {
|
||||||
return mapOptions.find(map => map.key === currentMap) || mapOptions[0] || null;
|
return mapOptions.find(m => m.key === currentMap) || mapOptions[0] || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function visibleMarkers() {
|
function markersForCurrentMap() {
|
||||||
return markers.filter(marker =>
|
return allMarkers.filter(m => m.map === currentMap && m.in_bounds && enabledTypes[m.type]);
|
||||||
marker.map === currentMap &&
|
}
|
||||||
marker.in_bounds &&
|
|
||||||
enabledTypes[marker.type]
|
function initMap() {
|
||||||
|
const cfg = selectedMapConfig();
|
||||||
|
if (!cfg) return;
|
||||||
|
|
||||||
|
if (mapInstance) {
|
||||||
|
mapInstance.remove();
|
||||||
|
mapInstance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
mapInstance = L.map('map-container', {
|
||||||
|
crs: L.CRS.Simple,
|
||||||
|
zoomControl: true,
|
||||||
|
zoomSnap: 0.5,
|
||||||
|
zoomDelta: 1,
|
||||||
|
minZoom: -4,
|
||||||
|
maxZoom: 5,
|
||||||
|
renderer: L.canvas({ padding: 0.5 }),
|
||||||
|
attributionControl: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
var overlayBounds = [[-cfg.height, 0], [0, cfg.width]];
|
||||||
|
L.imageOverlay(mapImageUrls[cfg.key] || '', overlayBounds).addTo(mapInstance);
|
||||||
|
mapInstance.fitBounds(overlayBounds, { padding: [0, 0] });
|
||||||
|
mapInstance.setMinZoom(mapInstance.getZoom());
|
||||||
|
mapInstance.setMaxBounds(overlayBounds);
|
||||||
|
|
||||||
|
markerClusterGroup = (typeof L.markerClusterGroup !== 'undefined')
|
||||||
|
? L.markerClusterGroup({
|
||||||
|
chunkedLoading: true,
|
||||||
|
maxClusterRadius: 5,
|
||||||
|
spiderfyOnMaxZoom: true,
|
||||||
|
showCoverageOnHover: false,
|
||||||
|
iconCreateFunction: function(cluster) {
|
||||||
|
var count = cluster.getChildCount();
|
||||||
|
return L.divIcon({
|
||||||
|
html: '<div style="background:rgba(231,198,91,0.88);border:2px solid #fff;border-radius:999px;width:34px;height:34px;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;color:#111">' + count + '</div>',
|
||||||
|
className: '',
|
||||||
|
iconSize: L.point(34, 34),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
: L.layerGroup();
|
||||||
|
mapInstance.addLayer(markerClusterGroup);
|
||||||
|
|
||||||
|
mapInstance.whenReady(function() { mapInstance.invalidateSize(); });
|
||||||
|
|
||||||
|
renderAllMarkers();
|
||||||
|
}
|
||||||
|
|
||||||
|
function createMarker(m) {
|
||||||
|
const color = typeColors[m.type] || '#888';
|
||||||
|
const py = m.py ?? 0;
|
||||||
|
const px = m.px ?? 0;
|
||||||
|
|
||||||
|
const marker = L.circleMarker([-py, px], {
|
||||||
|
radius: 6,
|
||||||
|
fillColor: color,
|
||||||
|
color: '#fff',
|
||||||
|
weight: 1.5,
|
||||||
|
fillOpacity: 0.88,
|
||||||
|
bubblingMouseEvents: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const label = markerLabel(m);
|
||||||
|
let tooltipHtml = `<strong>${escapeHtml(m.type.toUpperCase())}</strong>: ${escapeHtml(label)}`;
|
||||||
|
tooltipHtml += `<br>${Number(m.x).toFixed(0)}, ${Number(m.y).toFixed(0)}`;
|
||||||
|
marker.bindTooltip(tooltipHtml,
|
||||||
|
{ direction: 'top', offset: [0, -8], className: 'marker-tooltip' }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
marker.on('click', function() { selectMarker(markerKey(m)); });
|
||||||
|
marker._dune = { data: m, key: markerKey(m) };
|
||||||
|
return marker;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setZoom(nextZoom, keepCenter = true) {
|
function renderAllMarkers() {
|
||||||
const map = selectedMapConfig();
|
markerClusterGroup.clearLayers();
|
||||||
if (!map) return;
|
allLayers = { player: [], vehicle: [], base: [] };
|
||||||
|
|
||||||
currentZoom = Math.min(3.5, Math.max(0.15, nextZoom));
|
markersForCurrentMap().forEach(m => {
|
||||||
|
if (!searchQuery || matchesSearch(m)) {
|
||||||
|
const layer = createMarker(m);
|
||||||
|
allLayers[m.type].push(layer);
|
||||||
|
markerClusterGroup.addLayer(layer);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
els.canvas.style.width = `${map.width * currentZoom}px`;
|
updateSummary();
|
||||||
els.canvas.style.height = `${map.height * currentZoom}px`;
|
renderList();
|
||||||
els.zoomSlider.value = Math.round(currentZoom * 100);
|
}
|
||||||
els.zoomReadout.textContent = `${Math.round(currentZoom * 100)}%`;
|
|
||||||
|
function matchesSearch(m) {
|
||||||
|
if (!searchQuery) return true;
|
||||||
|
const q = searchQuery.toLowerCase();
|
||||||
|
const label = markerLabel(m).toLowerCase();
|
||||||
|
return label.includes(q) || m.type.includes(q) || String(m.id).includes(q);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateSummary() {
|
||||||
|
document.getElementById('summary-players').textContent = allLayers.player.length;
|
||||||
|
document.getElementById('summary-vehicles').textContent = allLayers.vehicle.length;
|
||||||
|
document.getElementById('summary-bases').textContent = allLayers.base.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectMarker(key) {
|
||||||
|
activeMarkerId = key;
|
||||||
|
const m = allMarkers.find(c => markerKey(c) === key);
|
||||||
|
if (!m || !mapInstance) return;
|
||||||
|
|
||||||
|
mapInstance.setView([-(m.py ?? 0), m.px ?? 0], Math.max(mapInstance.getZoom(), 2), { animate: true });
|
||||||
|
renderList();
|
||||||
|
|
||||||
|
const listEl = document.getElementById('location-list');
|
||||||
|
const item = listEl.querySelector(`[data-marker-key="${key}"]`);
|
||||||
|
if (item) {
|
||||||
|
item.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderList() {
|
||||||
|
const list = document.getElementById('location-list');
|
||||||
|
const countEl = document.getElementById('list-count');
|
||||||
|
const items = [];
|
||||||
|
|
||||||
|
for (const [type, layers] of Object.entries(allLayers)) {
|
||||||
|
for (const layer of layers) {
|
||||||
|
const m = layer._dune && layer._dune.data;
|
||||||
|
if (!m || (searchQuery && !matchesSearch(m))) continue;
|
||||||
|
items.push({ m, type });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
items.sort((a, b) => a.type.localeCompare(b.type) || markerLabel(a.m).localeCompare(markerLabel(b.m)));
|
||||||
|
countEl.textContent = items.length;
|
||||||
|
list.innerHTML = '';
|
||||||
|
|
||||||
|
if (!items.length) {
|
||||||
|
const empty = document.createElement('div');
|
||||||
|
empty.className = 'location-item';
|
||||||
|
empty.innerHTML = '<strong>No matching assets</strong>';
|
||||||
|
list.appendChild(empty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
items.forEach(({ m, type }) => {
|
||||||
|
const key = markerKey(m);
|
||||||
|
const label = escapeHtml(markerLabel(m));
|
||||||
|
const item = document.createElement('div');
|
||||||
|
item.className = `location-item${activeMarkerId === key ? ' active' : ''}`;
|
||||||
|
item.dataset.markerKey = key;
|
||||||
|
item.innerHTML = `
|
||||||
|
<strong><i class="legend-dot ${type}"></i>${label}</strong>
|
||||||
|
<span class="meta">${type}</span>
|
||||||
|
<span class="meta">${Number(m.x).toFixed(0)}, ${Number(m.y).toFixed(0)}</span>
|
||||||
|
`;
|
||||||
|
item.addEventListener('click', () => selectMarker(key));
|
||||||
|
list.appendChild(item);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function switchMap(mapKey) {
|
||||||
|
currentMap = mapKey;
|
||||||
|
activeMarkerId = null;
|
||||||
|
initMap();
|
||||||
|
renderChoices();
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderChoices() {
|
function renderChoices() {
|
||||||
els.choices.innerHTML = '';
|
const container = document.getElementById('map-choices');
|
||||||
const sortedMaps = [...mapOptions].sort((a, b) => {
|
container.innerHTML = '';
|
||||||
|
|
||||||
|
const sorted = [...mapOptions].sort((a, b) => {
|
||||||
if (a.key === 'HaggaBasin') return -1;
|
if (a.key === 'HaggaBasin') return -1;
|
||||||
if (b.key === 'HaggaBasin') return 1;
|
if (b.key === 'HaggaBasin') return 1;
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
sortedMaps.forEach(map => {
|
|
||||||
const button = document.createElement('button');
|
sorted.forEach(map => {
|
||||||
button.type = 'button';
|
const btn = document.createElement('button');
|
||||||
button.className = `map-choice${map.key === currentMap ? ' active' : ''}`;
|
btn.className = `map-choice${map.key === currentMap ? ' active' : ''}`;
|
||||||
button.innerHTML = `
|
btn.innerHTML = `<strong>${escapeHtml(map.label)}</strong><span class="counts">${map.counts.players}P / ${map.counts.vehicles}V / ${map.counts.bases}B</span>`;
|
||||||
<strong>${escapeHtml(map.label)}</strong>
|
btn.addEventListener('click', () => switchMap(map.key));
|
||||||
<span>${map.counts.players} P / ${map.counts.vehicles} V / ${map.counts.bases} B</span>
|
container.appendChild(btn);
|
||||||
<span>${escapeHtml(map.key)}</span>
|
});
|
||||||
<span>${map.width} x ${map.height}</span>
|
}
|
||||||
`;
|
|
||||||
button.addEventListener('click', () => {
|
document.querySelectorAll('[data-type]').forEach(input => {
|
||||||
currentMap = map.key;
|
input.addEventListener('change', function() {
|
||||||
|
enabledTypes[this.dataset.type] = this.checked;
|
||||||
activeMarkerId = null;
|
activeMarkerId = null;
|
||||||
renderAll(true);
|
renderAllMarkers();
|
||||||
});
|
});
|
||||||
els.choices.appendChild(button);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderMarkers() {
|
|
||||||
const map = selectedMapConfig();
|
|
||||||
const current = visibleMarkers();
|
|
||||||
els.markers.innerHTML = '';
|
|
||||||
|
|
||||||
current.forEach(marker => {
|
|
||||||
const key = markerKey(marker);
|
|
||||||
const label = escapeHtml(markerLabel(marker));
|
|
||||||
const node = document.createElement('button');
|
|
||||||
node.type = 'button';
|
|
||||||
node.className = `map-marker ${marker.type}${activeMarkerId === key ? ' active' : ''}`;
|
|
||||||
node.style.left = `${(marker.px / map.width) * 100}%`;
|
|
||||||
node.style.top = `${(marker.py / map.height) * 100}%`;
|
|
||||||
node.title = markerLabel(marker);
|
|
||||||
node.innerHTML = `
|
|
||||||
<span class="map-tooltip">
|
|
||||||
${label}<br>
|
|
||||||
${escapeHtml(marker.type.toUpperCase())} | X ${Number(marker.x).toFixed(0)} Y ${Number(marker.y).toFixed(0)}
|
|
||||||
</span>
|
|
||||||
`;
|
|
||||||
node.addEventListener('click', () => selectMarker(key, true));
|
|
||||||
els.markers.appendChild(node);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
els.empty.style.display = current.length ? 'none' : 'flex';
|
document.getElementById('search-input').addEventListener('input', function() {
|
||||||
}
|
searchQuery = this.value.trim();
|
||||||
|
renderAllMarkers();
|
||||||
function renderList() {
|
|
||||||
const current = visibleMarkers();
|
|
||||||
els.list.innerHTML = '';
|
|
||||||
|
|
||||||
if (!current.length) {
|
|
||||||
const empty = document.createElement('div');
|
|
||||||
empty.className = 'location-item';
|
|
||||||
empty.innerHTML = '<strong>No visible assets</strong><span>Adjust map or filters</span>';
|
|
||||||
els.list.appendChild(empty);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
current
|
|
||||||
.sort((a, b) => a.type.localeCompare(b.type) || markerLabel(a).localeCompare(markerLabel(b)))
|
|
||||||
.forEach(marker => {
|
|
||||||
const key = markerKey(marker);
|
|
||||||
const label = escapeHtml(markerLabel(marker));
|
|
||||||
const item = document.createElement('button');
|
|
||||||
item.type = 'button';
|
|
||||||
item.className = `location-item${activeMarkerId === key ? ' active' : ''}`;
|
|
||||||
item.dataset.markerKey = key;
|
|
||||||
item.innerHTML = `
|
|
||||||
<strong><i class="legend-dot ${marker.type}"></i>${label}</strong>
|
|
||||||
<span>${escapeHtml(marker.type)}</span>
|
|
||||||
<span>X ${Number(marker.x).toFixed(0)} | Y ${Number(marker.y).toFixed(0)}</span>
|
|
||||||
<span>Z ${Number(marker.z).toFixed(0)}</span>
|
|
||||||
`;
|
|
||||||
item.addEventListener('click', () => selectMarker(key, true));
|
|
||||||
els.list.appendChild(item);
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
function renderSummary() {
|
|
||||||
const scoped = markers.filter(marker => marker.map === currentMap && marker.in_bounds);
|
|
||||||
els.summaryPlayers.textContent = scoped.filter(marker => marker.type === 'player').length;
|
|
||||||
els.summaryVehicles.textContent = scoped.filter(marker => marker.type === 'vehicle').length;
|
|
||||||
els.summaryBases.textContent = scoped.filter(marker => marker.type === 'base').length;
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectMarker(key, centerMap = false) {
|
|
||||||
activeMarkerId = key;
|
|
||||||
const marker = markers.find(candidate => markerKey(candidate) === key);
|
|
||||||
if (!marker) return;
|
|
||||||
|
|
||||||
els.coord.style.display = 'block';
|
|
||||||
els.coord.innerHTML = `
|
|
||||||
<strong>${escapeHtml(markerLabel(marker))}</strong><br>
|
|
||||||
Type: ${escapeHtml(marker.type)}<br>
|
|
||||||
Map: ${escapeHtml(marker.map)}<br>
|
|
||||||
X: ${Number(marker.x).toFixed(2)} | Y: ${Number(marker.y).toFixed(2)} | Z: ${Number(marker.z).toFixed(2)}
|
|
||||||
`;
|
|
||||||
|
|
||||||
if (centerMap) {
|
|
||||||
els.scroll.scrollLeft = marker.px * currentZoom - els.scroll.clientWidth / 2;
|
|
||||||
els.scroll.scrollTop = marker.py * currentZoom - els.scroll.clientHeight / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderMarkers();
|
|
||||||
renderList();
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderAll(resetView = false) {
|
|
||||||
const map = selectedMapConfig();
|
|
||||||
renderChoices();
|
renderChoices();
|
||||||
|
setTimeout(() => { initMap(); }, 100);
|
||||||
if (!map) {
|
|
||||||
els.empty.style.display = 'flex';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
els.image.src = mapImageUrls[map.key] || '';
|
|
||||||
els.image.alt = map.label;
|
|
||||||
const mapDefaultZoom = map.default_zoom || 0.15;
|
|
||||||
setZoom(mapDefaultZoom, false);
|
|
||||||
currentZoom = mapDefaultZoom;
|
|
||||||
|
|
||||||
requestAnimationFrame(() => {
|
|
||||||
els.scroll.scrollLeft = 0;
|
|
||||||
els.scroll.scrollTop = 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
renderSummary();
|
|
||||||
renderMarkers();
|
|
||||||
renderList();
|
|
||||||
}
|
|
||||||
|
|
||||||
document.querySelectorAll('[data-filter]').forEach(input => {
|
|
||||||
input.addEventListener('change', () => {
|
|
||||||
enabledTypes[input.dataset.filter] = input.checked;
|
|
||||||
activeMarkerId = null;
|
|
||||||
els.coord.style.display = 'none';
|
|
||||||
renderMarkers();
|
|
||||||
renderList();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
document.getElementById('zoom-in').addEventListener('click', () => setZoom(currentZoom + 0.1));
|
|
||||||
document.getElementById('zoom-out').addEventListener('click', () => setZoom(currentZoom - 0.1));
|
|
||||||
els.zoomSlider.addEventListener('input', event => setZoom(Number(event.target.value) / 100));
|
|
||||||
|
|
||||||
els.scroll.addEventListener('wheel', event => {
|
|
||||||
if (!event.ctrlKey && !event.metaKey) return;
|
|
||||||
event.preventDefault();
|
|
||||||
setZoom(currentZoom + (event.deltaY < 0 ? 0.1 : -0.1));
|
|
||||||
}, { passive: false });
|
|
||||||
|
|
||||||
let dragStart = null;
|
|
||||||
els.scroll.addEventListener('mousedown', event => {
|
|
||||||
if (event.button !== 0) return;
|
|
||||||
dragStart = {
|
|
||||||
x: event.clientX,
|
|
||||||
y: event.clientY,
|
|
||||||
left: els.scroll.scrollLeft,
|
|
||||||
top: els.scroll.scrollTop,
|
|
||||||
};
|
|
||||||
els.scroll.classList.add('dragging');
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener('mousemove', event => {
|
|
||||||
if (!dragStart) return;
|
|
||||||
els.scroll.scrollLeft = dragStart.left - (event.clientX - dragStart.x);
|
|
||||||
els.scroll.scrollTop = dragStart.top - (event.clientY - dragStart.y);
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener('mouseup', () => {
|
|
||||||
dragStart = null;
|
|
||||||
els.scroll.classList.remove('dragging');
|
|
||||||
});
|
|
||||||
|
|
||||||
renderAll(true);
|
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
+20
-20
@@ -151,7 +151,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{% if deploys_ok %}
|
{% if deploys_ok %}
|
||||||
<div style="margin-bottom:10px;padding:10px;background:#1a1a2e;border-radius:6px;font-size:12px;line-height:1.5;color:#a0a0b0;">
|
<div style="margin-bottom:10px;padding:10px;background:var(--bg);border-radius:6px;font-size:12px;line-height:1.5;color:var(--text-light);">
|
||||||
<strong>Button Guide:</strong>
|
<strong>Button Guide:</strong>
|
||||||
<span style="display:inline-block;margin:0 10px 0 4px;"><span style="color:#e67e22;">Restart</span> — rolling restart of pods</span>
|
<span style="display:inline-block;margin:0 10px 0 4px;"><span style="color:#e67e22;">Restart</span> — rolling restart of pods</span>
|
||||||
<span style="display:inline-block;margin:0 10px 0 4px;"><span style="color:#3498db;">Status</span> — rollout status</span>
|
<span style="display:inline-block;margin:0 10px 0 4px;"><span style="color:#3498db;">Status</span> — rollout status</span>
|
||||||
@@ -182,12 +182,12 @@
|
|||||||
<code>$env:TEMP\dune-awakening-server-sshKey</code> and the VM is reachable.
|
<code>$env:TEMP\dune-awakening-server-sshKey</code> and the VM is reachable.
|
||||||
</p>
|
</p>
|
||||||
{% if ssh_error %}
|
{% if ssh_error %}
|
||||||
<pre style="background:#1a1a2e;color:#e74c3c;padding:12px;border-radius:6px;font-size:12px;margin-top:8px;">{{ ssh_error }}</pre>
|
<pre style="background:var(--bg);color:var(--danger);padding:12px;border-radius:6px;font-size:12px;margin-top:8px;">{{ ssh_error }}</pre>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div id="action-output" style="margin-top:16px;display:none;">
|
<div id="action-output" style="margin-top:16px;display:none;">
|
||||||
<div class="card-header">Command Output</div>
|
<div class="card-header">Command Output</div>
|
||||||
<pre id="action-output-text" style="background:#1a1a2e;color:#e0d5c7;padding:16px;border-radius:8px;font-size:12px;overflow-x:auto;white-space:pre-wrap;margin-top:8px;"></pre>
|
<pre id="action-output-text" style="background:var(--bg);color:var(--text);padding:16px;border-radius:8px;font-size:12px;overflow-x:auto;white-space:pre-wrap;margin-top:8px;"></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -206,7 +206,7 @@
|
|||||||
<button id="bg-btn-refresh" style="padding:8px 20px;background:var(--primary);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:13px;">Refresh Status</button>
|
<button id="bg-btn-refresh" style="padding:8px 20px;background:var(--primary);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:13px;">Refresh Status</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="bg-status-output">
|
<div id="bg-status-output">
|
||||||
<pre id="bg-status-text" style="background:#1a1a2e;color:#e0d5c7;padding:16px;border-radius:8px;font-size:12px;overflow-x:auto;white-space:pre-wrap;min-height:100px;">Click "Refresh Status" to load battlegroup status...</pre>
|
<pre id="bg-status-text" style="background:var(--bg);color:var(--text);padding:16px;border-radius:8px;font-size:12px;overflow-x:auto;white-space:pre-wrap;min-height:100px;">Click "Refresh Status" to load battlegroup status...</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -216,7 +216,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<button id="refresh-pods" style="padding:8px 16px;background:var(--primary);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:13px;">Refresh Pods</button>
|
<button id="refresh-pods" style="padding:8px 16px;background:var(--primary);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:13px;">Refresh Pods</button>
|
||||||
<div id="pods-output" style="margin-top:12px;">
|
<div id="pods-output" style="margin-top:12px;">
|
||||||
<pre id="pods-text" style="background:#1a1a2e;color:#e0d5c7;padding:16px;border-radius:8px;font-size:12px;overflow-x:auto;white-space:pre-wrap;">Click refresh to load pod status...</pre>
|
<pre id="pods-text" style="background:var(--bg);color:var(--text);padding:16px;border-radius:8px;font-size:12px;overflow-x:auto;white-space:pre-wrap;">Click refresh to load pod status...</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -227,8 +227,8 @@
|
|||||||
<span id="debug-status" style="font-size:12px;color:var(--text-muted);">Loading...</span>
|
<span id="debug-status" style="font-size:12px;color:var(--text-muted);">Loading...</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body" id="debug-section">
|
<div class="card-body" id="debug-section">
|
||||||
<div style="margin-bottom:12px;padding:12px;background:#1a1a2e;border-radius:6px;font-size:13px;line-height:1.6;color:#e0d5c7;">
|
<div style="margin-bottom:12px;padding:12px;background:var(--bg);border-radius:6px;font-size:13px;line-height:1.6;color:var(--text);">
|
||||||
<strong style="color:#9b59b6;">📝 Verbose Logging:</strong> Enable to log detailed information about SSH commands, API requests, database queries, and service connections.
|
<strong style="color:var(--primary);">📝 Verbose Logging:</strong> Enable to log detailed information about SSH commands, API requests, database queries, and service connections.
|
||||||
Logs are written to <code>logs/debug.log</code>. Sanitizes sensitive data (passwords, tokens) automatically.
|
Logs are written to <code>logs/debug.log</code>. Sanitizes sensitive data (passwords, tokens) automatically.
|
||||||
</div>
|
</div>
|
||||||
<div style="display:flex;align-items:center;gap:16px;">
|
<div style="display:flex;align-items:center;gap:16px;">
|
||||||
@@ -248,16 +248,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body" id="audit-section">
|
<div class="card-body" id="audit-section">
|
||||||
<div style="margin-bottom:12px;display:flex;gap:12px;align-items:center;flex-wrap:wrap;">
|
<div style="margin-bottom:12px;display:flex;gap:12px;align-items:center;flex-wrap:wrap;">
|
||||||
<input type="text" id="audit-search" placeholder="Filter by action..." style="padding:8px 12px;background:#1a1a2e;border:1px solid #333;border-radius:6px;color:#e0d5c7;font-size:13px;width:180px;">
|
<input type="text" id="audit-search" placeholder="Filter by action..." style="padding:8px 12px;background:var(--bg);border:1px solid var(--border);border-radius:6px;color:var(--text);font-size:13px;width:180px;">
|
||||||
<input type="text" id="audit-user" placeholder="Filter by user..." style="padding:8px 12px;background:#1a1a2e;border:1px solid #333;border-radius:6px;color:#e0d5c7;font-size:13px;width:140px;">
|
<input type="text" id="audit-user" placeholder="Filter by user..." style="padding:8px 12px;background:var(--bg);border:1px solid var(--border);border-radius:6px;color:var(--text);font-size:13px;width:140px;">
|
||||||
<select id="audit-severity" style="padding:8px 12px;background:#1a1a2e;border:1px solid #333;border-radius:6px;color:#e0d5c7;font-size:13px;">
|
<select id="audit-severity" style="padding:8px 12px;background:var(--bg);border:1px solid var(--border);border-radius:6px;color:var(--text);font-size:13px;">
|
||||||
<option value="">All Severities</option>
|
<option value="">All Severities</option>
|
||||||
<option value="info">Info</option>
|
<option value="info">Info</option>
|
||||||
<option value="warning">Warning</option>
|
<option value="warning">Warning</option>
|
||||||
<option value="error">Error</option>
|
<option value="error">Error</option>
|
||||||
</select>
|
</select>
|
||||||
<button onclick="loadAuditLogs()" style="padding:8px 16px;background:var(--primary);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:13px;">Filter</button>
|
<button onclick="loadAuditLogs()" style="padding:8px 16px;background:var(--primary);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:13px;">Filter</button>
|
||||||
<button onclick="refreshAuditLogs()" style="padding:8px 16px;background:#333;color:#e0d5c7;border:none;border-radius:6px;cursor:pointer;font-size:13px;">Refresh</button>
|
<button onclick="refreshAuditLogs()" style="padding:8px 16px;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:6px;cursor:pointer;font-size:13px;">Refresh</button>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom:12px;display:flex;gap:16px;font-size:12px;color:var(--text-muted);">
|
<div style="margin-bottom:12px;display:flex;gap:16px;font-size:12px;color:var(--text-muted);">
|
||||||
<span>Total: <strong id="audit-total">0</strong></span>
|
<span>Total: <strong id="audit-total">0</strong></span>
|
||||||
@@ -267,13 +267,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="audit-logs-container" style="max-height:300px;overflow-y:auto;">
|
<div id="audit-logs-container" style="max-height:300px;overflow-y:auto;">
|
||||||
<table style="width:100%;border-collapse:collapse;font-size:12px;">
|
<table style="width:100%;border-collapse:collapse;font-size:12px;">
|
||||||
<thead style="position:sticky;top:0;background:#2a2a3e;">
|
<thead style="position:sticky;top:0;background:var(--table-header);">
|
||||||
<tr style="text-align:left;color:var(--text-muted);">
|
<tr style="text-align:left;color:var(--text-muted);">
|
||||||
<th style="padding:8px;border-bottom:1px solid #333;">Time</th>
|
<th style="padding:8px;border-bottom:1px solid var(--border);">Time</th>
|
||||||
<th style="padding:8px;border-bottom:1px solid #333;">Action</th>
|
<th style="padding:8px;border-bottom:1px solid var(--border);">Action</th>
|
||||||
<th style="padding:8px;border-bottom:1px solid #333;">User</th>
|
<th style="padding:8px;border-bottom:1px solid var(--border);">User</th>
|
||||||
<th style="padding:8px;border-bottom:1px solid #333;">Severity</th>
|
<th style="padding:8px;border-bottom:1px solid var(--border);">Severity</th>
|
||||||
<th style="padding:8px;border-bottom:1px solid #333;">Details</th>
|
<th style="padding:8px;border-bottom:1px solid var(--border);">Details</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="audit-logs-body">
|
<tbody id="audit-logs-body">
|
||||||
@@ -290,14 +290,14 @@
|
|||||||
<span id="fw-status-indicator" style="font-size:12px;color:var(--text-muted);">Loading...</span>
|
<span id="fw-status-indicator" style="font-size:12px;color:var(--text-muted);">Loading...</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div style="margin-bottom:12px;padding:12px;background:#1a1a2e;border-radius:6px;font-size:13px;line-height:1.6;">
|
<div style="margin-bottom:12px;padding:12px;background:var(--bg);border-radius:6px;font-size:13px;line-height:1.6;">
|
||||||
<strong style="color:#e74c3c;">Security Recommendation:</strong> The following services are exposed to the internet without authentication.
|
<strong style="color:#e74c3c;">Security Recommendation:</strong> The following services are exposed to the internet without authentication.
|
||||||
Block them so only localhost (the dashboard via SSH tunnel) can reach them.
|
Block them so only localhost (the dashboard via SSH tunnel) can reach them.
|
||||||
</div>
|
</div>
|
||||||
<div id="fw-ports-list" style="margin-bottom:16px;"></div>
|
<div id="fw-ports-list" style="margin-bottom:16px;"></div>
|
||||||
<button id="fw-btn-refresh" style="padding:8px 20px;background:var(--primary);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:13px;">Refresh Status</button>
|
<button id="fw-btn-refresh" style="padding:8px 20px;background:var(--primary);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:13px;">Refresh Status</button>
|
||||||
<div id="fw-action-output" style="margin-top:12px;display:none;">
|
<div id="fw-action-output" style="margin-top:12px;display:none;">
|
||||||
<pre id="fw-action-text" style="background:#1a1a2e;color:#e0d5c7;padding:12px;border-radius:8px;font-size:12px;overflow-x:auto;white-space:pre-wrap;"></pre>
|
<pre id="fw-action-text" style="background:var(--bg);color:var(--text);padding:12px;border-radius:8px;font-size:12px;overflow-x:auto;white-space:pre-wrap;"></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -600,7 +600,7 @@ async function loadAuditLogs(action = '', user = '', severity = '', limit = 100,
|
|||||||
const details = log.details ? JSON.stringify(log.details) : '-';
|
const details = log.details ? JSON.stringify(log.details) : '-';
|
||||||
const severityColor = log.severity === 'error' ? 'color:#e74c3c;' : (log.severity === 'warning' ? 'color:#f39c12;' : 'color:#3498db;');
|
const severityColor = log.severity === 'error' ? 'color:#e74c3c;' : (log.severity === 'warning' ? 'color:#f39c12;' : 'color:#3498db;');
|
||||||
const timestamp = log.timestamp ? log.timestamp.replace('T', ' ').substring(0, 19) : '-';
|
const timestamp = log.timestamp ? log.timestamp.replace('T', ' ').substring(0, 19) : '-';
|
||||||
return '<tr style="border-bottom:1px solid #333;">' +
|
return '<tr style="border-bottom:1px solid var(--border);">' +
|
||||||
'<td style="padding:8px;color:var(--text-muted);">' + timestamp + '</td>' +
|
'<td style="padding:8px;color:var(--text-muted);">' + timestamp + '</td>' +
|
||||||
'<td style="padding:8px;font-weight:600;">' + (log.action || '-') + '</td>' +
|
'<td style="padding:8px;font-weight:600;">' + (log.action || '-') + '</td>' +
|
||||||
'<td style="padding:8px;">' + (log.user || '-') + '</td>' +
|
'<td style="padding:8px;">' + (log.user || '-') + '</td>' +
|
||||||
|
|||||||
Reference in new issue
Block a user