From b2ef885e0a7d262cecdf3880dac44a14f5f26555 Mon Sep 17 00:00:00 2001 From: Florian Maul Date: Mon, 17 Jul 2023 11:12:31 +0200 Subject: [PATCH] fix: Fixed limit --- src/App.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 2027a6d..3644db4 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -21,11 +21,6 @@ FEATURES: - jump to previous image???? - pause? - Save-Mode and block NSFW content?? - - - - - */ type NostrImage = { @@ -40,7 +35,7 @@ const buildFilter = ( ) => { const filter: NDKFilter = { kinds: [1], - limit: 2000, + limit: 1000, }; if (npub) { @@ -68,9 +63,14 @@ const buildFilter = ( return filter; }; +const urlFix = (url: string) => { + // use cdn for nostr.build + return url.replace(/https?:\/\/nostr.build/, "https://cdn.nostr.build"); +}; + function extractImageUrls(text: string): string[] { const urlRegex = /(https?:\/\/[^\s]+)/g; - return text.match(urlRegex) || []; + return (text.match(urlRegex) || []).map((u) => urlFix(u)); } const isReply = (event: any) => { @@ -104,6 +104,7 @@ const App = () => { return oldPosts; }); }); + }, []); const animateImages = () => { @@ -135,6 +136,7 @@ const App = () => { ) .map((url) => ({ url, author: p.author })); }); + console.log(images.current.length); }, [posts]); useEffect(() => { @@ -185,7 +187,7 @@ const App = () => { {activeProfile && (