Return better blossom errors

This commit is contained in:
Jon Staab
2025-11-10 16:02:02 -08:00
parent e7a2535ece
commit e3e500ccc2
+5 -3
View File
@@ -612,7 +612,7 @@ export const payInvoice = async (invoice: string) => {
export const normalizeBlossomUrl = (url: string) => normalizeUrl(url.replace(/^ws/, "http"))
export const hasBlossomSupport = simpleCache(async ([url]: [string]) => {
export const fetchHasBlossomSupport = async (url: string) => {
const server = normalizeBlossomUrl(url)
const $signer = signer.get() || Nip01Signer.ephemeral()
const headers: Record<string, string> = {
@@ -633,7 +633,9 @@ export const hasBlossomSupport = simpleCache(async ([url]: [string]) => {
}
return false
})
}
export const hasBlossomSupport = simpleCache(([url]: [string]) => fetchHasBlossomSupport(url))
export type GetBlossomServerOptions = {
url?: string
@@ -701,7 +703,7 @@ export const uploadFile = async (file: File, options: UploadFileOptions = {}) =>
let {uploaded, url, ...task} = parseJson(text) || {}
if (!uploaded) {
return {error: text}
return {error: text || `Failed to upload file (HTTP ${res.status})`}
}
// Always append correct file extension if we encrypted the file, or if it's missing