Add source filters and a full-window media view
This commit is contained in:
+5
-1
@@ -795,10 +795,14 @@ export function startWebUi(deps: WebUiDeps): WebUiHandle {
|
||||
const kind = ["image", "gif", "video", "audio"].includes(String(req.query.kind ?? ""))
|
||||
? (String(req.query.kind) as "image" | "gif" | "video" | "audio")
|
||||
: undefined;
|
||||
const source = ["attachment", "sticker", "embed"].includes(String(req.query.source ?? ""))
|
||||
? String(req.query.source)
|
||||
: undefined;
|
||||
const channelId = req.query.channelId ? String(req.query.channelId) : undefined;
|
||||
const limit = clampLimit(req.query.limit, 60, 500);
|
||||
const offset = Math.max(0, Number(req.query.offset ?? 0) || 0);
|
||||
|
||||
res.json({ ok: true, result: deps.media.queryMedia({ kind, limit, offset }) });
|
||||
res.json({ ok: true, result: deps.media.queryMedia({ kind, source, channelId, limit, offset }) });
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user