Support .onion for phoenixd (#1975)
* fix #1964 support .onion urls like lnbits does * fix lint: const hostname --------- Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
This commit is contained in:
parent
b7dfef41c0
commit
e31f8e9c69
@ -1,5 +1,6 @@
|
||||
import { fetchWithTimeout } from '@/lib/fetch'
|
||||
import { msatsToSats } from '@/lib/format'
|
||||
import { getAgent } from '@/lib/proxy'
|
||||
import { assertContentTypeJson, assertResponseOk } from '@/lib/url'
|
||||
|
||||
export * from '@/wallets/phoenixd'
|
||||
@ -27,9 +28,13 @@ export async function createInvoice (
|
||||
body.append('description', description)
|
||||
body.append('amountSat', msatsToSats(msats))
|
||||
|
||||
const res = await fetchWithTimeout(url + path, {
|
||||
const hostname = url.replace(/^https?:\/\//, '').replace(/\/+$/, '')
|
||||
const agent = getAgent({ hostname })
|
||||
|
||||
const res = await fetchWithTimeout(`${agent.protocol}//${hostname}${path}`, {
|
||||
method: 'POST',
|
||||
headers,
|
||||
agent,
|
||||
body,
|
||||
signal
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user