# tidain/yunx-desktop architecture

> Architecture diagram of the GitHub repository tidain/yunx-desktop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tidain/yunx-desktop
- Repository: https://github.com/tidain/yunx-desktop

## Overview

YunX-Desktop is a Windows desktop client for resolving cloud-drive shares and video links, previewing content, and downloading it, with a browser handoff extension. The main user flow starts in the app’s resolve experience: a share enters cloud-drive browsing or a video enters parsed results, then the user previews or downloads content. Separate capabilities include P2P transfers, GitHub browsing, account backup, and engine management. The README documents these product relationships; unsampled implementation links are omitted rather than inferred.

Main entry points: [`desktop/src/main/kotlin/com/yunx/app/ui/screens/ResolveScreen.kt`](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/ui/screens/ResolveScreen.kt) (Resolve screen), [`desktop/src/main/kotlin/com/yunx/app/data/download/DownloadManager.kt`](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/download/DownloadManager.kt) (Download manager), [`desktop/src/main/kotlin/com/yunx/app/data/repository/ShareResolveRepository.kt`](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/repository/ShareResolveRepository.kt) (Share resolver), [`desktop/src/main/kotlin/com/yunx/app/data/repository/VideoParseRepository.kt`](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/repository/VideoParseRepository.kt) (Video parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop experience"]
  node_main["App entry<br/>[Main.kt]"]
end

subgraph group_resolve["Link resolution"]
  node_resolveui["Resolve screen<br/>[ResolveScreen.kt]"]
  node_shareparse["Share resolver"]
  node_cloudfiles["Cloud file browsing"]
  node_videoparse["Video parsing"]
  node_videoplatforms["Video platform parsers<br/>[VideoPlatform.kt]"]
end

subgraph group_transfer["Download and preview"]
  node_downloadsui["Download screen<br/>[DownloadScreen.kt]"]
  node_downloadmanager["Download manager<br/>[DownloadManager.kt]"]
  node_gopeed["P2P engine<br/>[GopeedEngine.kt]"]
  node_preview["Video preview engine<br/>[FfplayManager.kt]"]
end

subgraph group_accounts["Accounts and storage"]
  node_database[("App database<br/>[AppDatabase.kt]")]
  node_accountrepos["Account repositories"]
  node_authbackup["Credential backup"]
  node_settings[("Settings")]
end

subgraph group_integrations["External integrations"]
  node_github["GitHub browsing and mirrors<br/>[GitHubApi.kt]"]
  node_browserext["Browser extension<br/>[background.js]"]
  node_bridge["Local browser bridge"]
  node_cloudservices{{"Cloud-drive services"}}
  node_videoservices{{"Video platforms"}}
end

node_user(("User"))

node_user -->|"starts app"| node_main
node_user -->|"pastes link"| node_resolveui
node_resolveui -.->|"resolves share"| node_shareparse
node_shareparse -.->|"requests share data"| node_cloudservices
node_resolveui -->|"opens share"| node_cloudfiles
node_resolveui -.->|"parses video"| node_videoparse
node_videoparse -->|"selects parser"| node_videoplatforms
node_videoplatforms -.->|"fetches media"| node_videoservices
node_user -->|"manages tasks"| node_downloadsui
node_downloadsui -.->|"controls downloads"| node_downloadmanager
node_downloadmanager -->|"dispatches P2P"| node_gopeed
node_downloadmanager -->|"uses preview"| node_preview
node_user -->|"backs up accounts"| node_authbackup
node_accountrepos -.->|"persists accounts"| node_database
node_user -->|"configures app"| node_settings
node_user -->|"browses GitHub"| node_github
node_browserext -->|"sends local requests"| node_bridge
node_bridge -.->|"hands off downloads"| node_downloadmanager

click node_main "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/Main.kt"
click node_resolveui "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/ui/screens/ResolveScreen.kt"
click node_shareparse "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/repository/ShareResolveRepository.kt"
click node_cloudfiles "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/ui/screens/CloudDriveScreen.kt"
click node_videoparse "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/repository/VideoParseRepository.kt"
click node_videoplatforms "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/network/video/VideoPlatform.kt"
click node_downloadsui "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/ui/screens/DownloadScreen.kt"
click node_downloadmanager "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/download/DownloadManager.kt"
click node_gopeed "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/gopeed/GopeedEngine.kt"
click node_preview "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/preview/FfplayManager.kt"
click node_database "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/db/AppDatabase.kt"
click node_accountrepos "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/repository/AccountDirectory.kt"
click node_authbackup "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/backup/AuthBackupManager.kt"
click node_settings "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/prefs/SettingsRepository.kt"
click node_github "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/network/GitHubApi.kt"
click node_browserext "https://github.com/tidain/yunx-desktop/blob/main/browser-extension/background.js"
click node_bridge "https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/bridge/BrowserBridgeServer.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_user toneBlue
class node_resolveui,node_shareparse,node_cloudfiles,node_videoparse,node_videoplatforms toneAmber
class node_downloadsui,node_downloadmanager,node_gopeed,node_preview toneMint
class node_database,node_accountrepos,node_authbackup,node_settings toneRose
class node_github,node_browserext,node_bridge,node_cloudservices,node_videoservices toneIndigo
```

## Components

### Desktop experience

- [App entry](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/Main.kt): `desktop/src/main/kotlin/com/yunx/app/Main.kt`

### Link resolution

- [Resolve screen](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/ui/screens/ResolveScreen.kt): `desktop/src/main/kotlin/com/yunx/app/ui/screens/ResolveScreen.kt`
- [Share resolver](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/repository/ShareResolveRepository.kt): `desktop/src/main/kotlin/com/yunx/app/data/repository/ShareResolveRepository.kt`
- [Cloud file browsing](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/ui/screens/CloudDriveScreen.kt): `desktop/src/main/kotlin/com/yunx/app/ui/screens/CloudDriveScreen.kt`
- [Video parsing](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/repository/VideoParseRepository.kt): `desktop/src/main/kotlin/com/yunx/app/data/repository/VideoParseRepository.kt`
- [Video platform parsers](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/network/video/VideoPlatform.kt): `desktop/src/main/kotlin/com/yunx/app/data/network/video/VideoPlatform.kt`

### Download and preview

- [Download screen](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/ui/screens/DownloadScreen.kt): `desktop/src/main/kotlin/com/yunx/app/ui/screens/DownloadScreen.kt`
- [Download manager](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/download/DownloadManager.kt): `desktop/src/main/kotlin/com/yunx/app/data/download/DownloadManager.kt`
- [P2P engine](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/gopeed/GopeedEngine.kt): `desktop/src/main/kotlin/com/yunx/app/data/gopeed/GopeedEngine.kt`
- [Video preview engine](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/preview/FfplayManager.kt): `desktop/src/main/kotlin/com/yunx/app/data/preview/FfplayManager.kt`

### Accounts and storage

- [App database](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/db/AppDatabase.kt): `desktop/src/main/kotlin/com/yunx/app/data/db/AppDatabase.kt`
- [Account repositories](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/repository/AccountDirectory.kt): `desktop/src/main/kotlin/com/yunx/app/data/repository/AccountDirectory.kt`
- [Credential backup](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/backup/AuthBackupManager.kt): `desktop/src/main/kotlin/com/yunx/app/data/backup/AuthBackupManager.kt`
- [Settings](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/prefs/SettingsRepository.kt): `desktop/src/main/kotlin/com/yunx/app/data/prefs/SettingsRepository.kt`

### External integrations

- [GitHub browsing and mirrors](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/network/GitHubApi.kt): `desktop/src/main/kotlin/com/yunx/app/data/network/GitHubApi.kt`
- [Browser extension](https://github.com/tidain/yunx-desktop/blob/main/browser-extension/background.js): `browser-extension/background.js`
- [Local browser bridge](https://github.com/tidain/yunx-desktop/blob/main/desktop/src/main/kotlin/com/yunx/app/data/bridge/BrowserBridgeServer.kt): `desktop/src/main/kotlin/com/yunx/app/data/bridge/BrowserBridgeServer.kt`
- **Cloud-drive services**
- **Video platforms**

### Other components

- **User**

## Connections

- User → App entry: starts app
- User → Resolve screen: pastes link
- Resolve screen → Share resolver: resolves share
- Share resolver → Cloud-drive services: requests share data
- Resolve screen → Cloud file browsing: opens share
- Resolve screen → Video parsing: parses video
- Video parsing → Video platform parsers: selects parser (evidence: `desktop/src/main/kotlin/com/yunx/app/data/repository/VideoParseRepository.kt`)
- Video platform parsers → Video platforms: fetches media
- User → Download screen: manages tasks
- Download screen → Download manager: controls downloads
- Download manager → P2P engine: dispatches P2P (evidence: `desktop/src/main/kotlin/com/yunx/app/data/download/DownloadManager.kt`)
- Download manager → Video preview engine: uses preview (evidence: `desktop/src/main/kotlin/com/yunx/app/data/download/DownloadManager.kt`)
- User → Credential backup: backs up accounts
- Account repositories → App database: persists accounts
- User → Settings: configures app
- User → GitHub browsing and mirrors: browses GitHub
- Browser extension → Local browser bridge: sends local requests
- Local browser bridge → Download manager: hands off downloads
