Files
ske087 46602f1933 Sanitize codebase, reorganize docs, and add missing deploy files
Remove dead code identified in docs/SANITIZATION-REVIEW.md:
- app/blueprints/content_old.py and app/blueprints/playlist.py
- app/models/group.py, app/utils/nginx_config_reader.py
- orphaned templates (content_list, edit_content, upload_content,
  player_page) and the related group/Template references

Result: 6 blueprints, 82 routes, no dead modules or orphan templates.

Add files that deploy.sh and docker-entrypoint.sh already require but
which were never tracked:
- https_manager.py       (referenced by deploy.sh, migrate_network.sh,
                          docker-entrypoint.sh)
- Caddyfile.example      (seeded by deploy.sh; its absence aborts deploy)

Relocate generated Graphify artifacts from graphify-out/ to
docs/graphify-out/ (110 files, no content change) and archive the
superseded docs under docs/.

Ignore hygiene:
- ignore ad-hoc .env backups (.env.bak*) — they contain live secrets
- keep the pre-sanitization snapshots (docs/legacy code/,
  docs/old_code_documentation/) on disk but out of the repo

Fix .env.example: drop a duplicated config block, genericize the
hardcoded host IP, and document HOSTNAME_INTERNAL.
2026-09-11 12:18:34 +03:00

243 lines
8.6 KiB
Markdown

# CaddyConfigGenerator
> God node · 31 connections · [/home/scheianu/digiserver-v2/app/utils/caddy_manager.py](file:///home/scheianu/digiserver-v2/app/utils/caddy_manager.py#L36)
## Call Trace Diagram
```mermaid
sequenceDiagram
participant P0 as CaddyConfigGenerator
participant P1 as HTTPSConfig
participant P2 as Models package for digiserver-v2.
participant P3 as PlayerEdit
participant P4 as PlayerUser
participant P5 as Playlist
participant P6 as Content
participant P7 as User
participant P8 as Player
participant P9 as ServerLog
participant P10 as Group
participant P11 as PlayerFeedback
participant P12 as Players blueprint for player management and display.
participant P13 as Display list of all players.
participant P14 as Add a new player with optional SSH deployment.
participant P15 as Regenerate authentication code for a player.
participant P16 as Redirect to manage player page (combined view).
participant P17 as Manage player - edit credentials, assign playlist, view logs.
participant P18 as Display all edited media files from this player.
participant P19 as Display a tabular report of all edited media from this player.
participant P20 as Display player fullscreen view (no authentication required for players).
participant P21 as Get playlist for a player based on their assigned playlist. Args:
participant P22 as Legacy endpoint - Content reordering now handled in playlist management.
participant P23 as Delete multiple players at once.
participant P24 as Assign multiple players to a playlist.
participant P25 as Return deployment status for all players (used by polling JS).
participant P26 as Reorder items in player's playlist.
participant P27 as Remove content from player's playlist.
participant P28 as Add https_config table for HTTPS configuration management.
participant P29 as Caddy configuration generator and manager.
participant P30 as Generate Caddyfile configuration based on HTTPSConfig.
participant P31 as Generate a complete Caddyfile. Behaviour: - HTTPS disabled / no
participant P32 as Write Caddyfile to disk. The default path is /etc/caddy/Caddyfile — the
participant P33 as Push the current Caddyfile to Caddy via its admin API (/load). Caddy ap
participant P34 as Write Caddyfile to disk. Args: caddyfile_content: C
participant P35 as Reload Caddy configuration without restart. Note: Caddy monitor
participant P36 as Admin blueprint for user management and system settings.
participant P37 as Decorator to require admin role for route access.
participant P38 as Display admin panel with system overview.
participant P39 as Create a new user account.
participant P40 as Change user role between user and admin.
participant P41 as Delete a user account.
participant P42 as Change application theme.
participant P43 as Upload custom logo for application.
participant P44 as Clear all server logs.
participant P45 as Display user management page.
participant P46 as Get system information as JSON.
participant P47 as Display leftover media files not assigned to any playlist.
participant P48 as Delete all leftover images that are not part of any playlist
participant P49 as Delete all leftover videos that are not part of any playlist
participant P50 as Delete a single leftover content file
participant P51 as Show system dependencies status.
participant P52 as Install LibreOffice for PPTX conversion.
participant P53 as Install Emoji Fonts for better UI display.
participant P54 as Logo customization page.
participant P55 as Upload login page logo.
participant P56 as Display and manage users that edit images on players.
participant P57 as Update editing user name.
participant P58 as Display HTTPS configuration management page.
participant P59 as Update HTTPS configuration.
participant P60 as Get current HTTPS configuration status as JSON.
participant P61 as Path to the persisted player-build settings (in the instance folder).
participant P62 as Display the 'Build player files for deployment' admin page.
participant P63 as Build/refresh the staged player code and/or write its base config.
P0->>+ P1: uses
P1-->>- P0: return
P1->>+ P0: uses
P0-->>- P1: return
P1->>+ P2: uses
P2-->>- P1: return
P2->>+ P3: uses
P3-->>- P2: return
P2->>+ P4: uses
P4-->>- P2: return
P2->>+ P5: uses
P5-->>- P2: return
P2->>+ P1: uses
P1-->>- P2: return
P2->>+ P6: uses
P6-->>- P2: return
P2->>+ P7: uses
P7-->>- P2: return
P2->>+ P8: uses
P8-->>- P2: return
P2->>+ P9: uses
P9-->>- P2: return
P2->>+ P10: uses
P10-->>- P2: return
P2->>+ P11: uses
P11-->>- P2: return
P1->>+ P12: uses
P12-->>- P1: return
P12->>+ P3: uses
P3-->>- P12: return
P12->>+ P4: uses
P4-->>- P12: return
P12->>+ P1: uses
P1-->>- P12: return
P1->>+ P13: uses
P13-->>- P1: return
P1->>+ P14: uses
P14-->>- P1: return
P1->>+ P15: uses
P15-->>- P1: return
P1->>+ P16: uses
P16-->>- P1: return
P1->>+ P17: uses
P17-->>- P1: return
P1->>+ P18: uses
P18-->>- P1: return
P1->>+ P19: uses
P19-->>- P1: return
P1->>+ P20: uses
P20-->>- P1: return
P1->>+ P21: uses
P21-->>- P1: return
P1->>+ P22: uses
P22-->>- P1: return
P1->>+ P23: uses
P23-->>- P1: return
P1->>+ P24: uses
P24-->>- P1: return
P1->>+ P25: uses
P25-->>- P1: return
P1->>+ P26: uses
P26-->>- P1: return
P1->>+ P27: uses
P27-->>- P1: return
P1->>+ P28: uses
P28-->>- P1: return
P1->>+ P29: uses
P29-->>- P1: return
P1->>+ P30: uses
P30-->>- P1: return
P1->>+ P31: uses
P31-->>- P1: return
P1->>+ P32: uses
P32-->>- P1: return
P1->>+ P33: uses
P33-->>- P1: return
P1->>+ P34: uses
P34-->>- P1: return
P1->>+ P35: uses
P35-->>- P1: return
P0->>+ P36: uses
P36-->>- P0: return
P0->>+ P37: uses
P37-->>- P0: return
P0->>+ P38: uses
P38-->>- P0: return
P0->>+ P39: uses
P39-->>- P0: return
P0->>+ P40: uses
P40-->>- P0: return
P0->>+ P41: uses
P41-->>- P0: return
P0->>+ P42: uses
P42-->>- P0: return
P0->>+ P43: uses
P43-->>- P0: return
P0->>+ P44: uses
P44-->>- P0: return
P0->>+ P45: uses
P45-->>- P0: return
P0->>+ P46: uses
P46-->>- P0: return
P0->>+ P47: uses
P47-->>- P0: return
P0->>+ P48: uses
P48-->>- P0: return
P0->>+ P49: uses
P49-->>- P0: return
P0->>+ P50: uses
P50-->>- P0: return
P0->>+ P51: uses
P51-->>- P0: return
P0->>+ P52: uses
P52-->>- P0: return
P0->>+ P53: uses
P53-->>- P0: return
P0->>+ P54: uses
P54-->>- P0: return
P0->>+ P55: uses
P55-->>- P0: return
P0->>+ P56: uses
P56-->>- P0: return
P0->>+ P57: uses
P57-->>- P0: return
P0->>+ P58: uses
P58-->>- P0: return
P0->>+ P59: uses
P59-->>- P0: return
P0->>+ P60: uses
P60-->>- P0: return
P0->>+ P61: uses
P61-->>- P0: return
P0->>+ P62: uses
P62-->>- P0: return
P0->>+ P63: uses
P63-->>- P0: return
```
## Connections by Relation
### contains
- [[caddy_manager.py]] `EXTRACTED`
### rationale_for
- [[Generate Caddyfile configuration based on HTTPSConfig.]] `EXTRACTED`
### uses
- [[HTTPSConfig]] `INFERRED`
- [[Admin blueprint for user management and system settings.]] `INFERRED`
- [[Decorator to require admin role for route access.]] `INFERRED`
- [[Display admin panel with system overview.]] `INFERRED`
- [[Create a new user account.]] `INFERRED`
- [[Change user role between user and admin.]] `INFERRED`
- [[Delete a user account.]] `INFERRED`
- [[Change application theme.]] `INFERRED`
- [[Upload custom logo for application.]] `INFERRED`
- [[Clear all server logs.]] `INFERRED`
- [[Display user management page.]] `INFERRED`
- [[Get system information as JSON.]] `INFERRED`
- [[Display leftover media files not assigned to any playlist.]] `INFERRED`
- [[Delete all leftover images that are not part of any playlist]] `INFERRED`
- [[Delete all leftover videos that are not part of any playlist]] `INFERRED`
- [[Delete a single leftover content file]] `INFERRED`
- [[Show system dependencies status.]] `INFERRED`
- [[Install LibreOffice for PPTX conversion.]] `INFERRED`
- [[Install Emoji Fonts for better UI display.]] `INFERRED`
- [[Logo customization page.]] `INFERRED`
---
*Part of the graphify knowledge wiki. See [[index]] to navigate.*