chore: invalid zappers

This commit is contained in:
2023-03-05 15:36:12 +00:00
parent 0a5491eede
commit d959a492b1
2 changed files with 15 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import { formatShort } from "Number";
import Text from "Element/Text";
import ProfileImage from "Element/ProfileImage";
import { RootState } from "State/Store";
import { ZapperSpam } from "Const";
import messages from "./messages";
@ -54,7 +55,13 @@ function getZapper(zap: TaggedRawEvent, dhash: string): Zapper {
const anonZap = rawEvent.tags.some(a => a[0] === "anon");
const metaHash = sha256(zapRequest);
const ev = new Event(rawEvent);
return { pubkey: ev.PubKey, isValid: dhash === metaHash, isAnon: anonZap, content: rawEvent.content };
const zapperIgnored = ZapperSpam.includes(zap.pubkey);
return {
pubkey: ev.PubKey,
isValid: dhash === metaHash && !zapperIgnored,
isAnon: anonZap,
content: rawEvent.content,
};
} catch (e) {
console.warn("Invalid zap", zapRequest);
}