chore: invalid zappers

This commit is contained in:
Kieran 2023-03-05 15:36:12 +00:00
parent 0a5491eede
commit d959a492b1
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
2 changed files with 15 additions and 1 deletions

View File

@ -78,6 +78,13 @@ export const RecommendedFollows = [
"52b4a076bcbbbdc3a1aefa3735816cf74993b1b8db202b01c883c58be7fad8bd", // semisol "52b4a076bcbbbdc3a1aefa3735816cf74993b1b8db202b01c883c58be7fad8bd", // semisol
]; ];
/**
* Mark zaps invalid for the following pubkeys
*/
export const ZapperSpam = [
"e1ff3bfdd4e40315959b08b4fcc8245eaa514637e1d4ec2ae166b743341be1af", // benthecarman
];
/** /**
* Regex to match email address * Regex to match email address
*/ */

View File

@ -9,6 +9,7 @@ import { formatShort } from "Number";
import Text from "Element/Text"; import Text from "Element/Text";
import ProfileImage from "Element/ProfileImage"; import ProfileImage from "Element/ProfileImage";
import { RootState } from "State/Store"; import { RootState } from "State/Store";
import { ZapperSpam } from "Const";
import messages from "./messages"; 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 anonZap = rawEvent.tags.some(a => a[0] === "anon");
const metaHash = sha256(zapRequest); const metaHash = sha256(zapRequest);
const ev = new Event(rawEvent); 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) { } catch (e) {
console.warn("Invalid zap", zapRequest); console.warn("Invalid zap", zapRequest);
} }