Add file-type and host filters with a 4chan default
This commit is contained in:
@@ -883,6 +883,8 @@ function buildServer(): McpServer {
|
||||
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"),
|
||||
exts: z.array(z.string()).optional().describe("Only these file extensions (mp4, webm, png, ...)"),
|
||||
excludeHosts: z.array(z.string()).optional().describe("Hide URLs from these hosts"),
|
||||
aspect: z
|
||||
.enum(["vertical", "square", "wide43", "wide169", "ultrawide", "other"])
|
||||
.optional()
|
||||
@@ -905,6 +907,8 @@ function buildServer(): McpServer {
|
||||
authorIds,
|
||||
origin,
|
||||
cachedOnly,
|
||||
exts,
|
||||
excludeHosts,
|
||||
aspect,
|
||||
resolution,
|
||||
after,
|
||||
@@ -921,6 +925,8 @@ function buildServer(): McpServer {
|
||||
authorIds,
|
||||
origin,
|
||||
cachedOnly,
|
||||
exts,
|
||||
excludeHosts,
|
||||
aspect,
|
||||
resolution,
|
||||
after,
|
||||
|
||||
@@ -638,6 +638,8 @@ export class MediaService {
|
||||
authorIds?: string[];
|
||||
origin?: "dm" | "guild";
|
||||
cachedOnly?: boolean;
|
||||
exts?: string[];
|
||||
excludeHosts?: string[];
|
||||
aspect?: string;
|
||||
resolution?: string;
|
||||
after?: string;
|
||||
@@ -757,6 +759,8 @@ export class MediaService {
|
||||
authorIds?: string[];
|
||||
origin?: "dm" | "guild";
|
||||
cachedOnly?: boolean;
|
||||
exts?: string[];
|
||||
excludeHosts?: string[];
|
||||
aspect?: string;
|
||||
resolution?: string;
|
||||
after?: string;
|
||||
@@ -782,6 +786,8 @@ export class MediaService {
|
||||
authorId: options.authorId,
|
||||
authorIds: options.authorIds,
|
||||
cachedOnly: options.cachedOnly,
|
||||
exts: options.exts,
|
||||
excludeHosts: options.excludeHosts,
|
||||
aspect: options.aspect,
|
||||
resolution: options.resolution,
|
||||
after: options.after,
|
||||
@@ -833,6 +839,8 @@ export class MediaService {
|
||||
authorIds?: string[];
|
||||
origin?: "dm" | "guild";
|
||||
cachedOnly?: boolean;
|
||||
exts?: string[];
|
||||
excludeHosts?: string[];
|
||||
aspect?: string;
|
||||
resolution?: string;
|
||||
after?: string;
|
||||
|
||||
@@ -893,6 +893,18 @@ export function startWebUi(deps: WebUiDeps): WebUiHandle {
|
||||
? (String(req.query.origin) as "dm" | "guild")
|
||||
: undefined;
|
||||
const cachedOnly = req.query.cachedOnly === "1" || req.query.cachedOnly === "true";
|
||||
const exts = req.query.ext
|
||||
? String(req.query.ext)
|
||||
.split(",")
|
||||
.map(value => value.trim().toLowerCase())
|
||||
.filter(Boolean)
|
||||
: undefined;
|
||||
const excludeHosts = req.query.excludeHosts
|
||||
? String(req.query.excludeHosts)
|
||||
.split(",")
|
||||
.map(value => value.trim().toLowerCase())
|
||||
.filter(Boolean)
|
||||
: undefined;
|
||||
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;
|
||||
@@ -909,6 +921,8 @@ export function startWebUi(deps: WebUiDeps): WebUiHandle {
|
||||
authorIds,
|
||||
origin,
|
||||
cachedOnly,
|
||||
exts,
|
||||
excludeHosts,
|
||||
aspect,
|
||||
resolution,
|
||||
after,
|
||||
@@ -944,6 +958,18 @@ export function startWebUi(deps: WebUiDeps): WebUiHandle {
|
||||
req.query.origin === "dm" || req.query.origin === "guild"
|
||||
? (String(req.query.origin) as "dm" | "guild")
|
||||
: undefined;
|
||||
const exts = req.query.ext
|
||||
? String(req.query.ext)
|
||||
.split(",")
|
||||
.map(value => value.trim().toLowerCase())
|
||||
.filter(Boolean)
|
||||
: undefined;
|
||||
const excludeHosts = req.query.excludeHosts
|
||||
? String(req.query.excludeHosts)
|
||||
.split(",")
|
||||
.map(value => value.trim().toLowerCase())
|
||||
.filter(Boolean)
|
||||
: undefined;
|
||||
|
||||
res.json({
|
||||
ok: true,
|
||||
@@ -954,6 +980,8 @@ export function startWebUi(deps: WebUiDeps): WebUiHandle {
|
||||
authorIds,
|
||||
origin,
|
||||
cachedOnly: req.query.cachedOnly === "1" || req.query.cachedOnly === "true",
|
||||
exts,
|
||||
excludeHosts,
|
||||
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