refactor: 重构禅音工具路径与配置,新增私人剪贴板技能
这是一次大型重构和功能新增: 1. 将原 zen_box 工具重命名为 web_zen_box,调整所有相关路径与配置 2. 新增 web_order_box 原生Web应用的完整资源与部署脚本 3. 新增私人剪贴板后端技能与配套测试脚本 4. 修复订单盒子APP的API地址配置,避免路径重复拼接 5. 新增本地开发跨域白名单支持localhost 6. 清理旧版zen_box的冗余文件
This commit is contained in:
+25
-2
@@ -100,7 +100,9 @@ const allowedOrigins = [
|
||||
'https://traesite.umersoft.com',
|
||||
'http://traesite.umersoft.com',
|
||||
'https://traesite.umersoft.com:8975',
|
||||
'http://traesite.umersoft.com:8975'
|
||||
'http://traesite.umersoft.com:8975',
|
||||
'http://localhost:8081',
|
||||
'http://127.0.0.1:8081'
|
||||
]
|
||||
app.use(cors({
|
||||
origin: function (origin, callback) {
|
||||
@@ -5906,9 +5908,30 @@ app.get('/api/box_backup/download/lowfreq_decrypted', async (req, res) => {
|
||||
} catch (e) { res.status(500).json({ ok: false, error: String(e.message || e) }) }
|
||||
})
|
||||
|
||||
// web_order_box routes - 原生 HTML/CSS/JS Web 应用
|
||||
app.get('/tools/web_order_box', (req, res) => {
|
||||
res.sendFile(path.join(process.cwd(), 'public', 'tools', 'web_order_box', 'index.html'))
|
||||
})
|
||||
app.use('/tools/web_order_box', (req, res, next) => {
|
||||
try {
|
||||
const authConfigPath = path.join(process.cwd(), 'public', 'tools', 'web_order_box', 'auth_config.json')
|
||||
if (fs.existsSync(authConfigPath)) {
|
||||
const authConfig = JSON.parse(fs.readFileSync(authConfigPath, 'utf-8'))
|
||||
if (authConfig.enable_auth === false) return next()
|
||||
}
|
||||
if (hasNavAuthRoot(req)) return next()
|
||||
return res.status(401).send('未授权')
|
||||
} catch { return res.status(401).send('未授权') }
|
||||
})
|
||||
app.use('/tools/web_order_box', (req, res, next) => {
|
||||
res.set('X-Frame-Options', 'SAMEORIGIN')
|
||||
next()
|
||||
})
|
||||
app.use('/tools/web_order_box', express.static(path.join(process.cwd(), 'public', 'tools', 'web_order_box')))
|
||||
|
||||
app.get('/api/zen_box/playlists', (req, res) => {
|
||||
try {
|
||||
const zenDir = path.join(process.cwd(), 'public', 'tools', 'zen_box')
|
||||
const zenDir = path.join(process.cwd(), 'public', 'tools', 'web_zen_box')
|
||||
const files = fs.existsSync(zenDir) ? fs.readdirSync(zenDir, { withFileTypes: true }) : []
|
||||
const playlists = files
|
||||
.filter(entry => entry && entry.isFile && entry.isFile())
|
||||
|
||||
Reference in New Issue
Block a user