diff --git a/index.html b/index.html index 8958cb4..72b7a82 100644 --- a/index.html +++ b/index.html @@ -3,12 +3,12 @@ - Comunitator - Nostr + Communitator - Nostr Relay Templates - +
- + \ No newline at end of file diff --git a/package.json b/package.json index 321d02a..59f6be1 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "relay-template-app", + "name": "communitator", "version": "1.0.0", "type": "module", "scripts": { @@ -19,4 +19,4 @@ "@vitejs/plugin-react": "^4.2.1", "vite": "^5.0.8" } -} +} \ No newline at end of file diff --git a/src/App.jsx b/src/App.jsx index fc2dc32..1bf3a42 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -14,7 +14,6 @@ function App() {

⚡ Communitator

{connectedPubkey && (
@@ -24,20 +23,26 @@ function App() {
- - } /> - - } /> + } /> + } />
); } -export default App; +export default App; \ No newline at end of file diff --git a/src/components/NostrConnect.jsx b/src/components/NostrConnect.jsx index 3fc1a76..fa88286 100644 --- a/src/components/NostrConnect.jsx +++ b/src/components/NostrConnect.jsx @@ -4,7 +4,6 @@ const NostrConnect = ({ setConnectedPubkey }) => { const [pubkey, setPubkey] = useState(null); const [loading, setLoading] = useState(false); - // Check if already connected useEffect(() => { if (window.nostr?.getPublicKey) { window.nostr.getPublicKey() diff --git a/src/components/TemplateApplier.jsx b/src/components/TemplateApplier.jsx index fc50d53..db95dec 100644 --- a/src/components/TemplateApplier.jsx +++ b/src/components/TemplateApplier.jsx @@ -80,7 +80,7 @@ const TemplateApplier = ({ setConnectedPubkey }) => { throw new Error('Please connect your Nostr signer first'); } - // ✅ Collect ALL user relay URLs from the main relays + // Collect ALL user relay URLs from the main relays const allUserRelays = template.relays.map(r => r.url); const allResults = []; @@ -95,7 +95,7 @@ const TemplateApplier = ({ setConnectedPubkey }) => { }); } - // 2. Publish kind 10063 (blossom servers) - ✅ Pass all user relays + // 2. Publish kind 10063 (blossom servers) if (template.blossomServers && template.blossomServers.length > 0) { publishConfigs.push({ name: 'Blossom Servers (kind 10063)', @@ -104,7 +104,7 @@ const TemplateApplier = ({ setConnectedPubkey }) => { }); } - // 3. Publish kind 10050 (DM relays) - ✅ Pass all user relays + // 3. Publish kind 10050 (DM relays) if (template.dmRelays && template.dmRelays.length > 0) { publishConfigs.push({ name: 'DM Relays (kind 10050)', diff --git a/src/components/TemplateCreator.jsx b/src/components/TemplateCreator.jsx index 61beaa7..87329d8 100644 --- a/src/components/TemplateCreator.jsx +++ b/src/components/TemplateCreator.jsx @@ -10,7 +10,7 @@ const TemplateCreator = () => { ]); const [blossomServers, setBlossomServers] = useState([ - { url: 'https://your-blossom.community' } + { url: 'https://your-blossom.server' } ]); const [showBlossom, setShowBlossom] = useState(true); @@ -51,7 +51,6 @@ const TemplateCreator = () => { } }; - // Relay functions const addRelay = () => { setRelays([...relays, { url: '', read: true, write: true }]); }; @@ -72,7 +71,6 @@ const TemplateCreator = () => { } }; - // Blossom server functions const addBlossomServer = () => { setBlossomServers([...blossomServers, { url: '' }]); }; @@ -87,7 +85,6 @@ const TemplateCreator = () => { setBlossomServers(updated); }; - // DM relay functions const addDmRelay = () => { setDmRelays([...dmRelays, { url: '' }]); }; @@ -131,7 +128,6 @@ const TemplateCreator = () => {

Create Relay Template

- {/* Community Templates Section */}
{ />
- {/* Main Relays Section */}
- + {
- {/* Blossom Servers Section */}
@@ -314,7 +308,6 @@ const TemplateCreator = () => { )}
- {/* DM Relays Section */}
diff --git a/src/hooks/useNostr.js b/src/hooks/useNostr.js index 765b423..26dbe64 100644 --- a/src/hooks/useNostr.js +++ b/src/hooks/useNostr.js @@ -184,13 +184,6 @@ export const useNostr = () => { // PUBLISH KIND FUNCTIONS // ============================================================ - /** - * Generic publish function that publishes to ALL relays - * @param {number} kind - Event kind - * @param {object} data - Event data with tags and content - * @param {string} pubkey - User's pubkey - * @param {string[]} userRelayUrls - User's relay URLs (all of them, not just for this kind) - */ const publishKind = useCallback(async (kind, data, pubkey, userRelayUrls = []) => { if (!extension) { throw new Error('No Nostr extension connected'); @@ -208,7 +201,6 @@ export const useNostr = () => { const signedEvent = await signEvent(event); console.log(`Kind ${kind} event signed successfully`); - // ✅ Combine ALL relays: blast + ALL user relays const allRelays = [...new Set([...BLAST_RELAYS, ...userRelayUrls])]; console.log(`Publishing kind ${kind} to ${allRelays.length} relays (${BLAST_RELAYS.length} blast + ${userRelayUrls.length} user)`); @@ -225,7 +217,6 @@ export const useNostr = () => { }; }, [extension, signEvent, publishToRelays]); - // Kind 10002 - Relays const publishKind10002 = useCallback(async (relays, pubkey) => { const validRelays = relays.filter(r => r.url && r.url.trim() !== ''); if (validRelays.length === 0) { @@ -237,30 +228,25 @@ export const useNostr = () => { if (!relay.write) params.push('write'); return ['r', relay.url, ...params]; }); - // ✅ Pass ALL user relay URLs (they're the same as the relays being published) const userRelayUrls = validRelays.map(r => r.url); return await publishKind(10002, { tags }, pubkey, userRelayUrls); }, [publishKind]); - // Kind 10063 - Blossom Servers const publishKind10063 = useCallback(async (servers, pubkey, allUserRelays = []) => { const validServers = servers.filter(s => s.url && s.url.trim() !== ''); if (validServers.length === 0) { throw new Error('No valid blossom servers'); } const tags = validServers.map(server => ['server', server.url]); - // ✅ Pass ALL user relays (main relays, not just blossom servers) return await publishKind(10063, { tags }, pubkey, allUserRelays); }, [publishKind]); - // Kind 10050 - DM Relays const publishKind10050 = useCallback(async (relays, pubkey, allUserRelays = []) => { const validRelays = relays.filter(r => r.url && r.url.trim() !== ''); if (validRelays.length === 0) { throw new Error('No valid DM relays'); } const tags = validRelays.map(relay => ['relay', relay.url]); - // ✅ Pass ALL user relays (main relays, not just DM relays) return await publishKind(10050, { tags }, pubkey, allUserRelays); }, [publishKind]);