How earthjasonlin/zzz-signal-search-export works
Project type and purpose
• This is an Electron-based desktop application (built with electron-vite) that extracts “gacha” (调频) history records from a game.
• The main purpose is to read the user’s authKey (either by parsing the local game log or by running an HTTP MITM proxy), then call the game’s gacha-history API, aggregate the results, and finally export or display them in a Vue-based UI (with charts and Excel exports).
File structure
• Top‐level build/config:
• .electron-vite/: custom build scripts and config for electron-vite.
• package.json, vite.config.js, postcss.config.js, tailwind.config.js.
• src/main/: Node “main process” code:
• main.js: boots Electron, creates windows, sets up IPC.
• bridge.js: defines secure IPC channels.
• getData.js, UIGFJson.js, excel.js: core business logic for fetching data, formatting to UIGF, writing to Excel.
• module/: pluggable submodules—extract-zip (log parsing), node-mitmproxy (proxy server), system-proxy.
• update/: auto-update logic.
• i18n.js: loads translations from src/i18n/*.json.
• src/renderer/: Vue single-page application (“renderer process”):
• App.vue + components (GachaDetail, PieChart, Setting).
• gachaDetail.js, utils.js: client-side helpers.
• index.html, index.css, main.js: entry point and styles.
• Data/config files in src/: gachaType.json, idJson.json, language packs.
• tools/: standalone Python helper script.
Key insights from README
• The app reads authKey via two strategies (log-parsing or MITM proxy).
• UI actions (“Load Data”, “Add Account”) send IPC requests to the main process.
• Results can be previewed in the UI and exported to files.
• Supports multi-language via JSON in src/i18n/.
• Auto-updater built-in.
a. Main components:
• Renderer Process (Vue UI)
• Main Process (Node/Electron)
• Extraction Modules (log parser, proxy server)
• Data Fetcher (calls game API)
• Data Formatter/Exporter (UIGF JSON, Excel)
• Auto-Updater
• Local File System (for logs, caches, exported files)
• External Services (Game API endpoints)
b. Relationships & interactions:
1. User clicks “Load Data” in Renderer → sends IPC to Main.
2. Main invokes Extraction Module (either log parser or starts MITM proxy + system-proxy).
3. Extraction Module returns authKey → Main passes it to Data Fetcher.
4. Data Fetcher calls External Game API over HTTPS → retrieves gacha records.
5. Main hands raw data to Data Formatter → writes to UIGF JSON and/or Excel on File System.
6. Main notifies Renderer via IPC → Renderer loads & visualizes data (PieChart, GachaDetail).
7. On “Export” in UI → IPC to Main → Main writes final file.
8. Auto-Updater periodically checks version via update/index.js.
c. Architectural patterns/design principles:
• Electron’s multi-process model: clear separation of UI (renderer) vs business logic & OS access (main).
• Modular extraction strategy (plugin-like modules under main/module/).
• IPC bridge to enforce security and typed messages.
• MVVM in Vue for the front end.
• Single source of truth for i18n.
d. Key technologies/frameworks/libraries:
• Electron + electron-vite + Vite
• Vue 3 (SFCs), Tailwind CSS
• node-mitmproxy, exceljs (or similar)
• JSON-based config and language packs
• auto-updater library (electronic-update script)
• IPC via contextBridge in bridge.js