feat: 新增运动节拍训练工具套件与子工具页面
新增运动节拍RepClock全套小程序页面、后端API与数据库服务,新增subhub子工具汇总页面,优化全局主页样式与配置,为web静态资源添加版本缓存参数,补充配套调试脚本
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
const Database = require('better-sqlite3')
|
||||
const path = require('path')
|
||||
const { bindRoutes: bindPersonalCollectRoutes } = require('./kits/personal_collect')
|
||||
|
||||
const CORE_DB_PATH = path.join(process.cwd(), 'data', 'mp_time_assistant_core.db')
|
||||
|
||||
@@ -10,7 +9,16 @@ const KIT_META = [
|
||||
{
|
||||
id: 'personal_collect',
|
||||
name: '微信收藏夹',
|
||||
description: '聊天图片、文件收藏管理,标签搜索,软删除可追溯。',
|
||||
description: '聊天图片 / 文件 / 文字收藏,标签搜索,软删除可追溯。独立部署,零共享。',
|
||||
icon: '📁',
|
||||
meta: 'API: /api/mp_personal_collect/ · DB: mp_personal_collect.db',
|
||||
},
|
||||
{
|
||||
id: 'rep_clock',
|
||||
name: '运动节拍 RepClock',
|
||||
description: 'HIIT / Yoga / 拉伸节奏倒计时,锚点时钟 + 女声播报,后台时间自动补偿。',
|
||||
icon: '⏱️',
|
||||
meta: 'API: /api/mp_rep_clock/ · DB: mp_rep_clock.db',
|
||||
},
|
||||
]
|
||||
|
||||
@@ -53,6 +61,7 @@ const serializeState = () => {
|
||||
return {
|
||||
ok: true,
|
||||
activeKit: row.active_kit || null,
|
||||
active_kit: row.active_kit || null,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +74,10 @@ const bindRoutes = app => {
|
||||
appName: 'MpTimeAssistant',
|
||||
appNameZh: 'MilesYang时光助手',
|
||||
kits: KIT_META,
|
||||
notes: {
|
||||
'personal_collect_api_prefix': '/api/mp_personal_collect/kits/personal_collect',
|
||||
'rep_clock_api_prefix': '/api/mp_rep_clock/kits/rep_clock',
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
@@ -74,19 +87,15 @@ const bindRoutes = app => {
|
||||
|
||||
app.put('/api/mp_time_assistant/state/active-kit', (req, res) => {
|
||||
try {
|
||||
const raw = String(req.body && req.body.kitId || '').trim()
|
||||
const raw = String(req.body && req.body.kitId || req.body && req.body.kit_id || '').trim()
|
||||
const nextKit = raw || null
|
||||
if (nextKit && !KIT_META.find(item => item.id === nextKit)) {
|
||||
return res.status(400).json({ ok: false, error: 'unknown kit id' })
|
||||
}
|
||||
setActiveKit(nextKit)
|
||||
return res.json({ ok: true, activeKit: nextKit })
|
||||
return res.json({ ok: true, activeKit: nextKit, active_kit: nextKit })
|
||||
} catch (e) {
|
||||
return res.status(500).json({ ok: false, error: String(e.message || e) })
|
||||
}
|
||||
})
|
||||
|
||||
bindPersonalCollectRoutes(app)
|
||||
}
|
||||
|
||||
module.exports = { bindRoutes }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user