From 255f664021fdc719e929713363363a602b0d51d1 Mon Sep 17 00:00:00 2001 From: Vishal <64505169+vishalxl@users.noreply.github.com> Date: Thu, 29 Dec 2022 16:26:43 +0530 Subject: [PATCH] specific spam prevention --- lib/tree_ds.dart | 5 +++++ scripts/send_request.sh | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lib/tree_ds.dart b/lib/tree_ds.dart index 6a5dc97..dc639e6 100644 --- a/lib/tree_ds.dart +++ b/lib/tree_ds.dart @@ -1399,6 +1399,11 @@ class Store { // add the event to the main event store thats allChildEventsMap newEventsToProcess.forEach((newEvent) { + + if( newEvent.eventData.kind == 1 && newEvent.eventData.content.compareTo("Hello Nostr! :)") == 0 && newEvent.eventData.id.substring(0,2).compareTo("00") == 0) { + return; // spam prevention + } + if( allChildEventsMap.containsKey(newEvent.eventData.id)) {// don't process if the event is already present in the map return; } diff --git a/scripts/send_request.sh b/scripts/send_request.sh index 71c9ea9..1f11042 100644 --- a/scripts/send_request.sh +++ b/scripts/send_request.sh @@ -2,6 +2,8 @@ source ./configfile.cfg +# ./send_request.sh '["REQ","name",{"ids":["b10180"]}]' + for server in ${nostr_servers[@]}; do >&2 echo -e "\n\n------------Sending $1 to $server---------------------------\n"