feat: DSL 磁力聚合 — 搜索/解析/预览/投递 + cilisousuo 源 + 中英双语 + Docker 部署
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { downloadsCol, tryMongo } from '../utils/mongo'
|
||||
|
||||
/** 投递下载记录 */
|
||||
export default defineEventHandler(async (event) => {
|
||||
const limit = Math.min(Number(getQuery(event).limit) || 30, 200)
|
||||
|
||||
const data = await tryMongo(async () => {
|
||||
const col = await downloadsCol()
|
||||
const items = await col.find({}).sort({ createdAt: -1 }).limit(limit).toArray()
|
||||
return items.map((it) => ({ ...it, _id: String(it._id) }))
|
||||
})
|
||||
|
||||
return { items: data || [], offline: data === null }
|
||||
})
|
||||
Reference in New Issue
Block a user