mirror of
https://github.com/aljazceru/nostrdvm.git
synced 2025-12-24 01:14:24 +01:00
show the dvm name in alby nwc authorizations, catch unauthorized nwc strings
This commit is contained in:
@@ -699,11 +699,11 @@ async function store_nwc(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
async function connect_alby_nwc(){
|
async function connect_alby_nwc(dvm_name){
|
||||||
|
|
||||||
const alby = webln.NostrWebLNProvider.withNewSecret();
|
const alby = webln.NostrWebLNProvider.withNewSecret();
|
||||||
let result = await alby.client.initNWC({
|
let result = await alby.client.initNWC({
|
||||||
name: `Noogle`,
|
name: dvm_name,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.payload.success){
|
if (result.payload.success){
|
||||||
@@ -895,7 +895,7 @@ const closeNWCModal = () => {
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="collapse-content">
|
<div class="collapse-content">
|
||||||
<button v-if="!nwcalby.startsWith('nostr')" style="margin-top: 20px;" @click="connect_alby_nwc()">
|
<button v-if="!nwcalby.startsWith('nostr')" style="margin-top: 20px;" @click="connect_alby_nwc(dvm.nip88.title)">
|
||||||
<svg width="211" height="40" viewBox="0 0 211 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg width="211" height="40" viewBox="0 0 211 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<rect x="0.5" width="210" height="40" rx="6" fill="url(#paint0_linear_1_148)"/>
|
<rect x="0.5" width="210" height="40" rx="6" fill="url(#paint0_linear_1_148)"/>
|
||||||
<circle cx="1.575" cy="1.575" r="1.575" transform="matrix(-1 0 0 1 22.1176 13.8575)" fill="black"/>
|
<circle cx="1.575" cy="1.575" r="1.575" transform="matrix(-1 0 0 1 22.1176 13.8575)" fill="black"/>
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import {bech32} from "bech32";
|
|||||||
import {webln} from "@getalby/sdk";
|
import {webln} from "@getalby/sdk";
|
||||||
|
|
||||||
import amberSignerService from "@/components/android-signer/AndroidSigner";
|
import amberSignerService from "@/components/android-signer/AndroidSigner";
|
||||||
|
import miniToastr from "mini-toastr";
|
||||||
|
import VueNotifications from "vue-notifications";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -24,9 +26,17 @@ async function zap_nwc(invoice){
|
|||||||
await nwc.enable();
|
await nwc.enable();
|
||||||
|
|
||||||
// now you can send payments by passing in the invoice
|
// now you can send payments by passing in the invoice
|
||||||
const response = await nwc.sendPayment(invoice);
|
try{
|
||||||
|
const response = await nwc.sendPayment(invoice);
|
||||||
console.log(response)
|
console.log(response)
|
||||||
return true
|
return true
|
||||||
|
}
|
||||||
|
catch (error){
|
||||||
|
miniToastr.showMessage(error, "This didn't work", VueNotifications.types.error)
|
||||||
|
console.log(error)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user