diff --git a/.env.example b/.env.example index f5b40b9..0136570 100644 --- a/.env.example +++ b/.env.example @@ -12,14 +12,17 @@ REACT_APP_THEME_SELECTOR=true #'true' if you want to show the 2140meetups section or 'false' to hide it. REACT_APP_SHOW_MEETUPS=true #ID de tu comunidad, puedes encontrar la id en la pagina de tu comunidad de 2140meetups.com, por ejemplo https://2140meetups.com/comunidad/5605/ donde la id seria '5605' -REACT_APP_COMUNITY_ID=5573 +REACT_APP_COMUNITY_ID=5983 #Nostr settings #Show nostr section 'true' or 'false' REACT_APP_NOSTR_SHOW=true +#Show banner like background of the site 'true' or 'false' +REACT_APP_NOSTR_SHOW_BANNER=true +#Your nostr pubkey in npub/hex REACT_APP_NOSTR_PUBKEY=npub1gzuushllat7pet0ccv9yuhygvc8ldeyhrgxuwg744dn5khnpk3gs3ea5ds #Choose how many messages from your feed you want to display (recommended from 1 to 25) -REACT_APP_NOSTR_NOTES_TO_SHOW=10 +REACT_APP_NOSTR_NOTES_TO_SHOW=1 #Choose witch client you want to use for see notes out linktr ["https://nostr.com/", "https://snort.social/e/", "https://nostr.band/", "https://iris.to/", "https://primal.net/thread/", "https://www.nostr.guru/e/"] REACT_APP_NOSTR_OUTER_NOTES=https://nostr.com/ #Choose witch client you want to use for see profiles out linktr ["https://snort.social/p/", "https://nostr.band/", "https://iris.to/", "https://primal.net/profile/"] @@ -29,4 +32,8 @@ REACT_APP_NOSTR_OUTER_HASHTAGS=https://snort.social/t/ #Choose witch client you want to use for see long content out linktr ["https://habla.news/a/", "https://nostr.com/"] REACT_APP_NOSTR_OUTER_LONG=https://habla.news/a/ #Choose witch client you want to use for others to chat with you ["https://chat.punkhub.me/?dm=", "https://www.nostrchat.io/dm/"] -REACT_APP_NOSTR_OUTER_CHAT=https://chat.punkhub.me/?dm= \ No newline at end of file +REACT_APP_NOSTR_OUTER_CHAT=https://chat.punkhub.me/?dm= + +#Extra settings +#Show footer 'true' or 'false' +REACT_APP_NOSTR_SHOW_FOOTER=true \ No newline at end of file diff --git a/LICENSE b/LICENSE index bd92b61..72b00f1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Linktr +Copyright (c) 2023 Gzuuus Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/public/.well-know/nostr.json b/public/.well-know/nostr.json deleted file mode 100644 index 6a691dd..0000000 --- a/public/.well-know/nostr.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "names": { - "gzuuus": "40b9c85fffeafc1cadf8c30a4e5c88660ff6e4971a0dc723d5ab674b5e61b451" - } -} \ No newline at end of file diff --git a/src/App.js b/src/App.js index 5a16343..3224c3a 100644 --- a/src/App.js +++ b/src/App.js @@ -41,9 +41,6 @@ function App() { {themeButtons} )} -
- Made with love by gzuuus 💜 -
pfp @@ -62,6 +59,11 @@ function App() {
)} + {process.env.REACT_APP_NOSTR_SHOW_FOOTER === 'true' && ( +
+ With 💜 by gzuuus +
+ )} ); } diff --git a/src/components/EventListComponent.js b/src/components/EventListComponent.js index 0ce5f80..99946cd 100644 --- a/src/components/EventListComponent.js +++ b/src/components/EventListComponent.js @@ -4,8 +4,9 @@ import NoteParserKind0 from "./NoteParserKind0.js"; function EventListComponent({ events }) { const uniqueEvents = {}; + const NOTES_TO_SHOW = parseInt(process.env.REACT_APP_NOSTR_NOTES_TO_SHOW); + let noteParserCount = 0; // Variable de conteo adicional - // Filtramos los eventos duplicados events.forEach((event) => { if (event.kind === 0) { if (uniqueEvents[event.kind] === undefined) { @@ -14,27 +15,30 @@ function EventListComponent({ events }) { uniqueEvents[event.kind] = event; } } else { - uniqueEvents[event.id] = event; + if (noteParserCount < NOTES_TO_SHOW) { // Verificar si se ha alcanzado el límite de NOTES_TO_SHOW + uniqueEvents[event.id] = event; + noteParserCount++; // Incrementar el conteo + } } }); const uniqueEventsList = Object.values(uniqueEvents); - const eventList = uniqueEventsList.map((event, index) => { - return ( -
- {event.kind === 0 ? ( - <> - - - ) : ( - <> - - - )} -
- ); - }); - + const eventList = uniqueEventsList.map((event, index) => { + return ( +
+ {event.kind === 0 ? ( + <> + + + ) : ( + <> + + + )} +
+ ); + }); + return (
{eventList} diff --git a/src/components/Nostr.js b/src/components/Nostr.js index eeba33c..9899771 100644 --- a/src/components/Nostr.js +++ b/src/components/Nostr.js @@ -6,7 +6,7 @@ import { NostrLogo } from "../graphics/index.js"; const Nostr = () => { const [events, setEvents] = useState([]); - const [uniqueEvents, setUniqueEvents] = useState(new Set()); + //const [uniqueEvents, setUniqueEvents] = useState(new Set()); const relayList = useMemo(() => [ "wss://nos.lol", @@ -26,8 +26,6 @@ const Nostr = () => { return process.env.REACT_APP_NOSTR_PUBKEY; } }; - - useEffect(() => { const NOTES_TO_SHOW = parseInt(process.env.REACT_APP_NOSTR_NOTES_TO_SHOW); const onLoad = () => { @@ -61,7 +59,6 @@ const Nostr = () => { { kinds: [0], authors: [getHexPubKey()], - limit:1, }, { kinds: [1], @@ -71,11 +68,8 @@ const Nostr = () => { ], userRelayList, (event, isAfterEose, relayURL) => { - if (!uniqueEvents.has(event.id)) { - setUniqueEvents(new Set(uniqueEvents.add(event.id))); - setEvents(events => - utils.insertEventIntoDescendingList(events, event)) - } + setEvents(events => + utils.insertEventIntoDescendingList(events, event)) //console.log(event, isAfterEose, relayURL); }, undefined, @@ -102,13 +96,12 @@ const Nostr = () => { }; window.onload = onLoad; - + return () => { window.onload = null; }; - }, []); + }, [relayList]); return ( -
@@ -116,7 +109,9 @@ const Nostr = () => {

Nostr

- + {parseInt(process.env.REACT_APP_NOSTR_NOTES_TO_SHOW) > 0 && ( + + )}
); diff --git a/src/components/NoteParserKind0.js b/src/components/NoteParserKind0.js index 8af94fa..47e4f58 100644 --- a/src/components/NoteParserKind0.js +++ b/src/components/NoteParserKind0.js @@ -1,27 +1,43 @@ -import React from 'react' -import { nip19 } from "nostr-tools"; -import { GoOut, LnIcon, GoChat} from "../graphics/index.js"; -const NoteParserKind0 = ({note}) => { - const nPub=nip19.npubEncode(note.pubkey) +import React from 'react'; +import { nip19 } from 'nostr-tools'; +import { GoOut, LnIcon, GoChat } from '../graphics/index.js'; + +const NoteParserKind0 = ({ note }) => { + const SHOW_BANNER = process.env.REACT_APP_NOSTR_SHOW_BANNER; + const nPub = nip19.npubEncode(note.pubkey); const contentObj = JSON.parse(note.content); const { lud16, display_name, name, about, picture, banner } = contentObj; - + return (
+ {SHOW_BANNER !== 'true' ? ( +
+ ) : ( +
+ )} {display_name}

{name}

- - {nPub.slice(0, 16)}... + + {nPub.slice(0, 16)}...

{about}


- - - + + + + + + + + +
- ) -} + ); +}; -export default NoteParserKind0 +export default NoteParserKind0; diff --git a/src/index.css b/src/index.css index bb4a300..48170c5 100644 --- a/src/index.css +++ b/src/index.css @@ -261,10 +261,14 @@ div.message-kind0, div.message-kind1{ } .creditsContainer { position: fixed; - bottom: 10px; - right: 10px; - color: var(--accent-color) ; - opacity: 0.3; + color: var(--accent-color); + text-align: center; + background: var(--container-b-color); + padding: 15px; + border-radius: 0 var(--default-border-radius) 0 0; + bottom: 0; + left: 0; + opacity: 0.5; } .creditsContainer:hover { opacity: 1; @@ -273,6 +277,18 @@ div.message-kind0, div.message-kind1{ display: flex; align-items: center; justify-content: center; + margin-top: 15px; +} +.bannerBackground { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 50%; + background-size: cover; + background-position: center; + background-repeat: no-repeat; + z-index: -1; } @@ -283,7 +299,7 @@ div.message-kind0, div.message-kind1{ } .mainDiv { width: auto; - margin: 10px; + margin: 10px 10px 0px 10px; } .mainContainer { background: var(--container-b-color);