trending posts into system, check sigs
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Martti Malmi 2024-01-03 20:21:35 +02:00
parent e700c97c71
commit 98e1be883b
3 changed files with 34 additions and 2 deletions

View File

@ -1,5 +1,5 @@
import { useState } from "react"; import { useState } from "react";
import { NostrLink, TaggedNostrEvent } from "@snort/system"; import { EventExt, NostrLink, TaggedNostrEvent } from "@snort/system";
import { useReactions } from "@snort/system-react"; import { useReactions } from "@snort/system-react";
import PageSpinner from "@/Element/PageSpinner"; import PageSpinner from "@/Element/PageSpinner";
@ -15,6 +15,7 @@ import ImageGridItem from "@/Element/Feed/ImageGridItem";
import { SpotlightThreadModal } from "@/Element/Spotlight/SpotlightThreadModal"; import { SpotlightThreadModal } from "@/Element/Spotlight/SpotlightThreadModal";
import useLogin from "@/Hooks/useLogin"; import useLogin from "@/Hooks/useLogin";
import useCachedFetch from "@/Hooks/useCachedFetch"; import useCachedFetch from "@/Hooks/useCachedFetch";
import { System } from "@/index";
export default function TrendingNotes({ count = Infinity, small = false }) { export default function TrendingNotes({ count = Infinity, small = false }) {
const api = new NostrBandApi(); const api = new NostrBandApi();
@ -26,7 +27,18 @@ export default function TrendingNotes({ count = Infinity, small = false }) {
data: trendingNotesData, data: trendingNotesData,
isLoading, isLoading,
error, error,
} = useCachedFetch(trendingNotesUrl, storageKey, data => data.notes.map(a => a.event)); } = useCachedFetch(trendingNotesUrl, storageKey, data => {
return data.notes.map(a => {
const ev = a.event;
const id = EventExt.createId(ev);
if (!System.QueryOptimizer.schnorrVerify(id, ev.sig, ev.pubkey)) {
console.error(`Event with invalid sig\n\n${ev}\n\nfrom ${trendingNotesUrl}`);
return;
}
System.HandleEvent(ev);
return ev;
});
});
const login = useLogin(); const login = useLogin();
const displayAsInitial = small ? "list" : login.feedDisplayAs ?? "list"; const displayAsInitial = small ? "list" : login.feedDisplayAs ?? "list";

View File

@ -75,6 +75,9 @@
"0HFX0T": { "0HFX0T": {
"defaultMessage": "Use Exact Location" "defaultMessage": "Use Exact Location"
}, },
"0MndVW": {
"defaultMessage": "Generic LNDHub wallet (BTCPayServer / Alby / LNBits)"
},
"0jOEtS": { "0jOEtS": {
"defaultMessage": "Invalid LNURL" "defaultMessage": "Invalid LNURL"
}, },
@ -165,6 +168,9 @@
"3gOsZq": { "3gOsZq": {
"defaultMessage": "Translators" "defaultMessage": "Translators"
}, },
"3natuV": {
"defaultMessage": "Cashu mint wallet"
},
"3qnJlS": { "3qnJlS": {
"defaultMessage": "You are voting with {amount} sats" "defaultMessage": "You are voting with {amount} sats"
}, },
@ -996,6 +1002,9 @@
"XICsE8": { "XICsE8": {
"defaultMessage": "File hosts" "defaultMessage": "File hosts"
}, },
"XPB8VV": {
"defaultMessage": "Alby wallet connection"
},
"XQiFEl": { "XQiFEl": {
"defaultMessage": "Follows Relay Health" "defaultMessage": "Follows Relay Health"
}, },
@ -1054,6 +1063,9 @@
"aMaLBK": { "aMaLBK": {
"defaultMessage": "Supported Extensions" "defaultMessage": "Supported Extensions"
}, },
"aSGz4J": {
"defaultMessage": "Connect to your own LND node with Lightning Node Connect"
},
"aWpBzj": { "aWpBzj": {
"defaultMessage": "Show more" "defaultMessage": "Show more"
}, },
@ -1102,6 +1114,9 @@
"cFbU1B": { "cFbU1B": {
"defaultMessage": "Using Alby? Go to {link} to get your NWC config!" "defaultMessage": "Using Alby? Go to {link} to get your NWC config!"
}, },
"cG/bKQ": {
"defaultMessage": "Native nostr wallet connection"
},
"cHCwbF": { "cHCwbF": {
"defaultMessage": "Photography" "defaultMessage": "Photography"
}, },

View File

@ -24,6 +24,7 @@
"0Azlrb": "Manage", "0Azlrb": "Manage",
"0BUTMv": "Search...", "0BUTMv": "Search...",
"0HFX0T": "Use Exact Location", "0HFX0T": "Use Exact Location",
"0MndVW": "Generic LNDHub wallet (BTCPayServer / Alby / LNBits)",
"0jOEtS": "Invalid LNURL", "0jOEtS": "Invalid LNURL",
"0mch2Y": "name has disallowed characters", "0mch2Y": "name has disallowed characters",
"0siT4z": "Politics", "0siT4z": "Politics",
@ -54,6 +55,7 @@
"3QwfJR": "~{amount}", "3QwfJR": "~{amount}",
"3cc4Ct": "Light", "3cc4Ct": "Light",
"3gOsZq": "Translators", "3gOsZq": "Translators",
"3natuV": "Cashu mint wallet",
"3qnJlS": "You are voting with {amount} sats", "3qnJlS": "You are voting with {amount} sats",
"3t3kok": "{n,plural,=1{{n} new note} other{{n} new notes}}", "3t3kok": "{n,plural,=1{{n} new note} other{{n} new notes}}",
"3tVy+Z": "{n} Followers", "3tVy+Z": "{n} Followers",
@ -328,6 +330,7 @@
"X7xU8J": "nsec, npub, nip-05, hex, mnemonic", "X7xU8J": "nsec, npub, nip-05, hex, mnemonic",
"XECMfW": "Send usage metrics", "XECMfW": "Send usage metrics",
"XICsE8": "File hosts", "XICsE8": "File hosts",
"XPB8VV": "Alby wallet connection",
"XQiFEl": "Follows Relay Health", "XQiFEl": "Follows Relay Health",
"XXm7jJ": "Trending Hashtags", "XXm7jJ": "Trending Hashtags",
"XgWvGA": "Reactions", "XgWvGA": "Reactions",
@ -347,6 +350,7 @@
"a7TDNm": "Notes will stream in real time into global and notes tab", "a7TDNm": "Notes will stream in real time into global and notes tab",
"aHje0o": "Name or nym", "aHje0o": "Name or nym",
"aMaLBK": "Supported Extensions", "aMaLBK": "Supported Extensions",
"aSGz4J": "Connect to your own LND node with Lightning Node Connect",
"aWpBzj": "Show more", "aWpBzj": "Show more",
"b12Goz": "Mnemonic", "b12Goz": "Mnemonic",
"b5vAk0": "Your handle will act like a lightning address and will redirect to your chosen LNURL or Lightning address", "b5vAk0": "Your handle will act like a lightning address and will redirect to your chosen LNURL or Lightning address",
@ -363,6 +367,7 @@
"c35bj2": "If you have an enquiry about your NIP-05 order please DM {link}", "c35bj2": "If you have an enquiry about your NIP-05 order please DM {link}",
"c3g2hL": "Broadcast Again", "c3g2hL": "Broadcast Again",
"cFbU1B": "Using Alby? Go to {link} to get your NWC config!", "cFbU1B": "Using Alby? Go to {link} to get your NWC config!",
"cG/bKQ": "Native nostr wallet connection",
"cHCwbF": "Photography", "cHCwbF": "Photography",
"cPIKU2": "Following", "cPIKU2": "Following",
"cQfLWb": "URL..", "cQfLWb": "URL..",