fix: Fixed limit

This commit is contained in:
florian 2023-07-17 11:12:31 +02:00
parent eb4e52f3bc
commit b2ef885e0a

View File

@ -21,11 +21,6 @@ FEATURES:
- jump to previous image???? - jump to previous image????
- pause? - pause?
- Save-Mode and block NSFW content?? - Save-Mode and block NSFW content??
*/ */
type NostrImage = { type NostrImage = {
@ -40,7 +35,7 @@ const buildFilter = (
) => { ) => {
const filter: NDKFilter = { const filter: NDKFilter = {
kinds: [1], kinds: [1],
limit: 2000, limit: 1000,
}; };
if (npub) { if (npub) {
@ -68,9 +63,14 @@ const buildFilter = (
return filter; 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[] { function extractImageUrls(text: string): string[] {
const urlRegex = /(https?:\/\/[^\s]+)/g; const urlRegex = /(https?:\/\/[^\s]+)/g;
return text.match(urlRegex) || []; return (text.match(urlRegex) || []).map((u) => urlFix(u));
} }
const isReply = (event: any) => { const isReply = (event: any) => {
@ -104,6 +104,7 @@ const App = () => {
return oldPosts; return oldPosts;
}); });
}); });
}, []); }, []);
const animateImages = () => { const animateImages = () => {
@ -135,6 +136,7 @@ const App = () => {
) )
.map((url) => ({ url, author: p.author })); .map((url) => ({ url, author: p.author }));
}); });
console.log(images.current.length);
}, [posts]); }, [posts]);
useEffect(() => { useEffect(() => {
@ -185,7 +187,7 @@ const App = () => {
{activeProfile && ( {activeProfile && (
<AuthorProfile <AuthorProfile
src={activeProfile.image} src={urlFix(activeProfile.image || "")}
author={activeProfile.displayName || activeProfile.name} author={activeProfile.displayName || activeProfile.name}
npub={activeNpub} npub={activeNpub}
></AuthorProfile> ></AuthorProfile>