mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Include relay host in Nostr URIs when possible
This commit is contained in:
4 files changed
+18
-4
No files matched your search
@@ -34,7 +34,11 @@ export function RepositoryCard({ repo }: RepositoryCardProps) {
|
||||
const profileImage = authorData?.metadata?.picture;
|
||||
|
||||
// Construct Nostr clone URL
|
||||
const nostrURI = new NostrURI({ pubkey: repo.pubkey, identifier: repo.repoId });
|
||||
const nostrURI = new NostrURI({
|
||||
pubkey: repo.pubkey,
|
||||
identifier: repo.repoId,
|
||||
relay: repo.relays[0],
|
||||
});
|
||||
|
||||
const handleClone = async (e: React.MouseEvent) => {
|
||||
// Prevent card click from triggering
|
||||
|
||||
@@ -142,7 +142,11 @@ export function ConfigureRepoStep({
|
||||
await new Promise(resolve => setTimeout(resolve, 5000));
|
||||
|
||||
// Construct Nostr URI
|
||||
const nostrURI = new NostrURI({ pubkey: repoEvent.pubkey, identifier: projectId });
|
||||
const nostrURI = new NostrURI({
|
||||
pubkey: repoEvent.pubkey,
|
||||
identifier: projectId,
|
||||
relay: [...relays][0],
|
||||
});
|
||||
|
||||
// Configure the Nostr URI as the origin
|
||||
await git.addRemote({
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ export interface NostrURIParts {
|
||||
* const uri = new NostrURI({
|
||||
* pubkey: 'abc123...',
|
||||
* identifier: 'my-repo',
|
||||
* relay: 'relay.example.com'
|
||||
* relay: 'wss://relay.example.com/'
|
||||
* });
|
||||
*
|
||||
* // Parse from string
|
||||
|
||||
+7
-1
@@ -1288,11 +1288,17 @@ export class Git {
|
||||
throw lastError || new Error('All clone attempts failed');
|
||||
}
|
||||
|
||||
// Construct the Nostr URI with relay if not already present
|
||||
const repoUrl = new NostrURI({
|
||||
...nostrURI.toJSON(),
|
||||
relay: nostrURI.relay ?? repo.relays[0],
|
||||
});
|
||||
|
||||
// After successful clone, update the remote to point to the Nostr URI
|
||||
await this.setRemoteURL({
|
||||
remote: options.remote || 'origin',
|
||||
dir: options.dir,
|
||||
url: options.url,
|
||||
url: repoUrl.toString(),
|
||||
});
|
||||
|
||||
// Set the nostr.repo config to the naddr
|
||||
|
||||
Reference in new issue
Block a user