feat: 迁移自定义功能至 1.5.9.9 版本

包含音乐源限制、CI 防 OOM 优化、数据库连接池优化、管理端权限及 UI 细节定制等功能
This commit is contained in:
2026-09-12 19:26:42 +08:00
parent 34f0679117
commit 1106aeea6c
161 changed files with 18963 additions and 27900 deletions
+54
View File
@@ -0,0 +1,54 @@
import axios from 'axios'
import crypto from 'crypto'
export default defineEventHandler(async (event) => {
const query = getQuery(event)
const keyword = query.keyword || query.keywords
if (!keyword) {
throw createError({
statusCode: 400,
message: 'Keyword is required'
})
}
// 我们在这里使用不需要签名的通用接口或移动端旧接口
try {
const url = `http://mobilecdn.kugou.com/api/v3/search/song?format=json&keyword=${encodeURIComponent(keyword as string)}&page=1&pagesize=20&showtype=1`
const response = await axios.get(url, {
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
},
// 允许处理不严谨的 SSL 证书或忽略部分请求错误
validateStatus: () => true
})
const data = response.data
// Process results to map cover images and VIP status correctly
if (data && data.data && data.data.info) {
data.data.info = data.data.info.map((item: any) => {
return {
...item,
isVip: item.pay_type !== 0,
// Extract proper image URL from 'union_cover', '320' size or hash, and use https
pic: item.trans_param?.union_cover
? item.trans_param.union_cover.replace('{size}', '400').replace('http://', 'https://')
: item['320hash']
? `https://imge.kugou.com/stdmusic/400/${item['320hash'].slice(0,2)}/${item['320hash'].slice(2,4)}/${item['320hash']}.jpg`
: item['hash']
? `https://imge.kugou.com/stdmusic/400/${item['hash'].slice(0,2)}/${item['hash'].slice(2,4)}/${item['hash']}.jpg`
: undefined
}
})
}
return data
} catch (error) {
throw createError({
statusCode: 500,
message: 'Music service unavailable'
})
}
})