feat: multi-profile support and UI improvements
- Remove backend restriction on one merchant per user - Add "Generate New Key" dialog with npub/nsec display - Add "Import Existing Key" option with duplicate check - Change "Save" to "Save & Publish" in edit profile dialog - Remove standalone Publish button (now part of Save) - Add trash icon to saved profile for removal - Show display_name in saved profiles dropdown - Hide nsec by default with eye toggle in generate dialog 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f466559b51
commit
7aec14854c
6 changed files with 113 additions and 40 deletions
|
|
@ -50,10 +50,16 @@ window.app.component('edit-profile-dialog', {
|
|||
this.adminkey,
|
||||
config
|
||||
)
|
||||
// Publish to Nostr
|
||||
await LNbits.api.request(
|
||||
'PUT',
|
||||
`/nostrmarket/api/v1/merchant/${this.merchantId}/nostr`,
|
||||
this.adminkey
|
||||
)
|
||||
this.show = false
|
||||
this.$q.notify({
|
||||
type: 'positive',
|
||||
message: 'Profile updated!'
|
||||
message: 'Profile saved and published to Nostr!'
|
||||
})
|
||||
this.$emit('profile-updated')
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,13 @@ window.app = Vue.createApp({
|
|||
privateKey: null
|
||||
}
|
||||
},
|
||||
generateKeyDialog: {
|
||||
show: false,
|
||||
privateKey: null,
|
||||
nsec: null,
|
||||
npub: null,
|
||||
showNsec: false
|
||||
},
|
||||
wsConnection: null,
|
||||
nostrStatus: {
|
||||
connected: false,
|
||||
|
|
@ -41,9 +48,18 @@ window.app = Vue.createApp({
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
generateKeys: async function () {
|
||||
generateKeys: function () {
|
||||
const privateKey = nostr.generatePrivateKey()
|
||||
await this.createMerchant(privateKey)
|
||||
const publicKey = nostr.getPublicKey(privateKey)
|
||||
this.generateKeyDialog.privateKey = privateKey
|
||||
this.generateKeyDialog.nsec = nostr.nip19.nsecEncode(privateKey)
|
||||
this.generateKeyDialog.npub = nostr.nip19.npubEncode(publicKey)
|
||||
this.generateKeyDialog.showNsec = false
|
||||
this.generateKeyDialog.show = true
|
||||
},
|
||||
confirmGenerateKey: async function () {
|
||||
this.generateKeyDialog.show = false
|
||||
await this.createMerchant(this.generateKeyDialog.privateKey)
|
||||
},
|
||||
importKeys: async function () {
|
||||
this.importKeyDialog.show = false
|
||||
|
|
@ -55,11 +71,21 @@ window.app = Vue.createApp({
|
|||
if (privateKey.toLowerCase().startsWith('nsec')) {
|
||||
privateKey = nostr.nip19.decode(privateKey).data
|
||||
}
|
||||
// Check if this key is already in use
|
||||
const publicKey = nostr.getPublicKey(privateKey)
|
||||
if (this.merchant?.public_key === publicKey) {
|
||||
this.$q.notify({
|
||||
type: 'warning',
|
||||
message: 'This key is already your current profile'
|
||||
})
|
||||
return
|
||||
}
|
||||
} catch (error) {
|
||||
this.$q.notify({
|
||||
type: 'negative',
|
||||
message: `${error}`
|
||||
})
|
||||
return
|
||||
}
|
||||
await this.createMerchant(privateKey)
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue