# web5173/jdy-silent-print-assistant architecture

> Architecture diagram of the GitHub repository web5173/jdy-silent-print-assistant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/web5173/jdy-silent-print-assistant
- Repository: https://github.com/web5173/jdy-silent-print-assistant

## Overview

静默打印助手是面向简道云页面的浏览器扩展：页面中的打印操作由远端注入脚本接管，隐藏原生预览并将打印任务提交给 ZeroPrint。全局接口地址和公钥由扩展配置，页面级打印选项保存在本地存储；扩展后台负责向服务端发送请求。README 与所示代码支持主要链路；远端脚本只提供了部分摘录，因此未展开未展示的内部步骤。

Main entry points: [`content.js`](https://github.com/web5173/jdy-silent-print-assistant/blob/main/content.js) (内容脚本桥接), [`remote-static/injected.js`](https://github.com/web5173/jdy-silent-print-assistant/blob/main/remote-static/injected.js) (页面打印逻辑), [`options.js`](https://github.com/web5173/jdy-silent-print-assistant/blob/main/options.js) (全局配置页), [`popup.js`](https://github.com/web5173/jdy-silent-print-assistant/blob/main/popup.js) (扩展弹窗)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_extension["扩展配置与加载"]
  node_options["全局配置页<br/>[options.js]"]
  node_popup["扩展弹窗<br/>[popup.js]"]
end

subgraph group_page["页面交互与桥接"]
  node_content["内容脚本桥接<br/>[content.js]"]
  node_loader["远端脚本加载器<br/>[loader.js]"]
end

subgraph group_printing["静默打印处理"]
  node_injected["页面打印逻辑<br/>[injected.js]"]
  node_config_ui["页面配置面板<br/>[injected.js]"]
  node_print_capture["打印请求接管<br/>[injected.js]"]
  node_print_submit["任务加密与提交<br/>[injected.js]"]
end

subgraph group_services["存储与打印服务"]
  node_storage[("扩展本地存储")]
  node_background["后台请求处理<br/>[background.js]"]
end

node_user(("用户"))
node_jiandaoyun["简道云页面"]
node_zeroprint["ZeroPrint 服务"]

node_user -->|"配置参数"| node_options
node_user -->|"查看状态"| node_popup
node_options -->|"读写全局配置"| node_storage
node_popup -->|"读取配置"| node_storage
node_jiandaoyun -.->|"运行内容脚本"| node_content
node_content -->|"注入加载器"| node_loader
node_loader -->|"加载远端脚本"| node_injected
node_injected -->|"接管打印交互"| node_jiandaoyun
node_injected -->|"显示配置面板"| node_config_ui
node_injected -->|"请求配置与代理能力"| node_content
node_content -->|"返回配置响应"| node_injected
node_content -->|"读写打印配置"| node_storage
node_content -->|"转发打印请求"| node_background
node_injected -->|"拦截打印请求"| node_print_capture
node_print_capture -->|"处理下载地址"| node_print_submit
node_print_submit -->|"请求提交任务"| node_content
node_background -->|"POST 打印任务"| node_zeroprint

click node_options "https://github.com/web5173/jdy-silent-print-assistant/blob/main/options.js"
click node_popup "https://github.com/web5173/jdy-silent-print-assistant/blob/main/popup.js"
click node_content "https://github.com/web5173/jdy-silent-print-assistant/blob/main/content.js"
click node_loader "https://github.com/web5173/jdy-silent-print-assistant/blob/main/loader.js"
click node_injected "https://github.com/web5173/jdy-silent-print-assistant/blob/main/remote-static/injected.js"
click node_config_ui "https://github.com/web5173/jdy-silent-print-assistant/blob/main/remote-static/injected.js"
click node_print_capture "https://github.com/web5173/jdy-silent-print-assistant/blob/main/remote-static/injected.js"
click node_print_submit "https://github.com/web5173/jdy-silent-print-assistant/blob/main/remote-static/injected.js"
click node_background "https://github.com/web5173/jdy-silent-print-assistant/blob/main/background.js"

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_options,node_popup toneBlue
class node_content,node_loader toneAmber
class node_injected,node_config_ui,node_print_capture,node_print_submit toneMint
class node_storage,node_background toneRose
class node_user,node_jiandaoyun,node_zeroprint toneIndigo
```

## Components

### 扩展配置与加载

- [全局配置页](https://github.com/web5173/jdy-silent-print-assistant/blob/main/options.js): `options.js`
- [扩展弹窗](https://github.com/web5173/jdy-silent-print-assistant/blob/main/popup.js): `popup.js`

### 页面交互与桥接

- [内容脚本桥接](https://github.com/web5173/jdy-silent-print-assistant/blob/main/content.js): `content.js`
- [远端脚本加载器](https://github.com/web5173/jdy-silent-print-assistant/blob/main/loader.js): `loader.js`

### 静默打印处理

- [页面打印逻辑](https://github.com/web5173/jdy-silent-print-assistant/blob/main/remote-static/injected.js): `remote-static/injected.js`
- [页面配置面板](https://github.com/web5173/jdy-silent-print-assistant/blob/main/remote-static/injected.js): `remote-static/injected.js`
- [打印请求接管](https://github.com/web5173/jdy-silent-print-assistant/blob/main/remote-static/injected.js): `remote-static/injected.js`
- [任务加密与提交](https://github.com/web5173/jdy-silent-print-assistant/blob/main/remote-static/injected.js): `remote-static/injected.js`

### 存储与打印服务

- **扩展本地存储**
- [后台请求处理](https://github.com/web5173/jdy-silent-print-assistant/blob/main/background.js): `background.js`

### Other components

- **用户**
- **简道云页面**
- **ZeroPrint 服务**

## Connections

- 用户 → 全局配置页: 配置参数 (evidence: `options.js`)
- 用户 → 扩展弹窗: 查看状态 (evidence: `popup.js`)
- 全局配置页 → 扩展本地存储: 读写全局配置 (evidence: `options.js`)
- 扩展弹窗 → 扩展本地存储: 读取配置 (evidence: `popup.js`)
- 简道云页面 → 内容脚本桥接: 运行内容脚本
- 内容脚本桥接 → 远端脚本加载器: 注入加载器 (evidence: `content.js`)
- 远端脚本加载器 → 页面打印逻辑: 加载远端脚本 (evidence: `loader.js`)
- 页面打印逻辑 → 简道云页面: 接管打印交互 (evidence: `README.md`)
- 页面打印逻辑 → 页面配置面板: 显示配置面板 (evidence: `remote-static/injected.js`)
- 页面打印逻辑 → 内容脚本桥接: 请求配置与代理能力 (evidence: `remote-static/injected.js`)
- 内容脚本桥接 → 页面打印逻辑: 返回配置响应 (evidence: `content.js`)
- 内容脚本桥接 → 扩展本地存储: 读写打印配置 (evidence: `content.js`)
- 内容脚本桥接 → 后台请求处理: 转发打印请求 (evidence: `content.js`)
- 页面打印逻辑 → 打印请求接管: 拦截打印请求 (evidence: `remote-static/injected.js`)
- 打印请求接管 → 任务加密与提交: 处理下载地址 (evidence: `remote-static/injected.js`)
- 任务加密与提交 → 内容脚本桥接: 请求提交任务 (evidence: `remote-static/injected.js`)
- 后台请求处理 → ZeroPrint 服务: POST 打印任务 (evidence: `background.js`)
