minor shit

This commit is contained in:
smolgrrr 2024-09-05 19:55:41 +10:00
parent 311ca3dbda
commit 1b7f904711
3 changed files with 15 additions and 7 deletions

View File

@ -14,7 +14,7 @@ const RichText = ({ text, isExpanded, emojiMap }: { text: string; isExpanded: bo
return (
<>
{content.map((line, i) => (
<div key={i}>
<div key={i} className={line.startsWith('>') ? 'text-sky-300' : ''}>
{line.split(' ').map((word, j) => {
if (emojiMap[word]) {
return <img className="w-9 h-9 mx-0.5 inline" src={emojiMap[word]} alt={word} key={j} />;

View File

@ -60,13 +60,15 @@ export default function CombinedIntroAndMobile() {
</h2>
<ul className="list-none space-y-2 text-xs">
<li>
{'>'} Here your anonymous posts are distributed among a series of independent <a className="underline" href="https://github.com/nostr-protocol/nostr" target="_blank" rel="noopener noreferrer">NOSTR</a> relay servers,
{'>'} here your anonymous posts are distributed among a series of independent <a className="underline" href="https://github.com/nostr-protocol/nostr" target="_blank" rel="noopener noreferrer">NOSTR</a> servers,
which means they are highly resistant to censorship and moderation.
</li>
<li>
{'>'} 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.
</li>
<li>
{'>'} the Home feed is sorted by total Proof-of-Work of notes and replies in a thread.
</li>
</ul>
</div>

View File

@ -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 };
})