Update to latest version
This commit is contained in:
1 parent
7125e29993
commit
c74ef9cf9c
15 files changed
+191
-70
No files matched your search
+8
-4
@@ -45,8 +45,8 @@ DEFAULTS = {
|
||||
'port': 18888,
|
||||
},
|
||||
'firewall': {
|
||||
'block_filebrowser': False,
|
||||
'block_director': False,
|
||||
'block_filebrowser': True,
|
||||
'block_director': True,
|
||||
'block_postgres': True,
|
||||
},
|
||||
'cache': {
|
||||
@@ -171,17 +171,21 @@ def load_settings(settings_path=None):
|
||||
# Backward compatibility: migrate old plaintext password to hash
|
||||
# This is a one-time migration that hashes the password and removes plaintext
|
||||
auth = settings.get('auth', {})
|
||||
password_migrated = False
|
||||
if auth.get('password') and not auth.get('password_hash'):
|
||||
try:
|
||||
from argon2 import PasswordHasher
|
||||
ph = PasswordHasher()
|
||||
settings['auth']['password_hash'] = ph.hash(str(auth['password']))
|
||||
# Remove plaintext after hashing
|
||||
del settings['auth']['password']
|
||||
password_migrated = True
|
||||
logger.info("Migrated plaintext password to Argon2 hash")
|
||||
except ImportError:
|
||||
logger.error("argon2-cffi not installed. Password hashing unavailable.")
|
||||
# Fallback: keep plaintext for now but log warning
|
||||
settings['auth']['password_hash'] = None
|
||||
|
||||
if password_migrated:
|
||||
settings['dashboard']['secret_key'] = secrets.token_hex(32)
|
||||
logger.warning("Rotated secret_key to invalidate sessions after password migration")
|
||||
|
||||
return settings
|
||||
+1
-1
@@ -24,7 +24,7 @@ def init_auth(app, settings, limiter=None):
|
||||
return None
|
||||
|
||||
@app.route('/login', methods=['GET', 'POST'])
|
||||
@limiter.limit("10 per minute") if limiter else lambda f: f
|
||||
@limiter.limit("5 per hour") if limiter else lambda f: f
|
||||
def login():
|
||||
if current_user.is_authenticated:
|
||||
return redirect(url_for('overview'))
|
||||
|
||||
+16
-6
@@ -317,14 +317,24 @@ def register_routes(app, services, settings):
|
||||
def events_page():
|
||||
game_events = []
|
||||
event_logs = []
|
||||
|
||||
def safe_query(table, cols, order_col, limit):
|
||||
try:
|
||||
return db.query(f"SELECT {cols} FROM {table} ORDER BY {order_col} DESC LIMIT {limit}") or []
|
||||
except Exception as e:
|
||||
logger.error(f"Error fetching {table}: {e}")
|
||||
return []
|
||||
|
||||
try:
|
||||
game_events = db.query("SELECT id, event_type, actor_id, actor_name, map, universe_time, x, y, z FROM dune.game_events ORDER BY universe_time DESC LIMIT 50") or []
|
||||
except Exception as e:
|
||||
logger.error(f"Error fetching game_events: {e}")
|
||||
game_events = safe_query("dune.game_events", "*", "universe_time", 50)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
event_logs = db.query("SELECT id, event_type, category, function_name, message, event_time, meta FROM dune.event_log ORDER BY event_time DESC LIMIT 100") or []
|
||||
except Exception as e:
|
||||
logger.error(f"Error fetching event_logs: {e}")
|
||||
event_logs = safe_query("dune.event_log", "*", "event_time", 100)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return render_template('events.html', game_events=game_events, event_logs=event_logs)
|
||||
|
||||
# Chat
|
||||
|
||||
Reference in new issue
Block a user