mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-27 12:07:43 +02:00
fix CORS issue when fetching users LNURL
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { fetchWithCorsFallback } from "../helpers/cors";
|
||||||
import { getLudEndpoint } from "../helpers/lnurl";
|
import { getLudEndpoint } from "../helpers/lnurl";
|
||||||
|
|
||||||
type LNURLPMetadata = {
|
type LNURLPMetadata = {
|
||||||
@@ -23,7 +24,9 @@ class LNURLMetadataService {
|
|||||||
const url = getLudEndpoint(addressOrLNURL);
|
const url = getLudEndpoint(addressOrLNURL);
|
||||||
if (!url) return;
|
if (!url) return;
|
||||||
try {
|
try {
|
||||||
const metadata = await fetch(url).then((res) => res.json() as Promise<LNURLError | LNURLPMetadata>);
|
const metadata = await fetchWithCorsFallback(url).then(
|
||||||
|
(res) => res.json() as Promise<LNURLError | LNURLPMetadata>,
|
||||||
|
);
|
||||||
if ((metadata as LNURLPMetadata).tag === "payRequest") {
|
if ((metadata as LNURLPMetadata).tag === "payRequest") {
|
||||||
return metadata as LNURLPMetadata;
|
return metadata as LNURLPMetadata;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user