alllowed sites UI
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
console.log("hello from nostr module");
|
|
||||||
|
|
||||||
window.nostr = {
|
window.nostr = {
|
||||||
async getPublicKey() {
|
async getPublicKey() {
|
||||||
console.log("getting public key!");
|
console.log("getting public key!");
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ body {
|
|||||||
font-family: system-ui;
|
font-family: system-ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#priv-key {
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
|
||||||
.profiles label {
|
.profiles label {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -22,4 +26,20 @@ body {
|
|||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.buttons {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td:first-child {
|
||||||
|
width: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td:nth-child(2) {
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
/* @media (prefers-color-scheme: dark) {} */
|
/* @media (prefers-color-scheme: dark) {} */
|
||||||
|
|||||||
@@ -17,12 +17,25 @@
|
|||||||
|
|
||||||
<div class="key">
|
<div class="key">
|
||||||
<label for="priv-key">Private Key</label>
|
<label for="priv-key">Private Key</label>
|
||||||
<input x-model="privKey" :type="visibleKey ? 'text' : 'password'">
|
<input id="priv-key" x-model="privKey" :type="visibleKey ? 'text' : 'password'" width="65">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<button @click="visibleKey = !visibleKey" x-text="visibleKey ? 'Hide' : 'Show'"></button>
|
<button @click="visibleKey = !visibleKey" x-text="visibleKey ? 'Hide' : 'Show'"></button>
|
||||||
<button @click="saveKey()">Save</button>
|
<button @click="saveKey()">Save</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="allowed-sites" x-show="allowedSites.length > 0">
|
||||||
|
<h3>Allowed Sites</h3>
|
||||||
|
<table>
|
||||||
|
<template x-for="(site, index) in allowedSites" :key="site.site">
|
||||||
|
<tr>
|
||||||
|
<td class="allowed" x-text="site.allowed ? 'Yes' : 'No'"></td>
|
||||||
|
<td x-text="site.site"></td>
|
||||||
|
<td><button @click="deleteSite(index)">Delete</button></td>
|
||||||
|
</tr>
|
||||||
|
</template>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ Alpine.data('popup', () => ({
|
|||||||
profiles: [],
|
profiles: [],
|
||||||
profile: '',
|
profile: '',
|
||||||
visibleKey: false,
|
visibleKey: false,
|
||||||
|
allowedSites: [],
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
await this.getProfiles();
|
await this.getProfiles();
|
||||||
await this.getPrivKeyForProfile();
|
await this.getPrivKeyForProfile();
|
||||||
|
await this.getAllowedSites();
|
||||||
},
|
},
|
||||||
|
|
||||||
saveKey() {
|
saveKey() {
|
||||||
@@ -23,6 +25,19 @@ Alpine.data('popup', () => ({
|
|||||||
|
|
||||||
async getPrivKeyForProfile() {
|
async getPrivKeyForProfile() {
|
||||||
this.privKey = this.profile;
|
this.privKey = this.profile;
|
||||||
|
},
|
||||||
|
|
||||||
|
async getAllowedSites() {
|
||||||
|
this.allowedSites = [
|
||||||
|
{site: 'yosupp.app', allowed: true},
|
||||||
|
{site: 'iris.to', allowed: false},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
|
||||||
|
async deleteSite(index) {
|
||||||
|
let newSites = [...this.allowedSites];
|
||||||
|
newSites.splice(index, 1);
|
||||||
|
this.allowedSites = newSites;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user