Add the advanced search drawer, adaptive paging, and zoom
This commit is contained in:
@@ -880,7 +880,9 @@ function buildServer(): McpServer {
|
||||
.describe("Where the item came from"),
|
||||
scrapeId: z.string().optional().describe("Restrict to one scrape"),
|
||||
channelId: z.string().optional().describe("Restrict to one source channel"),
|
||||
authorId: z.string().optional().describe("Restrict to one poster"),
|
||||
authorIds: z.array(z.string()).optional().describe("Restrict to these posters"),
|
||||
origin: z.enum(["dm", "guild"]).optional().describe("Server channels or DMs"),
|
||||
cachedOnly: z.boolean().optional().describe("Only items with a cached preview"),
|
||||
aspect: z
|
||||
.enum(["vertical", "square", "wide43", "wide169", "ultrawide", "other"])
|
||||
.optional()
|
||||
@@ -895,14 +897,30 @@ function buildServer(): McpServer {
|
||||
offset: z.number().int().min(0).optional()
|
||||
}
|
||||
},
|
||||
async ({ kind, source, scrapeId, channelId, authorId, aspect, resolution, after, before, limit, offset }) =>
|
||||
async ({
|
||||
kind,
|
||||
source,
|
||||
scrapeId,
|
||||
channelId,
|
||||
authorIds,
|
||||
origin,
|
||||
cachedOnly,
|
||||
aspect,
|
||||
resolution,
|
||||
after,
|
||||
before,
|
||||
limit,
|
||||
offset
|
||||
}) =>
|
||||
jsonText(
|
||||
media.queryMedia({
|
||||
kind,
|
||||
source,
|
||||
scrapeId,
|
||||
channelId,
|
||||
authorId,
|
||||
authorIds,
|
||||
origin,
|
||||
cachedOnly,
|
||||
aspect,
|
||||
resolution,
|
||||
after,
|
||||
|
||||
@@ -635,6 +635,9 @@ export class MediaService {
|
||||
source?: string;
|
||||
channelId?: string;
|
||||
authorId?: string;
|
||||
authorIds?: string[];
|
||||
origin?: "dm" | "guild";
|
||||
cachedOnly?: boolean;
|
||||
aspect?: string;
|
||||
resolution?: string;
|
||||
after?: string;
|
||||
@@ -751,6 +754,9 @@ export class MediaService {
|
||||
scrapeId?: string;
|
||||
channelId?: string;
|
||||
authorId?: string;
|
||||
authorIds?: string[];
|
||||
origin?: "dm" | "guild";
|
||||
cachedOnly?: boolean;
|
||||
aspect?: string;
|
||||
resolution?: string;
|
||||
after?: string;
|
||||
@@ -762,6 +768,8 @@ export class MediaService {
|
||||
if (meta.state === "deleted") continue;
|
||||
if (options.scrapeId && meta.id !== options.scrapeId) continue;
|
||||
if (options.channelId && meta.channelId !== options.channelId) continue;
|
||||
if (options.origin === "dm" && meta.guildId) continue;
|
||||
if (options.origin === "guild" && !meta.guildId) continue;
|
||||
|
||||
const store = new ScrapeStore(scrapeDir(this.rootDir, meta.id));
|
||||
try {
|
||||
@@ -772,6 +780,8 @@ export class MediaService {
|
||||
kind: options.kind,
|
||||
source: options.source,
|
||||
authorId: options.authorId,
|
||||
authorIds: options.authorIds,
|
||||
cachedOnly: options.cachedOnly,
|
||||
aspect: options.aspect,
|
||||
resolution: options.resolution,
|
||||
after: options.after,
|
||||
@@ -820,6 +830,9 @@ export class MediaService {
|
||||
scrapeId?: string;
|
||||
channelId?: string;
|
||||
authorId?: string;
|
||||
authorIds?: string[];
|
||||
origin?: "dm" | "guild";
|
||||
cachedOnly?: boolean;
|
||||
aspect?: string;
|
||||
resolution?: string;
|
||||
after?: string;
|
||||
|
||||
+28
-3
@@ -882,7 +882,17 @@ export function startWebUi(deps: WebUiDeps): WebUiHandle {
|
||||
? String(req.query.source)
|
||||
: undefined;
|
||||
const channelId = req.query.channelId ? String(req.query.channelId) : undefined;
|
||||
const authorId = req.query.authorId ? String(req.query.authorId) : undefined;
|
||||
const authorIds = req.query.authorId
|
||||
? String(req.query.authorId)
|
||||
.split(",")
|
||||
.map(value => value.trim())
|
||||
.filter(Boolean)
|
||||
: undefined;
|
||||
const origin =
|
||||
req.query.origin === "dm" || req.query.origin === "guild"
|
||||
? (String(req.query.origin) as "dm" | "guild")
|
||||
: undefined;
|
||||
const cachedOnly = req.query.cachedOnly === "1" || req.query.cachedOnly === "true";
|
||||
const aspect = req.query.aspect ? String(req.query.aspect) : undefined;
|
||||
const resolution = req.query.resolution ? String(req.query.resolution) : undefined;
|
||||
const after = req.query.after ? String(req.query.after) : undefined;
|
||||
@@ -896,7 +906,9 @@ export function startWebUi(deps: WebUiDeps): WebUiHandle {
|
||||
kind,
|
||||
source,
|
||||
channelId,
|
||||
authorId,
|
||||
authorIds,
|
||||
origin,
|
||||
cachedOnly,
|
||||
aspect,
|
||||
resolution,
|
||||
after,
|
||||
@@ -922,13 +934,26 @@ export function startWebUi(deps: WebUiDeps): WebUiHandle {
|
||||
? (String(req.query.kind) as "image" | "gif" | "video" | "audio")
|
||||
: undefined;
|
||||
|
||||
const authorIds = req.query.authorId
|
||||
? String(req.query.authorId)
|
||||
.split(",")
|
||||
.map(value => value.trim())
|
||||
.filter(Boolean)
|
||||
: undefined;
|
||||
const origin =
|
||||
req.query.origin === "dm" || req.query.origin === "guild"
|
||||
? (String(req.query.origin) as "dm" | "guild")
|
||||
: undefined;
|
||||
|
||||
res.json({
|
||||
ok: true,
|
||||
result: deps.media.stats({
|
||||
kind,
|
||||
source: req.query.source ? String(req.query.source) : undefined,
|
||||
channelId: req.query.channelId ? String(req.query.channelId) : undefined,
|
||||
authorId: req.query.authorId ? String(req.query.authorId) : undefined,
|
||||
authorIds,
|
||||
origin,
|
||||
cachedOnly: req.query.cachedOnly === "1" || req.query.cachedOnly === "true",
|
||||
aspect: req.query.aspect ? String(req.query.aspect) : undefined,
|
||||
resolution: req.query.resolution ? String(req.query.resolution) : undefined,
|
||||
after: req.query.after ? String(req.query.after) : undefined,
|
||||
|
||||
Reference in New Issue
Block a user