Gossip + Spam filter by rhai script = Relief & Zen mode
Terrific feature nostr:npub1acg6thl5psv62405rljzkj8spesceyfz2c32udakc2ak0dmvfeyse9p35c
Gossip + Spam filter by rhai script = Relief & Zen mode
Terrific feature nostr:npub1acg6thl5psv62405rljzkj8spesceyfz2c32udakc2ak0dmvfeyse9p35c
"Spam filter by rhai script", what is that?
https://github.com/mikedilger/gossip/blob/master/filter.example.rhai
- - - - - -
This is a sample spam filtering script for the gossip nostr
client. The language is called Rhai, details are at:
https:rhai.rs/book/
For gossip to find your spam filtering script, put it in your
gossip profile directory. See
https:docs.rs/dirs/latest/dirs/fn.data_dir.html
to find the base directory. A subdirectory "gossip" is your
gossip data directory which for most people is their profile
directory too. (Note: if you use a GOSSIP_PROFILE, you'll need
to put it one directory deeper into that profile directory).
This filter is used to filter out and refuse to process incoming
events as they flow in from relays, and also to filter which
events get displayed in certain circumstances. It is only run on
feed-displayable event kinds, and only events by authors you are
not following. In case of error, nothing is filtered.
You must define a function called 'filter' which returns one of
these constant values:
DENY (the event is filtered out)
ALLOW (the event is allowed through)
MUTE (the event is filtered out, and the author is
automatically muted)
Your script will be provided the following:
caller - a string that is one of "Process", "Thread",
"Inbox" or "Global" indicating which part of
the code is running your script
content - the event content as a string
id - the event ID, as a hex string
kind - the event kind as an integer
muted - if the author is in your mute list
name - if we have it, the name of the author (or your
petname), else an empty string
nip05valid - whether nip05 is valid for the author, as a
boolean
pow - the Proof of Work on the event
pubkey - the event author public key, as a hex string
seconds_known - the number of seconds that the author of the
event has been known to gossip
spamsafe - true only if the event came in from a relay
marked as SpamSafe during Process (even if the
global setting for SpamSafe is off)
Web of trust is coming soon (a simple count of how many people (that you follow) follow this person). Then you can act on that as well, e.g.: `if wot > 2 { ALLOW }`
For example, for me @dtonon has a WoT score of 84 and I have a WoT score of 122 (122 people that I follow follow me back).
The nice thing about the script is that users are empowered to control what they want to see, they don't have to rely on hard-coded rules.
Does it makes sense for 'reports' (kind 1984) from your follows affecting also the WoT score?
Thinking out loud... 🤔
I'd like to keep a pure and well understood 2-degrees-of-separation path count. If in the future people want to adjust that with 1984 reports data, they can do so in filter.rhai. It's a scripting language, it has math operations.
But presently we don't collect or provide 1984 data to the spam script.
Personally as I think about 1984 data I'm rather overwhelmed at how complex it will have to be before it is useful. For example, I follow nostr:npub1wmr34t36fy03m8hvgl96zl3znndyzyaqhwmwdtshwmtkg03fetaqhjg240 and he has a WoT score > 100 for me. Lots of people I follow also follow him. But I know that his opinions on moderation differ from mine. So I can't just trust a 1984 report from anybody that I follow. What is going to happen is I'm going to have to make it so you can say things like "Trust Rabble to identify spam, but not for offensive content" or something like that. The data tables and UI/UX management of that data is kind of hairy. Which is why I haven't started into that work.
I'm hoping somebody implements an elegant and more simple system that deals with my concern somehow and then I can copy their idea.