Files
tdc-rs/Cargo.toml
T
adminandClaude Code e475137366 feat(auth): 本地账号层 + JNPF 兼容登录,上游完整控制台可登录
- cipher.rs:MD5 + AES-256-ECB,与上游前端 cipher.ts 逐字对齐(含上游自检向量)
- account.rs:本地账号库存 data/accounts.json(不建 tdc_* 表,30 表口径不变),首启引导 admin
- 新增 POST /api/oauth/Login(grant_type=password)与 /api/permission/Users*(仅管理员)
- AppState 增 accounts 字段与 with_accounts 构造器
- 账号登录走 SessionKind::Account,Auth/Me 返 accessAllowed + account
- README:订正「/api/oauth/Login 尚未实现」并补新端点表

Co-Authored-By: Claude Code <[email protected]>
2026-10-25 11:23:12 +08:00

58 lines
2.1 KiB
TOML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
[package]
name = "tdc-connector"
version = "0.1.0"
edition = "2021"
description = "TDC (数据接入连接器) MVP — Rust + 静态 HTML + PGlite 本地优先实现"
[[bin]]
name = "tdc-connector"
path = "src/main.rs"
[dependencies]
# Web 框架 / 运行时
axum = "0.8"
tokio = { version = "1", features = ["full"] }
tower-http = { version = "0.6", features = ["fs", "cors", "trace"] }
# 序列化
serde = { version = "1", features = ["derive"] }
serde_json = "1"
# TDS 跨方 HTTP 契约客户端(红线:TDC 与 TDS 只走 HTTP,不编译期耦合)
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
rand = "0.8"
hex = "0.4"
# 登录口令加解密(与上游前端 cipher.ts 对齐):AES-256-ECB + MD5
# 🔴 版本组合自洽,别混用:aes 0.8 / ecb 0.1 都依赖 cipher 0.4 家族;
# aes 0.9 / ecb 0.2 是 cipher 0.5 家族,两套泛型不通用。
# 🔴 md-5 钉 0.10(crate 名 `md5`,`use md5::{Digest, Md5};`);0.11 的 API 不同。
aes = "0.8"
ecb = "0.1"
md-5 = "0.10"
# 登录表单解析(application/x-www-form-urlencoded)。
# ⚠️ axum 0.8.9 的 `Form<T>` 只实现 `FromRequest`、不实现 `OptionalFromRequest`
# ⇒ `Option<Form<T>>` 编译不过 ⇒ 改为「取原始 body + serde_urlencoded 自己解析」。
# `serde_urlencoded 0.7.1` 已在 `Cargo.lock` 里(axum 的传递依赖)⇒ 不引入新下载。
serde_urlencoded = "0.7"
# 内嵌 PostgreSQL(进程内原生编译,非 WASM):承载全部 tdc_* 业务数据
# 包名 pglite-rs,import 为 pglite。无需扩展时不用 build.rs/export_dynamic。
pglite-rs = "0.2"
# 真实 UTC 时间戳(last_heartbeat / 同步日志用,避免手写日历换算)
chrono = { version = "0.4", default-features = false, features = ["clock"] }
[dev-dependencies]
# 路由级中间件测试(Task 5 fix round 1):`tower::ServiceExt::oneshot` 打请求
tower = { version = "0.5", features = ["util"] }
http-body-util = "0.1"
[profile.release]
opt-level = 2
lto = "thin"
strip = "symbols" # 发布包剥离符号表,体积减半以上
panic = "abort" # 不生成 unwind 表,进一步缩小
codegen-units = 16