Add source filters and a full-window media view

This commit is contained in:
Fisto
2026-09-16 11:11:50 +02:00
parent 2573dd4d63
commit 902646224f
12 changed files with 179 additions and 32 deletions
+30
View File
@@ -396,6 +396,36 @@ void (async () => {
assert.equal(existsSync(join(root, started.id, row.file_path)), true);
});
await test("store filters by source and kind", () => {
const dir = join(root, "store-source");
mkdirSync(dir, { recursive: true });
const store = new ScrapeStore(dir);
store.insertPage([
message("700", {
attachments: [attachment({ filename: "pic.png", contentType: "image/png" })],
embeds: [
{
type: "video",
url: "https://www.youtube.com/watch?v=x",
title: null,
provider: "YouTube",
videoUrl: "https://www.youtube.com/embed/x",
imageUrl: null,
thumbnailUrl: null
}
]
})
]);
assert.equal(store.queryMedia({ source: "attachment" }).length, 1);
assert.equal(store.queryMedia({ source: "embed" }).length, 1);
assert.equal(store.queryMedia({ source: "sticker" }).length, 0);
assert.equal(store.queryMedia({ kind: "image", source: "attachment" }).length, 1);
assert.equal(store.queryMedia({ kind: "video", source: "attachment" }).length, 0);
store.close();
});
await test("preview urls are Discord-only resizes", () => {
assert.equal(
previewUrlFor({ url: "https://cdn.discordapp.com/attachments/1/2/pic.png", kind: "image" }),