change name and add link to source

This commit is contained in:
sakrecoer 2026-08-18 21:51:56 +02:00
parent 581c3626af
commit da88a2c0ef
7 changed files with 24 additions and 41 deletions

View file

@ -14,7 +14,6 @@ function App() {
<h1> Communitator</h1>
<nav>
<Link to="/">🏠 Create Template</Link>
{/* Remove the broken link - users will access /apply/:encoded via generated links */}
</nav>
{connectedPubkey && (
<div className="user-badge">
@ -24,20 +23,26 @@ function App() {
</header>
<main>
<Routes>
<Route path="/" element={
<TemplateCreator setConnectedPubkey={setConnectedPubkey} />
} />
<Route path="/apply/:encoded" element={
<TemplateApplier connectedPubkey={connectedPubkey} setConnectedPubkey={setConnectedPubkey} />
} />
<Route path="/" element={<TemplateCreator />} />
<Route path="/apply/:encoded" element={<TemplateApplier setConnectedPubkey={setConnectedPubkey} />} />
</Routes>
</main>
<footer>
<p>Self-contained Built with Nostr</p>
<p>
Built with Nostr &middot;{' '}
<a
href="https://git.basspistol.org/hq/Communitator"
target="_blank"
rel="noopener noreferrer"
style={{ color: 'inherit', textDecoration: 'underline' }}
>
Source Code
</a>
</p>
</footer>
</div>
</HashRouter>
);
}
export default App;
export default App;

View file

@ -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()

View file

@ -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)',

View file

@ -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 = () => {
<div className="template-creator">
<h2>Create Relay Template</h2>
{/* Community Templates Section */}
<div className="form-group" style={{
background: '#f8f9fa',
padding: '16px',
@ -226,9 +222,8 @@ const TemplateCreator = () => {
/>
</div>
{/* Main Relays Section */}
<div className="form-group">
<label>📡 Relays *</label>
<label>Relays *</label>
<RelayList
relays={relays}
onUpdate={updateRelay}
@ -270,7 +265,6 @@ const TemplateCreator = () => {
</div>
</div>
{/* Blossom Servers Section */}
<div className="form-group">
<div style={{ display: 'flex', alignItems: 'center', gap: '10px', marginBottom: '8px' }}>
<label style={{ marginBottom: 0 }}>🌺 Blossom Servers (kind 10063)</label>
@ -314,7 +308,6 @@ const TemplateCreator = () => {
)}
</div>
{/* DM Relays Section */}
<div className="form-group">
<div style={{ display: 'flex', alignItems: 'center', gap: '10px', marginBottom: '8px' }}>
<label style={{ marginBottom: 0 }}>💬 DM Relays (kind 10050)</label>

View file

@ -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]);