update reademe and docs
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
- SQLite + SQLAlchemy + Alembic 的三库结构
|
||||
- username/password + server-side session 鉴权
|
||||
- runtime config 页面与 app DB 持久化
|
||||
- public IPv4 monitor、历史持久化与定时检查
|
||||
- SMTP 配置、测试发信与 public IPv4 changed 邮件通知
|
||||
- location recorder
|
||||
- poo recorder
|
||||
- Home Assistant inbound / outbound integration
|
||||
@@ -40,6 +42,7 @@
|
||||
- 单个 admin 用户
|
||||
- server-side session
|
||||
- runtime config 持久化
|
||||
- public IPv4 当前状态与变化历史
|
||||
|
||||
这部分现在也使用 Alembic 管理:
|
||||
|
||||
@@ -199,6 +202,79 @@ uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
|
||||
- token / secret 这类运行时必须可取回的配置,目前允许明文存储在 config 表中
|
||||
- 登录密码仍然单独使用 Argon2 哈希,不走 config 表明文存储
|
||||
|
||||
当前已经接入 config 页面的运行时配置包括:
|
||||
|
||||
- 基础系统配置
|
||||
- auth cookie 相关配置
|
||||
- SMTP 基础配置
|
||||
- TickTick OAuth 配置
|
||||
- Home Assistant 配置
|
||||
|
||||
其中 SMTP password 与其他 secret 字段一致:
|
||||
|
||||
- 页面不明文回显
|
||||
- 留空提交时保留旧值
|
||||
- 用于测试发信与自动通知时不会写入响应
|
||||
|
||||
## Public IPv4 Monitor
|
||||
|
||||
当前系统已经提供最小可用的 public IPv4 monitor:
|
||||
|
||||
- 使用单一 provider 检查当前公网 IPv4
|
||||
- 将状态与变化历史持久化到 app DB
|
||||
- 提供受保护的手动检查入口:`GET /public-ip/check`
|
||||
- 启动时注册 APScheduler job,默认每 4 小时检查一次
|
||||
|
||||
当前 app DB 中与此功能相关的新表:
|
||||
|
||||
- `public_ip_state`
|
||||
- `public_ip_history`
|
||||
|
||||
状态语义如下:
|
||||
|
||||
- `first_seen`:首次发现当前公网 IPv4
|
||||
- `unchanged`:与上次状态一致
|
||||
- `changed`:公网 IPv4 发生变化
|
||||
- `error`:provider 请求失败或返回无效值
|
||||
|
||||
## SMTP 与邮件通知
|
||||
|
||||
当前系统已经提供最小可用的 SMTP 能力:
|
||||
|
||||
- SMTP 配置可在 `/config` 页面填写并保存到 `app_config`
|
||||
- 可通过 config 页面发送测试邮件
|
||||
- 邮件 `From` 头支持显示名,例如 `Home Automation <sender@example.com>`
|
||||
|
||||
当前 SMTP 配置项包括:
|
||||
|
||||
- `SMTP_ENABLED`
|
||||
- `SMTP_HOST`
|
||||
- `SMTP_PORT`
|
||||
- `SMTP_USERNAME`
|
||||
- `SMTP_PASSWORD`
|
||||
- `SMTP_FROM_NAME`
|
||||
- `SMTP_FROM_ADDRESS`
|
||||
- `SMTP_TO_ADDRESS`
|
||||
- `SMTP_USE_STARTTLS`
|
||||
|
||||
当前 public IPv4 monitor 已与 SMTP sender 接通,但只处理一个很小的通知场景:
|
||||
|
||||
- 当 public IPv4 check 结果为 `changed` 时,自动发送一封英文纯文本邮件
|
||||
|
||||
以下情况不会发邮件:
|
||||
|
||||
- `first_seen`
|
||||
- `unchanged`
|
||||
- `error`
|
||||
|
||||
当前通知邮件内容固定,不提供模板系统,正文会包含:
|
||||
|
||||
- previous IP
|
||||
- current IP
|
||||
- detected time
|
||||
|
||||
手动测试时,如果需要再次模拟一次 IP 变化,可以临时修改 `public_ip_state.current_ipv4` 为一个保留测试地址,然后再次调用 `GET /public-ip/check`。
|
||||
|
||||
## OpenAPI
|
||||
|
||||
可使用下面的脚本重新导出当前 API 定义:
|
||||
|
||||
Reference in New Issue
Block a user