# listen1/listen1_desktop architecture

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

- Interactive diagram: https://gitdiagram.com/listen1/listen1_desktop
- Repository: https://github.com/listen1/listen1_desktop

## Overview

##### Project type and purpose
- This is an Electron-based open-source desktop application (“Listen 1 音乐播放器”) that aggregates multiple online music services (网易云音乐, QQ 音乐, 酷狗, etc.) into one player.
- It uses Node.js/Electron to provide a cross-platform (Windows, macOS, Linux) desktop UI, plus a Chrome-extension submodule for shared search/play logic.

##### File structure
- Top level
- .github/workflows/release.yml: CI/CD for packaging & release
- package.json & package-lock.json: root-level scripts (npm run start/dist) and dependencies.
- LICENSE.md, .gitignore, .gitmodules: licensing, Git configuration, and the Chrome-extension submodule.
- app/
- main.js: Electron main process launcher & window management
- preload.js: Node→renderer secure bridge
- floatingWindow.html: a specialized mini-player window
- functions.js & listen1_chrome_extension (submodule): core music search & playback logic shared with the Chrome extension
- resources/: static assets
- package.json & package-lock.json: app-specific dependencies (Electron, IPC, UI libs).
- build/

##### README insights
- Describes multi-platform packaging (npm run dist[:platform]).
- Calls out the submodule initialization required for code completeness (git submodule update --init --recursive).
- Confirms Electron & build scripts, no backend server – all network calls go directly from the client.

##### Final advice
– Be exhaustive: map each JS file or module to its runtime component.
– Capture both runtime architecture (processes, data flow) and build/deploy workflow.
– Use layering to show OS, Electron, and network boundaries.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Electron App Processes
    subgraph "Electron App"
        direction TB
        Renderer["Renderer UI\n(app/floatingWindow.html)"]:::core
        click Renderer "https://github.com/listen1/listen1_desktop/blob/master/app/floatingWindow.html"

        Preload["Preload Script\n(app/preload.js)"]:::core
        click Preload "https://github.com/listen1/listen1_desktop/blob/master/app/preload.js"

        Main["Electron Main Process\n(app/main.js)"]:::core
        click Main "https://github.com/listen1/listen1_desktop/blob/master/app/main.js"
    end

    Renderer -->|"invoke IPC"| Preload
    Preload -->|"IPC"| Main

    %% Business Logic Modules
    Adapter["Music Service Adapter Module\n(app/listen1_chrome_extension/)"]:::business
    click Adapter "https://github.com/listen1/listen1_desktop/tree/master/app/listen1_chrome_extension/"

    Functions["Core Music Functions\n(app/functions.js)"]:::business
    click Functions "https://github.com/listen1/listen1_desktop/blob/master/app/functions.js"

    Main -->|"load module"| Adapter
    Main -->|"call utilities"| Functions

    %% External Systems
    MusicPlatforms["External Music Platforms\n(网易云, QQ 音乐, 酷狗, etc.)"]:::external
    Storage["Local Storage / File System"]:::storage

    Adapter -->|"HTTP calls"| MusicPlatforms
    Main -->|"read/write"| Storage

    %% Build & Release Pipeline
    subgraph "Build & Release Pipeline"
        direction TB
        CI["GitHub Actions CI\n(.github/workflows/release.yml)"]:::external
        click CI "https://github.com/listen1/listen1_desktop/blob/master/.github/workflows/release.yml"

        Builder["Electron-builder Assets\n(build/)"]:::output
        click Builder "https://github.com/listen1/listen1_desktop/tree/master/build/"

        Installer["OS-specific Installers"]:::output
        CI --> Builder
        Builder -->|"produces"| Installer
    end

    %% Configuration Files
    packageRoot["Root package.json"]:::config
    click packageRoot "https://github.com/listen1/listen1_desktop/blob/master/package.json"

    packageApp["App package.json"]:::config
    click packageApp "https://github.com/listen1/listen1_desktop/blob/master/app/package.json"

    packageRoot -->|"scripts start/dist"| packageApp

    %% Styles
    classDef core fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef business fill:#90EE90,stroke:#000,stroke-width:1px
    classDef external fill:#FFA500,stroke:#000,stroke-width:1px
    classDef storage fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef output fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef config fill:#D3D3D3,stroke:#000,stroke-width:1px
```
