From de5a2a189b7f653f588e9dce738dddae623b0774 Mon Sep 17 00:00:00 2001 From: lelo Date: Sun, 14 Dec 2025 10:28:34 +0000 Subject: [PATCH] improvements --- app.py | 15 ++++--- docker-compose.yml | 7 ++-- static/app.js | 7 ++-- templates/connections.html | 86 +++++++++++++++++++------------------- 4 files changed, 61 insertions(+), 54 deletions(-) diff --git a/app.py b/app.py index b8e196d..cae6039 100755 --- a/app.py +++ b/app.py @@ -1,7 +1,12 @@ -import eventlet -eventlet.monkey_patch() -from flask import Flask, render_template, send_file, url_for, jsonify, request, session, send_from_directory, make_response, abort import os + +# Use eventlet only in production; keep dev on threading to avoid monkey_patch issues with reloader +FLASK_ENV = os.environ.get('FLASK_ENV', 'production') +if FLASK_ENV == 'production': + import eventlet + eventlet.monkey_patch() + +from flask import Flask, render_template, send_file, url_for, jsonify, request, session, send_from_directory, make_response, abort from PIL import Image, ImageOps import io from functools import wraps @@ -40,7 +45,7 @@ app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1) app.config['SECRET_KEY'] = app_config['SECRET_KEY'] app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=90) -if os.environ.get('FLASK_ENV') == 'production': +if FLASK_ENV == 'production': app.config['SESSION_COOKIE_SAMESITE'] = 'None' app.config['SESSION_COOKIE_SECURE'] = True @@ -69,7 +74,7 @@ allowed_domains = re.findall(pattern, host_rule) socketio = SocketIO( app, - async_mode='eventlet', +async_mode='eventlet' if FLASK_ENV == 'production' else 'threading', cors_allowed_origins=allowed_domains ) background_thread_running = False diff --git a/docker-compose.yml b/docker-compose.yml index 17ab8ff..7022b65 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,8 @@ services: propagation: rshared environment: - FLASK_APP=app.py - - FLASK_ENV=production + - FLASK_ENV=development + - FLASK_DEBUG=1 networks: - traefik labels: @@ -37,10 +38,10 @@ services: # Internal port - "traefik.http.services.${CONTAINER_NAME}.loadbalancer.server.port=5000" - # Production-ready Gunicorn command with eventlet + # Dev server with autoreload for live code changes command: > sh -c "pip install -r requirements.txt && - gunicorn --worker-class eventlet -w 1 -b 0.0.0.0:5000 app:app" + flask run --host=0.0.0.0 --port=5000 --reload" networks: diff --git a/static/app.js b/static/app.js index dce8ae4..f1b3fe6 100644 --- a/static/app.js +++ b/static/app.js @@ -128,12 +128,13 @@ function renderContent(data) { } contentHTML += `
  • ${link_symbol} ${dir.name}${share_link}
  • `; }); - if (data.breadcrumbs.length === 1) { - contentHTML += ``; - } contentHTML += ''; } } + // Add search link at top level above directories/files + if (data.breadcrumbs.length === 1) { + contentHTML = `` + contentHTML; + } // Render files (including music and non-image files) currentMusicFiles = []; diff --git a/templates/connections.html b/templates/connections.html index 43bfdcd..5394689 100644 --- a/templates/connections.html +++ b/templates/connections.html @@ -12,7 +12,6 @@ display: flex; gap: 20px; height: 85vh; - padding: 20px; } .map-section { flex: 1; @@ -39,6 +38,9 @@ margin-bottom: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); } + .page-content { + padding: 20px; + } .stats { display: flex; gap: 20px; @@ -94,53 +96,51 @@ {% endblock %} {% block content %} -
    - -
    -
    -

    Live Connection Map

    -
    -
    -
    Active Dots
    -
    0
    -
    -
    -
    Last Connection
    -
    -
    -
    +
    +
    +

    Verbindungen der letzten 10 Minuten

    +
    +
    +
    Active Dots
    +
    0
    +
    +
    +
    Last Connection
    +
    -
    +
    +
    +
    Total Connections
    +
    0
    -
    - -
    -
    -

    Verbindungen der letzten 10 Minuten

    -
    -
    -
    Total Connections
    -
    0
    -
    -
    +
    + +
    +
    -
    - - - - - - - - - - - - - - {# dynamically populated via Socket.IO #} - -
    TimestampLocationUser AgentFile PathFile SizeMIME-TypCached
    + + +
    +
    + + + + + + + + + + + + + + {# dynamically populated via Socket.IO #} + +
    TimestampLocationUser AgentFile PathFile SizeMIME-TypCached
    +