mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-29 10:10:00 +02:00
fix: mempool hostname
This commit is contained in:
@ -218,7 +218,7 @@
|
|||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
<a
|
<a
|
||||||
style="color: unset"
|
style="color: unset"
|
||||||
:href="mempool_endpoint + '/address/' + charge.onchainaddress"
|
:href="mempoolEndpoint + '/address/' + charge.onchainaddress"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
><span
|
><span
|
||||||
class="text-subtitle1"
|
class="text-subtitle1"
|
||||||
@ -303,7 +303,8 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
charge: JSON.parse('{{charge_data | tojson}}'),
|
charge: JSON.parse('{{charge_data | tojson}}'),
|
||||||
mempool_endpoint: '{{mempool_endpoint}}',
|
mempoolEndpoint: '{{mempool_endpoint}}',
|
||||||
|
network: '{{network}}',
|
||||||
pendingFunds: 0,
|
pendingFunds: 0,
|
||||||
ws: null,
|
ws: null,
|
||||||
newProgress: 0.4,
|
newProgress: 0.4,
|
||||||
@ -316,6 +317,15 @@
|
|||||||
cancelListener: () => {}
|
cancelListener: () => {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
mempoolHostname: function () {
|
||||||
|
let hostname = new URL(this.mempoolEndpoint).hostname
|
||||||
|
if (this.network === 'Testnet') {
|
||||||
|
hostname += '/testnet'
|
||||||
|
}
|
||||||
|
return hostname
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkBalances: async function () {
|
checkBalances: async function () {
|
||||||
if (this.charge.hasStaleBalance) return
|
if (this.charge.hasStaleBalance) return
|
||||||
@ -335,7 +345,7 @@
|
|||||||
const {
|
const {
|
||||||
bitcoin: {addresses: addressesAPI}
|
bitcoin: {addresses: addressesAPI}
|
||||||
} = mempoolJS({
|
} = mempoolJS({
|
||||||
hostname: new URL(this.mempool_endpoint).hostname
|
hostname: new URL(this.mempoolEndpoint).hostname
|
||||||
})
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -378,10 +388,10 @@
|
|||||||
const {
|
const {
|
||||||
bitcoin: {websocket}
|
bitcoin: {websocket}
|
||||||
} = mempoolJS({
|
} = mempoolJS({
|
||||||
hostname: new URL(this.mempool_endpoint).hostname
|
hostname: new URL(this.mempoolEndpoint).hostname
|
||||||
})
|
})
|
||||||
|
|
||||||
this.ws = new WebSocket('wss://mempool.space/api/v1/ws')
|
this.ws = new WebSocket(`wss://${this.mempoolHostname}/api/v1/ws`)
|
||||||
this.ws.addEventListener('open', x => {
|
this.ws.addEventListener('open', x => {
|
||||||
if (this.charge.onchainaddress) {
|
if (this.charge.onchainaddress) {
|
||||||
this.trackAddress(this.charge.onchainaddress)
|
this.trackAddress(this.charge.onchainaddress)
|
||||||
|
@ -30,17 +30,17 @@ async def display(request: Request, charge_id: str):
|
|||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=HTTPStatus.NOT_FOUND, detail="Charge link does not exist."
|
status_code=HTTPStatus.NOT_FOUND, detail="Charge link does not exist."
|
||||||
)
|
)
|
||||||
wallet = await get_wallet(charge.lnbitswallet)
|
|
||||||
onchainwallet_config = await get_charge_config(charge_id)
|
onchainwallet_config = await get_charge_config(charge_id)
|
||||||
inkey = wallet.inkey if wallet else None
|
if onchainwallet_config:
|
||||||
mempool_endpoint = (
|
mempool_endpoint = onchainwallet_config.mempool_endpoint
|
||||||
onchainwallet_config.mempool_endpoint if onchainwallet_config else None
|
network = onchainwallet_config.network
|
||||||
)
|
|
||||||
return satspay_renderer().TemplateResponse(
|
return satspay_renderer().TemplateResponse(
|
||||||
"satspay/display.html",
|
"satspay/display.html",
|
||||||
{
|
{
|
||||||
"request": request,
|
"request": request,
|
||||||
"charge_data": charge.dict(),
|
"charge_data": charge.dict(),
|
||||||
"mempool_endpoint": mempool_endpoint,
|
"mempool_endpoint": mempool_endpoint,
|
||||||
|
"network": network,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user