|
|
1a359f8d84
|
fix: 日志输出从文件改为 stdout(journald 可见),紧凑格式,去掉 tracing-appender
|
2026-07-20 09:24:12 +08:00 |
|
|
|
ac49ccb552
|
fix: Alipay回调手动解析表单支持GBK/GB2312编码回退
|
2026-06-15 11:17:43 +08:00 |
|
|
|
c9c9cc04de
|
refactor: config.rs去掉TOML文件加载,统一走systemd Environment
|
2026-05-25 16:39:46 +08:00 |
|
moira
|
f8a95c7417
|
feat: 集成 Sentry 错误监控 + 前端错误上报中继
后端:
- Cargo.toml 添加 sentry/sentry-actix/sentry-tracing (v0.48)
- main.rs 条件初始化 Sentry(SENTRY_DSN 环境变量控制)
- 新增 handlers/sentry.rs — POST /api/sentry/events 前端中继端点
- sentry-actix 全局中间件 + sentry-tracing 自动捕获 tracing::error!
- .env.example 添加 SENTRY_DSN / SENTRY_TRACES_SAMPLE_RATE 配置
前端:
- 新增 utils/sentryReporter.ts (批量上报/防抖/开发环境跳过)
- app.ts 全局错误处理接入 Sentry (wx.onError/onUnhandledRejection/onPageNotFound)
Sentry 未配置 DSN 时完全无操作,无性能开销
|
2026-05-14 10:12:09 +08:00 |
|
moira
|
27c8979690
|
fix: 全量代码审计修复—安全/死代码/错误处理/配置净化
P0 安全修复:
- 支付宝回调验签 (alipay_notify BTreeMap + rsa2_verify)
- JWT fallback 'default_secret' 改为 .expect() (panic保底)
- 安全响应头中间件 (CSP/X-Frame-Options/HSTS)
P1 死代码清理:
- 移除孤儿文件 src/alipay.rs (284行, 无mod注册)
- 移除Cargo未使用依赖 (actix-files/error/log/hex/digest)
- log::info! → tracing::info! (auth.rs)
- 移除 config.rs server_host + 3个TOML定义
P1 质量修复:
- 修复 weather.rs unwrap() → unwrap_or
- 修复 auth.rs+payment.rs 错误吞咽 (add tracing::warn)
- 修复 main.rs 3x parse().unwrap → unwrap_or
P3 运维:
- 新增 scripts/backup-db.sh (定时备份用)
- 新增 README.md (快速入门文档)
- deploy.sh 集成 backup-db.sh 上传
|
2026-05-13 17:20:31 +08:00 |
|
|
|
2046638721
|
feat: 实现 Mock 支付功能,修复支付激活会员问题
- 当未配置 ALIPAY_* 环境变量时,自动启用 Mock 支付模式
- Mock 支付页面点击按钮后调用 /api/payment/mock-confirm 激活会员
- 更新 AGENTS.md 文档说明 Mock 支付配置和使用方法
|
2026-04-28 10:17:26 +08:00 |
|
|
|
e6048ea010
|
feat(auth): 实现登录限流和性能优化
性能优化:
- 添加数据库索引优化查询性能 (006)
- weather_data: user_id, date, is_favorite 索引
- users: openid 索引
- payment_orders: status 索引
- 新增 refresh_tokens 表支持双 Token 机制 (004)
- 新增 web_login_codes 表支持网页端扫码登录 (005)
安全增强:
- 实现基于 IP 的登录限流 (rate_limiter.rs)
- 滑动窗口算法: 5次/分钟/IP
- 自动清理过期记录
- 429 TooManyRequests 响应
新模块:
- src/rate_limiter.rs: 限流模块
- src/alipay.rs: 支付宝签名模块 (RSA2)
- src/error.rs: 统一错误类型 (含 TooManyRequests)
- src/handlers/meta.rs: 元数据处理器
代码清理:
- 修复 .gitignore 规则,正确跟踪 src/ 和 migrations/
|
2026-04-24 16:13:49 +08:00 |
|
|
|
e8286310ea
|
feat(payment): 接入支付宝沙箱环境 (alipay.trade.page.pay)
|
2026-04-23 12:23:53 +08:00 |
|
|
|
a91948a18c
|
refactor(config): 统一版本管理,移除冗余的 app_version 字段
- 移除 config/*.toml 中的 app_version 字段(代码中未使用)
- 版本号统一由 Cargo.toml 管理
- Cargo.lock 自动同步更新
- 更新 AGENTS.md 添加版本管理说明
|
2026-04-19 20:35:12 +08:00 |
|
|
|
e14c85436b
|
feat(auth): 添加 Refresh Token 双 Token 机制
- 添加 /api/refresh-token 接口支持 Token 续期
- 登录接口返回 access_token 和 refresh_token
- 新增 refresh_tokens 表存储 refresh_token
- 部署脚本添加数据库备份和迁移功能
- deploy.sh 添加 4 项 API 测试
- 更新 AGENTS.md 文档
|
2026-04-19 16:01:41 +08:00 |
|
|
|
562528a1f0
|
feat: implement payment order system (create-order, mock-confirm, get-quota)
|
2026-04-17 12:45:53 +08:00 |
|
|
|
da4e6f557e
|
feat: 实现后端多环境配置机制
- 使用 toml crate 替代 config crate 直接读取配置文件
- 创建 config/default.toml、config/development.toml、config/production.toml
- 重写 config.rs 支持多环境配置加载
- 增强 deploy.sh 支持 development/production 环境参数
- 更新 IMPROVEMENTS.md 标记环境区分完成
|
2026-04-17 11:11:13 +08:00 |
|
|
|
741d6acff1
|
feat: 升级日志系统为 tracing 结构化日志
- 替换 env_logger 为 tracing + tracing-subscriber
- 统一使用 tracing::{debug, error, info, warn} 日志宏
- 消除所有 eprintln!/println 调用
- 添加 JSON 格式日志输出便于 ELK Stack 收集
- 添加文件日志轮转(每天一个新文件 ./logs/rust-backend-{date}.log)
- 日志等级过滤:rust_backend=info, actix_web=info, sqlx=warn
- 更新 IMPROVEMENTS.md 标记 6.1 日志系统两项完成
|
2026-04-15 10:39:30 +08:00 |
|
|
|
484146aba9
|
支付系统核心:配额限制与用户付费状态管理
- 添加 tokio 依赖用于异步测试
- 启用 User 结构体,添加 is_paid/is_admin/paid_expires_at 字段
- 添加 UpdatePaymentRequest 请求体
- insert_weather_data 集成配额检查逻辑
- 新增 get_user_by_id、count_user_weather_data、update_user_payment_status
- 添加 payment_fields 数据库迁移脚本
|
2026-03-25 13:17:36 +08:00 |
|
|
|
7143064a09
|
更新了https功能,将原有的服务从http迁移到了https中
|
2025-09-30 17:26:56 +08:00 |
|
|
|
7fa1ae6301
|
使用了logger来进行后端的消息记录
|
2025-09-30 15:59:15 +08:00 |
|
|
|
ea64c436b6
|
可以在使用temp_token的情况下使浏览器和微信小程序前端都能获取到正确的数据
|
2025-09-29 11:56:08 +08:00 |
|
|
|
56844a537f
|
可以正常使用get_weather_details获取前端指定的数据了
|
2025-09-29 11:20:21 +08:00 |
|
|
|
1c2eb82248
|
使用了jwt作为身份验证和分发
|
2025-09-26 13:48:18 +08:00 |
|
|
|
40d4c9ad49
|
weather data upload test
|
2025-09-12 09:25:15 +08:00 |
|
|
|
00a4faa410
|
添加weatherdata表的struct
|
2025-09-10 16:24:01 +08:00 |
|
|
|
7e569e59d6
|
更新了get_user_id和get_openid
|
2025-09-10 15:42:05 +08:00 |
|
|
|
f567e66485
|
访问users数据库
|
2025-09-05 15:10:30 +08:00 |
|
|
|
e6f937fe44
|
initialize
|
2025-09-04 16:36:08 +08:00 |
|