From 1b7f9047116a7f21cfee82207b302fffa66a894b Mon Sep 17 00:00:00 2001 From: smolgrrr Date: Thu, 5 Sep 2024 19:55:41 +1000 Subject: [PATCH] minor shit --- client/src/components/modals/CardModals/TextModal.tsx | 2 +- .../src/components/modals/CheckMobile/CheckMobile.tsx | 10 ++++++---- client/src/hooks/processedEvents.ts | 10 ++++++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/client/src/components/modals/CardModals/TextModal.tsx b/client/src/components/modals/CardModals/TextModal.tsx index 70ead06..3237da2 100644 --- a/client/src/components/modals/CardModals/TextModal.tsx +++ b/client/src/components/modals/CardModals/TextModal.tsx @@ -14,7 +14,7 @@ const RichText = ({ text, isExpanded, emojiMap }: { text: string; isExpanded: bo return ( <> {content.map((line, i) => ( -
+
') ? 'text-sky-300' : ''}> {line.split(' ').map((word, j) => { if (emojiMap[word]) { return {word}; diff --git a/client/src/components/modals/CheckMobile/CheckMobile.tsx b/client/src/components/modals/CheckMobile/CheckMobile.tsx index cde1aa1..02523bb 100644 --- a/client/src/components/modals/CheckMobile/CheckMobile.tsx +++ b/client/src/components/modals/CheckMobile/CheckMobile.tsx @@ -60,13 +60,15 @@ export default function CombinedIntroAndMobile() {
  • - {'>'} Here your anonymous posts are distributed among a series of independent NOSTR relay servers, + {'>'} here your anonymous posts are distributed among a series of independent NOSTR servers, which means they are highly resistant to censorship and moderation.
  • - {'>'} Each post must use Proof-of-Work to reduce spam and noise. Your note's ID is a hash of the note, - and this hashing is done repeatedly with a nonce until it starts with multiple leading zeros, - which approximates the work done to generate the note. + {'>'} each post must use Proof-of-Work which filters out most spam and noise. this is done by hashing the note repeatedly, + while incrementing a nonce, until the hash (the note's ID) starts with a certain number of leading zeros. this takes work/energy. +
  • +
  • + {'>'} the Home feed is sorted by total Proof-of-Work of notes and replies in a thread.
diff --git a/client/src/hooks/processedEvents.ts b/client/src/hooks/processedEvents.ts index 9cce245..6175678 100644 --- a/client/src/hooks/processedEvents.ts +++ b/client/src/hooks/processedEvents.ts @@ -55,14 +55,20 @@ const useProcessedEvents = (id?: string, filterDifficulty: number = 0) => { if (event.kind === 6) { const parsedEvent = JSON.parse(event.content); const replies = repliesMap.get(parsedEvent.id) || []; - const totalWork = Math.pow(2, pow) + replies.reduce((acc, reply) => acc + Math.pow(2, verifyPow(reply)), 0); + const totalWork = Math.pow(2, pow) + replies.reduce((acc, reply) => { + const replyPow = reply.id.startsWith('0') ? verifyPow(reply) : 0; + return acc + Math.pow(2, replyPow); + }, 0); const metadataEvent = metadataEvents.find(e => e.pubkey === parsedEvent.pubkey && e.kind === 0) || null; return { postEvent: event, replies, totalWork, metadataEvent }; } const replies = repliesMap.get(event.id) || []; - const totalWork = Math.pow(2, pow) + replies.reduce((acc, reply) => acc + Math.pow(2, verifyPow(reply)), 0); + const totalWork = Math.pow(2, pow) + replies.reduce((acc, reply) => { + const replyPow = reply.id.startsWith('0') ? verifyPow(reply) : 0; + return acc + Math.pow(2, replyPow); + }, 0); const metadataEvent = metadataEvents.find(e => e.pubkey === event.pubkey && e.kind === 0) || null; return { postEvent: event, replies, totalWork, metadataEvent }; })