# frostpolaris1/yiban-auto-sign architecture

> Architecture diagram of the GitHub repository frostpolaris1/yiban-auto-sign, 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/frostpolaris1/yiban-auto-sign
- Repository: https://github.com/frostpolaris1/yiban-auto-sign

## Overview

易班自动签到是一个自托管的定时签到与网页管理系统。管理员通过后台管理账号、用户和设置；调度器触发签到程序，程序读取可用账号并通过易班客户端完成登录、定位与签到，随后记录结果并可发送失败通知。主要领域阶段包括管理与审核、调度与重试、平台认证与签到、持久化及通知；加密和安全策略是关键内部支撑层。README 描述了重要能力，但部分实现未采样，相关关系仅按文档或索引所示连接。

Main entry points: [`scripts/signin.py`](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/scripts/signin.py) (签到运行器), [`scripts/db.py`](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/scripts/db.py) (SQLite 数据库), [`web/static/js`](https://github.com/frostpolaris1/yiban-auto-sign/tree/main/web/static/js) (管理界面), [`web/app.py`](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/web/app.py) (后台服务)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_management["管理后台"]
  node_webui["管理界面"]
  node_webapp["后台服务<br/>[app.py]"]
  node_accountadmin["账号与用户管理<br/>[app.py]"]
  node_calendar["日志与日历<br/>[calendar.js]"]
end

subgraph group_execution["签到执行"]
  node_scheduler["定时调度<br/>[scheduler.py]"]
  node_signin["签到运行器<br/>[signin.py]"]
  node_retryjobs["验证与重试任务<br/>[jobs.py]"]
end

subgraph group_platform["易班接入"]
  node_yibanclient["易班客户端<br/>[client.py]"]
  node_protocol["认证签到协议<br/>[protocol.py]"]
  node_requestsecurity["请求安全策略<br/>[security.py]"]
end

subgraph group_persistence["数据与安全"]
  node_database[("SQLite 数据库<br/>[db.py]")]
  node_accountstore["账号存取<br/>[accounts.py]"]
  node_crypto["账号加密<br/>[account_crypto.py]"]
  node_clock["北京时间基准<br/>[clock.py]"]
end

subgraph group_messaging["通知与邮件"]
  node_notifyconfig["通知配置<br/>[config.py]"]
  node_notifyledger[("通知账本<br/>[ledger.py]")]
  node_notifytransport["Webhook 发送<br/>[transport.py]"]
  node_mailtransport["邮件发送<br/>[transport.py]"]
end

node_admin(("管理员"))
node_yibanservice(("易班服务"))
node_notificationservice(("通知服务"))

node_admin -->|"管理账号"| node_webui
node_webui -->|"调用后台"| node_webapp
node_webapp -->|"处理管理"| node_accountadmin
node_webui -->|"展示日历"| node_calendar
node_scheduler -->|"启动签到"| node_signin
node_signin -->|"读取账号"| node_accountstore
node_signin -->|"执行签到"| node_yibanclient
node_signin -->|"处理任务"| node_retryjobs
node_retryjobs -->|"读写任务"| node_database
node_yibanclient -->|"调用协议"| node_protocol
node_yibanclient -->|"注入策略"| node_requestsecurity
node_protocol -->|"认证与签到"| node_yibanservice
node_webapp -->|"读写数据"| node_database
node_signin -->|"读取状态"| node_database
node_accountstore -->|"查询账号"| node_database
node_database -->|"加解密字段"| node_crypto
node_database -->|"使用时间基准"| node_clock
node_signin -->|"发送失败通知"| node_notificationservice
node_notificationservice -->|"读取配置"| node_notifyconfig
node_notificationservice -->|"发送推送"| node_notifytransport
node_notifytransport -->|"记账与节流"| node_notifyledger
node_notifytransport -->|"投递消息"| node_notificationservice
node_signin -->|"发送邮件"| node_mailtransport

click node_webui "https://github.com/frostpolaris1/yiban-auto-sign/tree/main/web/static/js"
click node_webapp "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/web/app.py"
click node_accountadmin "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/web/app.py"
click node_calendar "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/web/static/js/calendar.js"
click node_scheduler "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/docker/scheduler.py"
click node_signin "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/scripts/signin.py"
click node_retryjobs "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/attempt/jobs.py"
click node_yibanclient "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/client.py"
click node_protocol "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/fyiban/protocol.py"
click node_requestsecurity "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/security.py"
click node_database "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/scripts/db.py"
click node_accountstore "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/store/accounts.py"
click node_crypto "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/infra/account_crypto.py"
click node_clock "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/clock.py"
click node_notifyconfig "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/notify/config.py"
click node_notifyledger "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/notify/ledger.py"
click node_notifytransport "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/notify/transport.py"
click node_mailtransport "https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/mail/transport.py"

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_webui,node_webapp,node_accountadmin,node_calendar toneBlue
class node_scheduler,node_signin,node_retryjobs toneAmber
class node_yibanclient,node_protocol,node_requestsecurity toneMint
class node_database,node_accountstore,node_crypto,node_clock toneRose
class node_notifyconfig,node_notifyledger,node_notifytransport,node_mailtransport,node_admin,node_yibanservice,node_notificationservice toneIndigo
```

## Components

### 管理后台

- [管理界面](https://github.com/frostpolaris1/yiban-auto-sign/tree/main/web/static/js): `web/static/js`
- [后台服务](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/web/app.py): `web/app.py`
- [账号与用户管理](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/web/app.py): `web/app.py`
- [日志与日历](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/web/static/js/calendar.js): `web/static/js/calendar.js`

### 签到执行

- [定时调度](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/docker/scheduler.py): `docker/scheduler.py`
- [签到运行器](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/scripts/signin.py): `scripts/signin.py`
- [验证与重试任务](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/attempt/jobs.py): `yiban/attempt/jobs.py`

### 易班接入

- [易班客户端](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/client.py): `yiban/client.py`
- [认证签到协议](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/fyiban/protocol.py): `yiban/fyiban/protocol.py`
- [请求安全策略](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/security.py): `yiban/security.py`

### 数据与安全

- [SQLite 数据库](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/scripts/db.py): `scripts/db.py`
- [账号存取](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/store/accounts.py): `yiban/store/accounts.py`
- [账号加密](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/infra/account_crypto.py): `yiban/infra/account_crypto.py`
- [北京时间基准](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/clock.py): `yiban/clock.py`

### 通知与邮件

- [通知配置](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/notify/config.py): `yiban/notify/config.py`
- [通知账本](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/notify/ledger.py): `yiban/notify/ledger.py`
- [Webhook 发送](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/notify/transport.py): `yiban/notify/transport.py`
- [邮件发送](https://github.com/frostpolaris1/yiban-auto-sign/blob/main/yiban/mail/transport.py): `yiban/mail/transport.py`

### Other components

- **管理员**
- **易班服务**
- **通知服务**

## Connections

- 管理员 → 管理界面: 管理账号 (evidence: `README.md`)
- 管理界面 → 后台服务: 调用后台 (evidence: `README.md`)
- 后台服务 → 账号与用户管理: 处理管理 (evidence: `web/app.py`)
- 管理界面 → 日志与日历: 展示日历 (evidence: `web/static/js/calendar.js`)
- 定时调度 → 签到运行器: 启动签到 (evidence: `docker/scheduler.py`)
- 签到运行器 → 账号存取: 读取账号 (evidence: `scripts/signin.py`)
- 签到运行器 → 易班客户端: 执行签到 (evidence: `scripts/signin.py`)
- 签到运行器 → 验证与重试任务: 处理任务 (evidence: `scripts/signin.py`)
- 验证与重试任务 → SQLite 数据库: 读写任务 (evidence: `yiban/attempt/jobs.py`)
- 易班客户端 → 认证签到协议: 调用协议 (evidence: `yiban/client.py`)
- 易班客户端 → 请求安全策略: 注入策略 (evidence: `yiban/client.py`)
- 认证签到协议 → 易班服务: 认证与签到 (evidence: `yiban/fyiban/protocol.py`)
- 后台服务 → SQLite 数据库: 读写数据 (evidence: `web/app.py`)
- 签到运行器 → SQLite 数据库: 读取状态 (evidence: `scripts/signin.py`)
- 账号存取 → SQLite 数据库: 查询账号 (evidence: `yiban/store/accounts.py`)
- SQLite 数据库 → 账号加密: 加解密字段 (evidence: `scripts/db.py`)
- SQLite 数据库 → 北京时间基准: 使用时间基准 (evidence: `scripts/db.py`)
- 签到运行器 → 通知服务: 发送失败通知 (evidence: `scripts/signin.py`)
- 通知服务 → 通知配置: 读取配置
- 通知服务 → Webhook 发送: 发送推送
- Webhook 发送 → 通知账本: 记账与节流 (evidence: `yiban/notify/transport.py`)
- Webhook 发送 → 通知服务: 投递消息 (evidence: `yiban/notify/transport.py`)
- 签到运行器 → 邮件发送: 发送邮件 (evidence: `scripts/signin.py`)
