Commit Graph

400 Commits

Author SHA1 Message Date
mediabot-pt
e15e242153 fix: preview模式改为draft优先fallback到published(正式版+预览版并集) 2026-07-07 11:38:52 +08:00
mediabot-pt
5f58083074 feat: 快照改为预览版/正式版两阶段发布 - 新增 saveDraft 接口手动保存草稿快照 - 新增 getDraftBundleJson 方法读取预览版(Caffeine缓存) - SnapshotController 支持 ?preview=true 参数读取 draft - 前端编辑页改为'保存草稿'+'发布正式版'两个按钮 - AdminController 新增单站点 save-draft/publish 接口 - 复用 populateSnapshotFields 消除重复代码 2026-07-07 11:36:38 +08:00
mediabot-pt
820b180d87 perf: 优化快照接口——缓存预序列化 JSON,消除重复序列化
- Caffeine 缓存改为存储 bundle JSON 字符串而非 SiteSnapshot 对象(减少内存占用)
- 新增 getActiveBundleJson 方法,SnapshotController 直接使用缓存 JSON
- bundle JSON 新增 checksum 字段,ETag 比较无需额外查库
- 删除 SnapshotController.toJson 重复序列化代码
- publish 时复用已序列化的 JSON 上传 CDN
2026-07-07 11:28:28 +08:00
mediabot-pt
9f94b53753 perf: 为 SiteSnapshotService.getActive 增加 Caffeine 本地缓存
- 缓存过期时间 10 分钟,最大 500 条
- publish 时主动刷新缓存,确保最新配置立即可用
- 避免 mediabot 每次请求都查数据库
2026-07-07 11:19:36 +08:00
mediabot-pt
a92ddccc46 docs: 完善接口文档可用性说明,补充 PAR Server 整体不可用时的 CDN fallback 方案 2026-07-07 11:18:15 +08:00
mediabot-pt
c823878ae0 fix: 解决 ConfigServiceImpl 与 SiteSnapshotServiceImpl 循环依赖
- 移除 SiteSnapshotServiceImpl 对 ConfigService 的依赖,直接使用 SiteConfigMapper
- ConfigServiceImpl/SitePagesServiceImpl/RiskRuleServiceImpl 改用 ApplicationEvent 异步触发快照更新
- 新增 SnapshotUpdateEvent 和 SnapshotUpdateListener
- ParApplication 添加 @EnableAsync 支持异步事件处理
- AdminController 中 updateSnapshot 调用改为发布事件
2026-07-07 11:17:22 +08:00
mediabot-pt
b25aa82c73 重构: 引入 site_snapshots 表统一站点配置快照管理
- 新增 site_snapshots 表 (V16 迁移),统一存储脚本+页面+规则的合并快照
- 新增 SiteSnapshot 实体、Mapper、Service
- 配置变更时自动触发快照更新 (checksum 去重)
- 新增 SnapshotController 提供 /api/v1/snapshots/{siteId} 端点,支持 ETag/304
- 重构 publishManifest 使用快照服务,只发布变更站点
- 保留七牛云 CDN 作为灾备层
- 兼容旧 /bundle 和 /bundles/ 路径
2026-07-07 11:09:52 +08:00
mediabot-pt
98bc5b3183 feat: 合并配置包 - publish 时生成 bundle,mediabot 下载保证版本一致 2026-07-07 10:50:37 +08:00
mediabot-pt
223528817e fix: 修复 Admin 权限校验与 GET /api/v1/configs 404 问题 2026-07-07 08:59:39 +08:00
mediabot-pt
a0780c64bb fix: 修复mediabot拉取风险规则失败的三个问题
1. HMAC拦截器跳过GET请求,mediabot拉取规则不再被401拦截
2. findByIdentifier增加site_type回退查找,兼容按site_type查询
3. saveRules自动填充site_type字段,从站点表获取
4. GET接口version参数支持非数字值如latest
2026-07-07 00:33:46 +08:00
mediabot-pt
15a3c381d0 fix: 修复risk_rules表site_type字段无默认值导致插入失败问题 2026-07-07 00:19:01 +08:00
mediabot-pt
64de9a0284 fix: 将迁移脚本中的SELECT替换为DO 0以避免Flyway处理结果集问题 2026-07-07 00:10:09 +08:00
mediabot-pt
83441e5a96 fix: 修复V15迁移脚本CREATE INDEX IF NOT EXISTS语法错误 2026-07-07 00:06:55 +08:00
mediabot-pt
c34eaed59b fix: 修复V15迁移脚本MySQL语法错误,移除不支持的IF NOT EXISTS语法 2026-07-06 23:59:15 +08:00
mediabot-pt
0b0dcb4f04 refactor: use only siteId for risk rule storage, drop type-level fallback 2026-07-06 23:52:30 +08:00
mediabot-pt
a643d976cf feat: support both site-level and type-level risk rule storage
List shows source column: site-level or type-level

Fallback: siteId rule first, then siteType rule

Save always creates site-level entry; load falls back to type-level if none exists
2026-07-06 23:51:26 +08:00
mediabot-pt
5a7b218944 fix: store risk rules per siteId instead of shared siteType 2026-07-06 23:50:23 +08:00
mediabot-pt
dde14cb73f fix: save no longer returns to list page 2026-07-06 23:39:45 +08:00
mediabot-pt
650402baf2 fix: remove fold/expand feature, always show card body
Fold was unreliable and unnecessary; body is always visible now
2026-07-06 23:33:29 +08:00
mediabot-pt
8381589388 fix: improve card fold/expand UX - single-click toggle, clear text hint
Click anywhere on header to toggle fold/expand

Right side shows '\u5c55\u5f00' or '\u6536\u8d77' text instead of tiny arrow icon

Drag handle icon stops click propagation to prevent accidental fold

Delete button uses stopPropagation to avoid triggering fold
2026-07-06 23:26:56 +08:00
mediabot-pt
1c06be991d feat: DRATIO supports multiple threshold-ratio levels
Replace single threshold+minRatio with levels array

Card header: \u4e0b\u8f7d\u91cf\u5206\u7ea7\u63a7\u5236\uff082\u7ea7\uff09

Card body: editable rows with add/delete buttons per level

Default preset: 100GB\u21921.0, 500GB\u21922.0, 1000GB\u21923.0

Auto-migrate old single-value format on load
2026-07-06 23:07:27 +08:00
mediabot-pt
1cea882d9d refactor: make applicable condition a read-only tag in card header
Applicable is preset-defined, not editable on card

Shown as grey tag after action label: \u5c01\u53f7/\u5220\u9664\u8d26\u53f7 (\u975e\u5c01\u5b58\u8d26\u53f7)

Remove applicable dropdown from card body, onApplicableChange handler
2026-07-06 23:02:16 +08:00
mediabot-pt
194ce96f39 refactor: make rule type a read-only label on card
Type is fixed by preset, no need for dropdown editing

Remove unused typeDefaults, onTypeChange functions
2026-07-06 23:00:55 +08:00
mediabot-pt
cf26f2f6b1 refactor: remove add-rule button, keep only quick-add dropdown
All rule patterns are covered by presets, no need for blank rule creation

Also fix missing Refresh icon import
2026-07-06 22:52:19 +08:00
mediabot-pt
36e05896e5 refactor: remove redundant template import dialog, keep only quick-add dropdown
Quick-add dropdown already serves the same purpose with fewer clicks
2026-07-06 22:45:16 +08:00
mediabot-pt
110af4a79c feat: prevent duplicate rules by type+applicable key
- Uniqueness key: type + applicable condition combination

- '添加规则' button warns if KILL(null) already exists

- Dropdown and template dialog disabled+greyed for already-added presets

- Import skips duplicates with warning message

- Applicable dropdown change guarded against duplicates
2026-07-06 22:44:15 +08:00
mediabot-pt
accb38986a style: add color to action labels in rule summary text
\u4fdd\u53f7=green(#67c23a), \u5c01\u53f7/\u5220\u9664\u8d26\u53f7=red(#f56c6c), \u5c01\u53f7(\u7f13\u52117\u5929)=orange(#e6a23c)
2026-07-06 22:41:55 +08:00
mediabot-pt
7ec4e16eb6 feat: add fixed-order rule summary text at bottom of visual editor
Sort order: EXEMPT \u2192 TASK \u2192 HD \u2192 KILL \u2192 RATIO \u2192 DRATIO \u2192 TRAFFIC

Each rule shown as natural language sentence with applicable condition

TASK shows only enabled requirements

Regardless of card drag order, summary always displays in fixed sequence
2026-07-06 22:35:38 +08:00
mediabot-pt
15dcccb405 feat: add enable/disable switch for each TASK requirement
Each requirement has an el-switch; disabled items grey out and input is locked

Sites can pick only the conditions they need (e.g. upload+download only)
2026-07-06 22:31:52 +08:00
mediabot-pt
a956d38365 fix: rename ratio penalty label to \u5c01\u53f7\uff08\u7f13\u52117\u5929\uff09
More accurate than '\u964d\u7ea7\u81f3Peasant': user is demoted regardless of rank, then killed after 7 days

Template dialog: '\u7f13\u52117\u5929' instead of '\u964d\u7ea7'
2026-07-06 22:29:23 +08:00
mediabot-pt
86d1089114 fix: RATIO/DRATIO actions change to demote-to-Peasant first
- Low ratio \u2192 demote to Peasant \u2192 kill after 7 days, not immediate kill

- Orange arrow + '\u964d\u7ea7\u81f3Peasant' label instead of red '\u5c01\u53f7/\u5220\u9664\u8d26\u53f7'

- Card body shows full explanation: \u4f4e\u4e8e\u6b64\u5206\u4eab\u7387\u5219\u964d\u7ea7\u81f3Peasant\uff0c7\u5929\u540e\u5c01\u53f7/\u5220\u9664\u8d26\u53f7

- Template dialog also shows '\u964d\u7ea7' label for RATIO/DRATIO presets
2026-07-06 22:28:24 +08:00
mediabot-pt
03f6fd265f style: remove colored left border and hover shadow from rule cards
Simpler, cleaner look without the AI-style decorative borders
2026-07-06 22:24:22 +08:00
mediabot-pt
30edbf9d32 feat: convert rank inputs to dropdown with level numbers
- 10 standard PT ranks: Peasant(0) \u2192 Nexus Master(9)

- Dropdown shows \u201c3. Elite User\u201d format with level and name

- Card header and template dialog also show level numbers

- Default preset: Elite User for perm, Power User for seal
2026-07-06 22:23:10 +08:00
mediabot-pt
d8a23f1e40 feat: add EXEMPT type for rank-based immunity rules
- Opposite of kill rules: protects users instead of deleting them

- permRank: users at/above this rank permanently immune from all cleanups

- sealExemptRank: users at/above this rank won't be killed when sealed

- Green left border + green '\u4fdd\u53f7' label to visually distinguish from kill rules

- Template: Elite User for perm, Power User for seal exemption
2026-07-06 22:14:55 +08:00
mediabot-pt
d1570fb80b feat: add DRATIO type for dynamic ratio rules
- When download reaches threshold (GB), ratio must meet minRatio

- Card header: \u4e0b\u8f7d\u91cf \u2265 XGB \u65f6\u5206\u4eab\u7387 \u2265 Y \u2192 \u5c01\u53f7/\u5220\u9664\u8d26\u53f7

- Card body: download threshold input + required ratio input

- Preset: 100GB download, 1.0 ratio
2026-07-06 22:13:52 +08:00
mediabot-pt
b5a8dfa3b8 feat: add TASK type for new user assessment rules
- New TASK type with requirements array: upload_gb, download_gb, bonus, seeding_score, avg_seed_time

- Card header shows: \u8003\u6838\u5468\u671f N\u5929 \u2192 \u5c01\u53f7/\u5220\u9664\u8d26\u53f7

- Card body: editable period + 5 requirement rows (each with editable threshold)

- Type switch to TASK auto-initializes requirements from defaults

- Preset import auto-fills requirements for TASK rules

- Add seeding_score metric option
2026-07-06 22:13:04 +08:00
mediabot-pt
51bf25912b fix: add explicit '\u65e0\u6761\u4ef6' option to applicable dropdown
Easier to switch back than relying on clearable X button
2026-07-06 22:07:41 +08:00
mediabot-pt
66e1ec32c6 chore: hide description field in rule card body
Card header already shows full rule summary, description is redundant
2026-07-06 22:06:16 +08:00
mediabot-pt
5f57453af9 fix: remove redundant LOGIN type, rename KILL label to \u6d3b\u8dc3\u5ea6
- LOGIN type duplicated with KILL (both use days_since_last_login)

- KILL label: \u5c01\u53f7\u89c4\u5219 \u2192 \u6d3b\u8dc3\u5ea6 (action is always \u5c01\u53f7/\u5220\u9664\u8d26\u53f7, type now describes monitoring category)
2026-07-06 22:00:10 +08:00
mediabot-pt
3209ff16d6 chore: change \u5c01\u53f7 label to \u5c01\u53f7/\u5220\u9664\u8d26\u53f7 2026-07-06 21:58:13 +08:00
mediabot-pt
c9889a4aab refactor: simplify rule card UI - hide metric/condition/unit
- Replace editable name/metric/condition/unit with plain text in card header

- Card header shows: [type] [metric label] [condition label] [threshold][unit] \u2192 \u5c01\u53f7

- Type change auto-updates metric/condition/unit via typeDefaults mapping

- Card body only shows: threshold, applicable, description

- Fix edit title to show site name instead of raw siteType

- Remove unused styles and functions
2026-07-06 21:52:48 +08:00
mediabot-pt
842c01d79a refactor: remove action field, rules define kill conditions only
- WARN is auto-detected by RiskCheckEngine (riskPct > 80), not configured in rules

- Each rule simply defines: type + metric + condition + threshold + unit -> 封号

- Card always shows red left border and red '封号' arrow, no action selector

- Presets reduced to 7 kill-only templates, no WARN presets
2026-07-06 21:12:47 +08:00
mediabot-pt
040b97914e refactor: simplify risk rules to KILL/WARN actions only
- Replace complex type system (DEMOTE/TASK) with simple KILL/WARN action model

- Each rule now has: type (monitoring category) + action (KILL=封号 / WARN=告警)

- Type options: KILL/TRAFFIC/LOGIN/HD/RATIO (no DEMOTE/TASK)

- Card left border color by action: red=KILL, orange=WARN

- 12 preset templates with alert-based rules (60-day no-traffic warn, 140-day login warn, HnR warn, ratio warn)

- Remove requirements sub-table and downloadThreshold fields
2026-07-06 21:11:21 +08:00
mediabot-pt
9b5cee6439 feat: full PT site management rules system in risk rules editor
Type coverage: KILL/DEMOTE/TASK/TRAFFIC/LOGIN/HD/RATIO matching all 6 rule categories

Advanced fields: applicable conditions (!sealed/sealed/zero_traffic/new_account_30d), requirements for TASK type, downloadThreshold for DEMOTE type

12 preset templates covering: dynamic ratio, survival policy, zero-activity cleanup, novice exam, HnR penalty, traffic anomaly

Card fold/expand via double-click or arrow button, metric suggestions with filterable select, cleaner field layout
2026-07-06 21:06:20 +08:00
mediabot-pt
6a41938671 fix: restore left JSON editor + right card layout for risk rules editor
- Left pane: fixed 400px CodeEditor for JSON editing

- Right pane: card-based visual editor with natural language, drag-and-drop, presets

- Remove JSON toggle button, always show both panes
2026-07-06 17:51:46 +08:00
mediabot-pt
2cdf502831 feat: redesign risk rules editor with card-based visual UI
- Replace table-based editor with intuitive card layout showing rules as readable sentences

- Add drag-and-drop reordering for risk rules

- Add 8 preset rule templates with one-click import (traffic, ratio, kill, HnR, login)

- Collapse JSON editor by default, toggle via button for power users

- Show condition as natural language (GT=greater than, LT=less than, etc.)

- Color-coded left border by severity (red=CRITICAL, orange=WARN, blue=INFO)

- Add optional rule description field
2026-07-06 17:19:57 +08:00
mediabot-pt
773ad8fdb7 feat: page config upload button for normal sites, add cloud upload endpoint
- SitePagesController: add PUT /admin/site-pages/{siteId}/upload for uploading normal site pages to cloud storage

- SitePages.vue: show upload button for both default templates and normal sites
2026-07-06 15:13:09 +08:00
mediabot-pt
8724774850 feat: 页面配置入口地址添加验证按钮,解析失败自动提交错误日志
- 后端新增 POST /api/v1/admin/site-pages/verify 端点
  - 接收 siteId/url/pageKey,用对应 Groovy 脚本访问URL并解析
  - 解析失败(matched=false)时自动提交 error-log 到 PAR
  - 支持 HTTP_ERROR/EMPTY_RESPONSE/PARSE_FAILED/SCRIPT_ERROR 多种错误类型
- 前端 SitePages.vue 每条页面入口 URL 后添加验证按钮
  - 成功显示绿色 ✓,失败显示红色 ✗,并展示解析结果消息
  - 显示响应耗时
- api/index.js 新增 adapter.verifyPage 方法
2026-07-06 13:39:32 +08:00
mediabot-pt
355f586086 fix: WebConfig HMAC 拦截器排除 GET pages/version 端点公开访问 2026-07-06 12:55:32 +08:00
mediabot-pt
184e5161fc fix: getVersion 端点加入默认模板版本回退逻辑,与 getPages 保持一致 2026-07-06 12:40:40 +08:00