# yutobeo2024/zalodataextractor architecture

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

- Interactive diagram: https://gitdiagram.com/yutobeo2024/zalodataextractor
- Repository: https://github.com/yutobeo2024/zalodataextractor

## Overview

##### Project type and purpose
- This is a browser extension (Chrome/Edge) named “ZaloDataExtractor.”
- Its sole purpose is to extract IMEI, cookies, and User-Agent from the Zalo Web page and surface them in a popup UI or forward them to downstream tooling (e.g., the zca-js library).

##### File structure
- manifest.json: defines extension metadata, permissions, script entry points.
- background.js + config.js: long-lived background script for persistence, update checks.
- scripts/index.js + scripts/helpers/checkUpdate.js: modules imported by background or popup to perform logic (e.g., polling Zalo Web for changes, auto-updates).
- js/popup.js + js/custom.js: handle popup UI events and orchestrate data requests.
- popup.html + css/styles.css: user interface surfaces extracted data.
- LICENSE, README.md: project metadata.

##### README for additional insights
- Confirms it’s a developer/analyst tool for quickly grabbing specific Zalo Web runtime values.
- Mentions integration with zca-js (external library), implying data handoff or API invocation.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser Host Boundary
    subgraph "Browser Host" 
        direction TB

        %% Manifest
        Manifest["manifest.json"]:::manifest

        %% Extension Components Container
        subgraph "ZaloDataExtractor Extension"
            direction TB

            %% Background Script Module
            subgraph "Background Script (Persistent)" 
                direction TB
                Bg["background.js"]:::background
                Config["config.js"]:::background
                CheckUpdate["checkUpdate.js"]:::background
            end

            %% Content Script Module
            subgraph "Content Script (Zalo Web Context)" 
                direction TB
                Content["scripts/index.js"]:::content
            end

            %% Popup UI Module
            subgraph "Popup UI (Ephemeral)" 
                direction TB
                PopupHTML["popup.html"]:::popup
                Style["css/styles.css"]:::popup
                PopupJS["js/popup.js"]:::popup
                Custom["js/custom.js"]:::popup
            end
        end

        %% External Integrations
        ZCA["zca-js Library"]:::external
        Store["Chrome Web Store / Update Channel"]:::external

        %% Project Metadata
        subgraph "Project Metadata"
            direction TB
            Readme["README.md"]:::metadata
            License["LICENSE"]:::metadata
        end
    end

    %% Relationships and Data Flows
    Manifest -->|defines| Bg
    Manifest -->|defines| Content
    Manifest -->|defines| PopupHTML

    %% User Interaction
    UserClick(["User clicks extension icon"]):::external
    UserClick --> PopupHTML
    PopupHTML --> PopupJS
    PopupJS --> Custom
    PopupJS -->|sendMessage| Bg

    %% Background orchestration
    Bg -->|ensure injection| Content
    Bg -->|periodic check| CheckUpdate
    CheckUpdate --> Store

    %% Content Extraction Flow
    Content -->|extract IMEI/Cookies/UA| Bg
    Bg -->|relay data| PopupJS
    Bg -->|invoke API| ZCA

    %% Click Events
    click Manifest "https://github.com/yutobeo2024/zalodataextractor/blob/main/manifest.json"
    click Bg "https://github.com/yutobeo2024/zalodataextractor/blob/main/background.js"
    click Config "https://github.com/yutobeo2024/zalodataextractor/blob/main/config.js"
    click CheckUpdate "https://github.com/yutobeo2024/zalodataextractor/blob/main/scripts/helpers/checkUpdate.js"
    click Content "https://github.com/yutobeo2024/zalodataextractor/blob/main/scripts/index.js"
    click PopupHTML "https://github.com/yutobeo2024/zalodataextractor/blob/main/popup.html"
    click Style "https://github.com/yutobeo2024/zalodataextractor/blob/main/css/styles.css"
    click PopupJS "https://github.com/yutobeo2024/zalodataextractor/blob/main/js/popup.js"
    click Custom "https://github.com/yutobeo2024/zalodataextractor/blob/main/js/custom.js"
    click Readme "https://github.com/yutobeo2024/zalodataextractor/blob/main/README.md"
    click License "https://github.com/yutobeo2024/zalodataextractor/tree/main/LICENSE"

    %% Styles
    classDef background fill:#cce5ff,stroke:#66b0ff,color:#000;
    classDef content fill:#d4edda,stroke:#66c68e,color:#000;
    classDef popup fill:#fff3cd,stroke:#ffd966,color:#000;
    classDef external fill:#e2e3e5,stroke:#adb5bd,color:#000;
    classDef manifest fill:#f8d7da,stroke:#f5c6cb,color:#000;
    classDef metadata fill:#eeeeee,stroke:#cccccc,color:#000;
```
