diff --git a/static/components/stall-details/stall-details.html b/static/components/stall-details/stall-details.html index 9c8eac6..9f1b198 100644 --- a/static/components/stall-details/stall-details.html +++ b/static/components/stall-details/stall-details.html @@ -106,5 +106,4 @@
- diff --git a/static/components/stall-list/stall-list.html b/static/components/stall-list/stall-list.html index 84e8fd4..86ae34e 100644 --- a/static/components/stall-list/stall-list.html +++ b/static/components/stall-list/stall-list.html @@ -21,19 +21,6 @@ - - {{props.row.config.description}} diff --git a/static/js/index.js b/static/js/index.js index 343b5eb..d8de942 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -15,15 +15,41 @@ const merchant = async () => { return { merchant: {}, shippingZones: [], - showKeys: false + showKeys: false, + importKeyDialog: { + show: false, + data: { + privateKey: null + } + } } }, methods: { generateKeys: async function () { - const privkey = nostr.generatePrivateKey() - const pubkey = nostr.getPublicKey(privkey) - - const payload = {private_key: privkey, public_key: pubkey, config: {}} + const privateKey = nostr.generatePrivateKey() + await this.createMerchant(privateKey) + }, + importKeys: async function () { + this.importKeyDialog.show = false + let privateKey = this.importKeyDialog.data.privateKey + if (!privateKey) { + return + } + if (privateKey.toLowerCase().startsWith('nsec')) { + privateKey = nostr.nip19.decode(privateKey) + } + await this.createMerchant(privateKey.data) + }, + showImportKeysDialog: async function () { + this.importKeyDialog.show = true + }, + createMerchant: async function (privateKey) { + const pubkey = nostr.getPublicKey(privateKey) + const payload = { + private_key: privateKey, + public_key: pubkey, + config: {} + } try { const {data} = await LNbits.api.request( 'POST', @@ -54,6 +80,7 @@ const merchant = async () => { } }, created: async function () { + console.log('### nostr', nostr) await this.getMerchant() } }) diff --git a/templates/nostrmarket/index.html b/templates/nostrmarket/index.html index 41fa040..ad9c94d 100644 --- a/templates/nostrmarket/index.html +++ b/templates/nostrmarket/index.html @@ -38,7 +38,7 @@
+
+ + + + +
+ Import + Cancel +
+
+
+
+
{% endblock%}{% block scripts %} {{ window_vars(user) }}