# contratop/whitedragon architecture

> Architecture diagram of the GitHub repository contratop/whitedragon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/contratop/whitedragon
- Repository: https://github.com/contratop/whitedragon

## Overview

##### Project Type & Purpose
- The project is a utilities pack focused on terminal use (for Termux on Android, as well as Linux and PowerShell on Windows). It bundles tools like a content extractor (leveraging youtube-dl) and an FTP server.
- The utilities are implemented using both Bash and Python. There are also scripts for installation, updating, and uninstallation, indicating an orchestration layer that ties the tools together.

##### Analyzing the File Structure
- .simpleapp Directory: Contains key utility implementations:
- content_extractor.sh: A shell script intended to download online content.
- ftpserver.py: A Python script to run a local FTP server.
- .system Directory: Contains “dependency.txt”, which likely details system dependencies.
- .theia Directory: Contains “launch.json”. This suggests configurations for development/debugging (e.g., with Theia IDE).
- Root-level Scripts:
- WhiteDragon.sh: Likely the main entry point that orchestrates the execution of the utilities.
- WDUpdater.sh and WDuninst.sh: Scripts responsible for updating and uninstalling the toolset.
- Additional files (banner.bn, etc.) for UI/branding or configuration details.

a. Main Controller/Entry Point:
- WhiteDragon.sh (main orchestrator script which calls the other utilities).
- WDUpdater.sh and WDuninst.sh (maintenance utilities).

b. Utility Modules:
- Content Extractor Module (content_extractor.sh).
- FTP Server Module (ftpserver.py).

c. Configuration & Dependency Management:
- .system/dependency.txt representing external dependencies.
- .theia/launch.json indicating development environment setup.

d. (Optional) Supporting Files:
- banner.bn can be a separate component for UI/branding, adding visual context when launching the tool.

##### Relationships & Interactions
- The user executes the main script (WhiteDragon.sh) which provides a menu or an interface to select a specific utility.
- Depending on the selection, the main controller calls one of the modules (the content extractor or the FTP server).
- Each module can further invoke system utilities or Python interpreters (e.g., ftpserver.py requires a Python runtime).
- Maintenance scripts (update/uninstall) interact with the main components and may refer to dependencies listed in .system.

##### Architectural Patterns & Design Principles
- Modularity: The utilities are broken into separate, loosely-coupled modules (.simpleapp) which are invoked via the main script.
- Separation of Concerns: There is a clear delineation among the main controller, utility modules, and configuration/dependency management.
- Cross-Platform Consideration: The design is oriented toward different shells (Bash, Python) to be usable on Termux, Linux, and Windows PowerShell.

## Diagram (Mermaid)

```mermaid
flowchart TD 
    subgraph "User Interaction"
        A("Terminal/Command Line"):::external
    end

    subgraph "Main Controller"
        B("Main Controller: WhiteDragon.sh"):::shell
        C("Maintenance: WDUpdater.sh"):::shell
        D("Maintenance: WDuninst.sh"):::shell
    end

    subgraph "Utility Modules"
        E("Content Extractor Utility (.simpleapp/content_extractor.sh)"):::shell
        F("FTP Server Utility (.simpleapp/ftpserver.py)"):::python
    end

    subgraph "Configuration & Dependencies"
        G("Dependencies (.system/dependency.txt)"):::config
        H("Development Config (.theia/launch.json)"):::config
        I("UI/Branding (banner.bn)"):::config
    end

    A -->|"runs"| B
    B -->|"calls"| E
    B -->|"calls"| F
    B -->|"invokes_update_uninstall"| C
    B -->|"invokes_update_uninstall"| D
    E -->|"requires_dependency"| G
    F -->|"requires_Python_runtime"| G
    G ---|"supports"| H
    B -->|"displays"| I

    click B "https://github.com/contratop/whitedragon/blob/main/WhiteDragon.sh"
    click C "https://github.com/contratop/whitedragon/blob/main/WDUpdater.sh"
    click D "https://github.com/contratop/whitedragon/blob/main/WDuninst.sh"
    click E "https://github.com/contratop/whitedragon/blob/main/.simpleapp/content_extractor.sh"
    click F "https://github.com/contratop/whitedragon/blob/main/.simpleapp/ftpserver.py"
    click G "https://github.com/contratop/whitedragon/blob/main/.system/dependency.txt"
    click H "https://github.com/contratop/whitedragon/blob/main/.theia/launch.json"
    click I "https://github.com/contratop/whitedragon/blob/main/banner.bn"

    classDef external fill:#e0f7fa,stroke:#006064,stroke-width:2px;
    classDef shell fill:#ffe0b2,stroke:#e65100,stroke-width:2px;
    classDef python fill:#c5e1a5,stroke:#33691e,stroke-width:2px;
    classDef config fill:#d1c4e9,stroke:#4527a0,stroke-width:2px;
```
