Change default NIP-95 endpoint to nostrcheck.me as void.cat is not accessible
This commit is contained in:
parent
333c8e4d7f
commit
07b9f513bb
@ -41,7 +41,7 @@ export const DEFAULT_RELAYS: RelayConfig[] = [
|
|||||||
export const DEFAULT_NIP95_APIS: Nip95Config[] = [
|
export const DEFAULT_NIP95_APIS: Nip95Config[] = [
|
||||||
{
|
{
|
||||||
id: 'default',
|
id: 'default',
|
||||||
url: 'https://void.cat/upload',
|
url: 'https://nostrcheck.me/api/v1/media',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
priority: 1,
|
priority: 1,
|
||||||
createdAt: Date.now(),
|
createdAt: Date.now(),
|
||||||
@ -49,7 +49,7 @@ export const DEFAULT_NIP95_APIS: Nip95Config[] = [
|
|||||||
{
|
{
|
||||||
id: 'nostrbuild',
|
id: 'nostrbuild',
|
||||||
url: 'https://nostr.build/api/v2/upload',
|
url: 'https://nostr.build/api/v2/upload',
|
||||||
enabled: false,
|
enabled: true,
|
||||||
priority: 2,
|
priority: 2,
|
||||||
createdAt: Date.now(),
|
createdAt: Date.now(),
|
||||||
},
|
},
|
||||||
|
|||||||
11
lib/nip95.ts
11
lib/nip95.ts
@ -30,8 +30,10 @@ function validateFile(file: File): MediaRef['type'] {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse upload response from different NIP-95 providers
|
* Parse upload response from different NIP-95 providers
|
||||||
* Supports void.cat format: { ok: true, file: { id, url } } or { url: string }
|
* Supports multiple formats:
|
||||||
* Supports nostr.build format: { url: string }
|
* - Standard format: { url: string }
|
||||||
|
* - void.cat format: { ok: true, file: { id, url } }
|
||||||
|
* - nostrcheck.me format: { url: string } or { status: 'success', url: string }
|
||||||
*/
|
*/
|
||||||
function parseUploadResponse(result: unknown, endpoint: string): string {
|
function parseUploadResponse(result: unknown, endpoint: string): string {
|
||||||
if (typeof result !== 'object' || result === null) {
|
if (typeof result !== 'object' || result === null) {
|
||||||
@ -48,6 +50,11 @@ function parseUploadResponse(result: unknown, endpoint: string): string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nostrcheck.me format: { status: 'success', url: string }
|
||||||
|
if ('status' in obj && obj.status === 'success' && 'url' in obj && typeof obj.url === 'string') {
|
||||||
|
return obj.url
|
||||||
|
}
|
||||||
|
|
||||||
// Standard format: { url: string }
|
// Standard format: { url: string }
|
||||||
if ('url' in obj && typeof obj.url === 'string') {
|
if ('url' in obj && typeof obj.url === 'string') {
|
||||||
return obj.url
|
return obj.url
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user