mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-03-28 17:42:45 +01:00
- Replace DM modal with full-page view at /dm route for better mobile UX - Add workaround for meshcore-cli bug where SENT_MSG contains sender's name instead of recipient - now saving sent DMs to separate log file - Fix DM button styling to match Reply button (btn-outline-secondary) - Add dm.js for DM page functionality - Add dm.html template with green navbar for visual distinction - Update menu link to navigate to /dm instead of opening modal - Remove unused DM modal functions from app.js - Update documentation with new DM workflow 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
60 lines
2.0 KiB
Python
60 lines
2.0 KiB
Python
"""
|
|
Configuration module - loads settings from environment variables
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
|
|
class Config:
|
|
"""Application configuration from environment variables"""
|
|
|
|
# MeshCore device configuration
|
|
MC_SERIAL_PORT = os.getenv('MC_SERIAL_PORT', '/dev/ttyUSB0')
|
|
MC_DEVICE_NAME = os.getenv('MC_DEVICE_NAME', 'MeshCore')
|
|
MC_CONFIG_DIR = os.getenv('MC_CONFIG_DIR', '/root/.config/meshcore')
|
|
|
|
# MeshCore Bridge configuration
|
|
MC_BRIDGE_URL = os.getenv('MC_BRIDGE_URL', 'http://meshcore-bridge:5001/cli')
|
|
|
|
# Application settings
|
|
MC_REFRESH_INTERVAL = int(os.getenv('MC_REFRESH_INTERVAL', '60'))
|
|
MC_INACTIVE_HOURS = int(os.getenv('MC_INACTIVE_HOURS', '48'))
|
|
|
|
# Archive configuration
|
|
MC_ARCHIVE_DIR = os.getenv('MC_ARCHIVE_DIR', '/root/.archive/meshcore')
|
|
MC_ARCHIVE_ENABLED = os.getenv('MC_ARCHIVE_ENABLED', 'true').lower() == 'true'
|
|
MC_ARCHIVE_RETENTION_DAYS = int(os.getenv('MC_ARCHIVE_RETENTION_DAYS', '7'))
|
|
|
|
# Flask server configuration
|
|
FLASK_HOST = os.getenv('FLASK_HOST', '0.0.0.0')
|
|
FLASK_PORT = int(os.getenv('FLASK_PORT', '5000'))
|
|
FLASK_DEBUG = os.getenv('FLASK_DEBUG', 'false').lower() == 'true'
|
|
|
|
# Derived paths
|
|
@property
|
|
def msgs_file_path(self) -> Path:
|
|
"""Get the full path to the .msgs file"""
|
|
return Path(self.MC_CONFIG_DIR) / f"{self.MC_DEVICE_NAME}.msgs"
|
|
|
|
@property
|
|
def archive_dir_path(self) -> Path:
|
|
"""Get the full path to archive directory"""
|
|
return Path(self.MC_ARCHIVE_DIR)
|
|
|
|
@property
|
|
def dm_sent_log_path(self) -> Path:
|
|
"""Get the full path to our sent DM log file (workaround for meshcore-cli bug)"""
|
|
return Path(self.MC_CONFIG_DIR) / f"{self.MC_DEVICE_NAME}_dm_sent.jsonl"
|
|
|
|
def __repr__(self):
|
|
return (
|
|
f"Config(device={self.MC_DEVICE_NAME}, "
|
|
f"port={self.MC_SERIAL_PORT}, "
|
|
f"config_dir={self.MC_CONFIG_DIR})"
|
|
)
|
|
|
|
|
|
# Global config instance
|
|
config = Config()
|