- Add HTTPSConfig model for managing HTTPS settings - Add admin routes for HTTPS configuration management - Add beautiful admin template for HTTPS configuration - Add database migration for https_config table - Add CLI utility for HTTPS management - Add setup script for automated configuration - Add Caddy configuration generator and manager - Add comprehensive documentation (3 guides) - Add HTTPS Configuration card to admin dashboard - Implement input validation and security features - Add admin-only access control with audit trail - Add real-time configuration preview - Integrate with existing Caddy reverse proxy Features: - Enable/disable HTTPS from web interface - Configure domain, hostname, IP address, port - Automatic SSL certificate management via Let's Encrypt - Real-time Caddyfile generation and reload - Full audit trail with admin username and timestamps - Support for HTTPS and HTTP fallback access points - Beautiful, mobile-responsive UI Modified files: - app/models/__init__.py (added HTTPSConfig import) - app/blueprints/admin.py (added HTTPS routes) - app/templates/admin/admin.html (added HTTPS card) - docker-compose.yml (added Caddyfile mount and admin port) New files: - app/models/https_config.py - app/blueprints/https_config.html - app/utils/caddy_manager.py - https_manager.py - setup_https.sh - migrations/add_https_config_table.py - migrations/add_email_to_https_config.py - HTTPS_STATUS.txt - Documentation files (3 markdown guides)
61 lines
2.7 KiB
Python
Executable File
61 lines
2.7 KiB
Python
Executable File
"""Player edit model for tracking media edited on players."""
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from app.extensions import db
|
|
|
|
|
|
class PlayerEdit(db.Model):
|
|
"""Player edit model for tracking media files edited on player devices.
|
|
|
|
Attributes:
|
|
id: Primary key
|
|
player_id: Foreign key to player
|
|
content_id: Foreign key to content that was edited
|
|
original_name: Original filename
|
|
new_name: New filename after editing
|
|
version: Edit version number (v1, v2, etc.)
|
|
user: User who made the edit (from player)
|
|
time_of_modification: When the edit was made
|
|
metadata_path: Path to the metadata JSON file
|
|
edited_file_path: Path to the edited file
|
|
created_at: Record creation timestamp
|
|
"""
|
|
__tablename__ = 'player_edit'
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
player_id = db.Column(db.Integer, db.ForeignKey('player.id', ondelete='CASCADE'), nullable=False, index=True)
|
|
content_id = db.Column(db.Integer, db.ForeignKey('content.id', ondelete='CASCADE'), nullable=False, index=True)
|
|
original_name = db.Column(db.String(255), nullable=False)
|
|
new_name = db.Column(db.String(255), nullable=False)
|
|
version = db.Column(db.Integer, default=1, nullable=False)
|
|
user = db.Column(db.String(255), nullable=True)
|
|
time_of_modification = db.Column(db.DateTime, nullable=True)
|
|
metadata_path = db.Column(db.String(512), nullable=True)
|
|
edited_file_path = db.Column(db.String(512), nullable=False)
|
|
created_at = db.Column(db.DateTime, default=datetime.utcnow, nullable=False, index=True)
|
|
|
|
# Relationships
|
|
player = db.relationship('Player', backref=db.backref('edits', lazy='dynamic', cascade='all, delete-orphan'))
|
|
content = db.relationship('Content', backref=db.backref('edits', lazy='dynamic', cascade='all, delete-orphan'))
|
|
|
|
def __repr__(self) -> str:
|
|
"""String representation of PlayerEdit."""
|
|
return f'<PlayerEdit {self.original_name} v{self.version} by {self.user or "unknown"}>'
|
|
|
|
def to_dict(self) -> dict:
|
|
"""Convert to dictionary for API responses."""
|
|
return {
|
|
'id': self.id,
|
|
'player_id': self.player_id,
|
|
'player_name': self.player.name if self.player else None,
|
|
'content_id': self.content_id,
|
|
'original_name': self.original_name,
|
|
'new_name': self.new_name,
|
|
'version': self.version,
|
|
'user': self.user,
|
|
'time_of_modification': self.time_of_modification.isoformat() if self.time_of_modification else None,
|
|
'created_at': self.created_at.isoformat() if self.created_at else None,
|
|
'edited_file_path': self.edited_file_path
|
|
}
|