diff --git a/src/app/views/UserContent.svelte b/src/app/views/UserContent.svelte index 9264e224..13351a3b 100644 --- a/src/app/views/UserContent.svelte +++ b/src/app/views/UserContent.svelte @@ -77,6 +77,16 @@ score. Notes from accounts with a lower score will be automatically hidden.
++ Select a minimum proof-of-work difficulty. Notes with a lower Web Of Trust and PoW difficulty will be hidden. +
+Notes from these people will be hidden by default.
diff --git a/src/engine/state.ts b/src/engine/state.ts index b87fccfa..fb0bb6a9 100644 --- a/src/engine/state.ts +++ b/src/engine/state.ts @@ -104,6 +104,7 @@ import { normalizeRelayUrl, readList, getReplyTagValues, + getTag, } from "@welshman/util" import Fuse from "fuse.js" import {batch, doPipe, seconds} from "hurdak" @@ -269,6 +270,7 @@ export const defaultSettings = { hide_sensitive: true, report_analytics: true, min_wot_score: 0, + min_pow_difficulty: 0, enable_client_tag: false, auto_authenticate: false, note_actions: ["zaps", "replies", "reactions", "recommended_apps"], @@ -356,6 +358,7 @@ export const isEventMuted = withGetter( ([$userMutes, $userFollows, $userSettings, $pubkey]) => { const words = $userSettings.muted_words const minWot = $userSettings.min_wot_score + const minPow = $userSettings.min_pow_difficulty const regex = words.length > 0 ? new RegExp(`\\b(${words.map(w => w.toLowerCase().trim()).join("|")})\\b`) @@ -376,8 +379,11 @@ export const isEventMuted = withGetter( if (strict || $userFollows.has(e.pubkey)) return false const wotScore = getUserWotScore(e.pubkey) + const powDifficulty = Number(getTag("nonce", e.tags)?.[2] || "0") - return wotScore < minWot + const isValidPow = e.id.startsWith("0".repeat(Math.ceil(powDifficulty / 4))) + + return wotScore < minWot && (powDifficulty < minPow || !isValidPow) } }, ),