@@ -7,12 +7,12 @@
|
||||
<key>Nostore (iOS).xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>Nostore (macOS).xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>nostore (iOS).xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
|
||||
@@ -53,6 +53,8 @@ browser.runtime.onMessage.addListener((message, _sender, sendResponse) => {
|
||||
return Promise.resolve(getPublicKey(message.payload));
|
||||
case 'npubEncode':
|
||||
return Promise.resolve(nip19.npubEncode(message.payload));
|
||||
case 'copy':
|
||||
return navigator.clipboard.writeText(message.payload);
|
||||
|
||||
// window.nostr
|
||||
case 'getPubKey':
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
"page": "options.html"
|
||||
},
|
||||
"permissions": [
|
||||
"storage"
|
||||
"storage",
|
||||
"clipboardWrite"
|
||||
],
|
||||
"web_accessible_resources": [
|
||||
{
|
||||
|
||||
@@ -12,12 +12,21 @@
|
||||
<body x-data="popup">
|
||||
<div class="profiles">
|
||||
<label for="profile">Active Profile</label>
|
||||
<div class="profile-buttons">
|
||||
<select x-model.number="profileIndex" name="profile" id="profile" class="input">
|
||||
<template x-for="(prof, index) in profileNames" :key="index">
|
||||
<option x-text="prof" :value="index"></option>
|
||||
</template>
|
||||
</select>
|
||||
<div class="profile-buttons flex flex-row gap-2">
|
||||
<div class="grow">
|
||||
<select x-model.number="profileIndex" name="profile" id="profile" class="input">
|
||||
<template x-for="(prof, index) in profileNames" :key="index">
|
||||
<option x-text="prof" :value="index"></option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<button class="button p-1.5" @click.prevent="await copyNpub()" style="display: block;" title="Copy npub">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="1em"
|
||||
viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. -->
|
||||
<path
|
||||
d="M272 0H396.1c12.7 0 24.9 5.1 33.9 14.1l67.9 67.9c9 9 14.1 21.2 14.1 33.9V336c0 26.5-21.5 48-48 48H272c-26.5 0-48-21.5-48-48V48c0-26.5 21.5-48 48-48zM48 128H192v64H64V448H256V416h64v48c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V176c0-26.5 21.5-48 48-48z" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
initialize,
|
||||
relayReminder,
|
||||
toggleRelayReminder,
|
||||
getNpub,
|
||||
} from './utilities/utils';
|
||||
import Alpine from 'alpinejs';
|
||||
window.Alpine = Alpine;
|
||||
@@ -86,6 +87,11 @@ Alpine.data('popup', () => ({
|
||||
await toggleRelayReminder();
|
||||
this.showRelayReminder = false;
|
||||
},
|
||||
|
||||
async copyNpub() {
|
||||
let npub = await getNpub();
|
||||
await browser.runtime.sendMessage({ kind: 'copy', payload: npub });
|
||||
},
|
||||
}));
|
||||
|
||||
Alpine.start();
|
||||
|
||||
@@ -263,3 +263,11 @@ export async function getDelegator(index) {
|
||||
console.log(profile);
|
||||
return [profile.delegate, profile.delegator];
|
||||
}
|
||||
|
||||
export async function getNpub() {
|
||||
let index = await getProfileIndex();
|
||||
return await browser.runtime.sendMessage({
|
||||
kind: 'getNpub',
|
||||
payload: index,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user