Fix nickname and nsfw pfp scanning
diff --git a/src/utils/database.ts b/src/utils/database.ts
index 4f94712..a107d06 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -588,7 +588,9 @@
interface ScanCacheSchema {
addedAt: Date;
hash: string;
- data: boolean;
+ nsfw?: boolean;
+ malware?: boolean;
+ bad_link?: boolean;
tags: string[];
}
@@ -600,14 +602,12 @@
}
async read(hash: string) {
- // console.log("ScanCache read");
return await this.scanCache.findOne({ hash: hash });
}
- async write(hash: string, data: boolean, tags?: string[]) {
- // console.log("ScanCache write");
+ async write(hash: string, type: "nsfw" | "malware" | "bad_link", data: boolean, tags?: string[]) {
await this.scanCache.insertOne(
- { hash: hash, data: data, tags: tags ?? [], addedAt: new Date() },
+ { hash: hash, [type]: data, tags: tags ?? [], addedAt: new Date() },
collectionOptions
);
}