Store embed titles and search them
This commit is contained in:
@@ -904,6 +904,11 @@ function buildServer(): McpServer {
|
||||
.array(z.string())
|
||||
.optional()
|
||||
.describe("Keep only these row sources (attachment, sticker, embed)"),
|
||||
titleQuery: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Search embed titles (YouTube). Multi-word prefix match by default"),
|
||||
titleExact: z.boolean().optional().describe("Treat titleQuery as one exact phrase"),
|
||||
sizeLessThan: z.number().optional().describe("Only items smaller than this many bytes"),
|
||||
sizeGreaterThan: z.number().optional().describe("Only items larger than this many bytes"),
|
||||
lengthLessThan: z.number().optional().describe("Only items shorter than this many seconds"),
|
||||
@@ -941,6 +946,8 @@ function buildServer(): McpServer {
|
||||
excludeSources,
|
||||
includeProviders,
|
||||
includeSources,
|
||||
titleQuery,
|
||||
titleExact,
|
||||
sizeLessThan,
|
||||
sizeGreaterThan,
|
||||
lengthLessThan,
|
||||
@@ -969,6 +976,8 @@ function buildServer(): McpServer {
|
||||
excludeSources,
|
||||
includeProviders,
|
||||
includeSources,
|
||||
titleQuery,
|
||||
titleExact,
|
||||
sizeLessThan,
|
||||
sizeGreaterThan,
|
||||
lengthLessThan,
|
||||
|
||||
@@ -135,6 +135,8 @@ export interface MediaItemResult {
|
||||
thumbUrl: string | null;
|
||||
provider: string | null;
|
||||
downloaded: boolean;
|
||||
/** Embed title (YouTube and friends), when Discord provided one. */
|
||||
title: string | null;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
@@ -719,6 +721,8 @@ export class MediaService {
|
||||
excludeSources?: string[];
|
||||
includeProviders?: string[];
|
||||
includeSources?: string[];
|
||||
titleQuery?: string;
|
||||
titleExact?: boolean;
|
||||
sizeLessThan?: number;
|
||||
sizeGreaterThan?: number;
|
||||
lengthLessThan?: number;
|
||||
@@ -850,6 +854,8 @@ export class MediaService {
|
||||
excludeSources?: string[];
|
||||
includeProviders?: string[];
|
||||
includeSources?: string[];
|
||||
titleQuery?: string;
|
||||
titleExact?: boolean;
|
||||
sizeLessThan?: number;
|
||||
sizeGreaterThan?: number;
|
||||
lengthLessThan?: number;
|
||||
@@ -887,6 +893,8 @@ export class MediaService {
|
||||
excludeSources: options.excludeSources,
|
||||
includeProviders: options.includeProviders,
|
||||
includeSources: options.includeSources,
|
||||
titleQuery: options.titleQuery,
|
||||
titleExact: options.titleExact,
|
||||
sizeLessThan: options.sizeLessThan,
|
||||
sizeGreaterThan: options.sizeGreaterThan,
|
||||
lengthLessThan: options.lengthLessThan,
|
||||
@@ -949,6 +957,8 @@ export class MediaService {
|
||||
excludeSources?: string[];
|
||||
includeProviders?: string[];
|
||||
includeSources?: string[];
|
||||
titleQuery?: string;
|
||||
titleExact?: boolean;
|
||||
sizeLessThan?: number;
|
||||
sizeGreaterThan?: number;
|
||||
lengthLessThan?: number;
|
||||
@@ -993,6 +1003,7 @@ export class MediaService {
|
||||
thumbUrl: row.preview_hash ? `/api/media/${meta.id}/${row.id}/thumb` : null,
|
||||
provider: row.provider,
|
||||
downloaded: row.downloaded === 1,
|
||||
title: row.title,
|
||||
createdAt: row.created_at
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -213,6 +213,8 @@ function parseMediaFilters(query: Record<string, unknown>) {
|
||||
excludeSources: list(query.excludeSources),
|
||||
includeProviders: list(query.includeProviders),
|
||||
includeSources: list(query.includeSources),
|
||||
titleQuery: query.title ? String(query.title).slice(0, 200) : undefined,
|
||||
titleExact: query.titleExact === "1" || query.titleExact === "true",
|
||||
sizeLessThan: amount(query.sizeLt),
|
||||
sizeGreaterThan: amount(query.sizeGt),
|
||||
lengthLessThan: amount(query.lenLt),
|
||||
|
||||
Reference in New Issue
Block a user