web: added login page
It's a start, but nothing great.
This commit is contained in:
parent
ab2ced247b
commit
cdb2fefe90
5 changed files with 195 additions and 21 deletions
|
@ -240,19 +240,21 @@ function update_title(model) {
|
|||
update_notification_markers(has_notes)
|
||||
}
|
||||
|
||||
async function get_pubkey() {
|
||||
async function get_pubkey(use_prompt=true) {
|
||||
let pubkey = get_local_state('pubkey')
|
||||
if (pubkey)
|
||||
return pubkey
|
||||
if (window.nostr && window.nostr.getPublicKey) {
|
||||
console.log("calling window.nostr.getPublicKey()...")
|
||||
log_debug("calling window.nostr.getPublicKey()...")
|
||||
const pubkey = await window.nostr.getPublicKey()
|
||||
console.log("got %s pubkey from nos2x", pubkey)
|
||||
log_debug("got %s pubkey from nos2x", pubkey)
|
||||
return await handle_pubkey(pubkey)
|
||||
}
|
||||
pubkey = prompt("Enter nostr id (eg: jb55@jb55.com) or pubkey (hex or npub)")
|
||||
if (!pubkey)
|
||||
throw new Error("Need pubkey to continue")
|
||||
if (!use_prompt)
|
||||
return;
|
||||
pubkey = prompt("Enter Nostr ID (eg: jb55@jb55.com) or public key (hex or npub).")
|
||||
if (!pubkey.trim())
|
||||
return;
|
||||
return await handle_pubkey(pubkey)
|
||||
}
|
||||
|
||||
|
@ -280,6 +282,20 @@ function open_profile(pubkey) {
|
|||
view_update_profile(DAMUS, pubkey);
|
||||
}
|
||||
|
||||
function open_faqs() {
|
||||
find_node("#faqs").classList.remove("closed");
|
||||
}
|
||||
|
||||
function close_modal(el) {
|
||||
while (el.parentElement) {
|
||||
if (el.classList.contains("modal")) {
|
||||
el.classList.add("closed");
|
||||
break;
|
||||
}
|
||||
el = el.parentElement;
|
||||
}
|
||||
}
|
||||
|
||||
function view_update_profile(model, pubkey) {
|
||||
const profile = model.profiles[pubkey] || {};
|
||||
const el = find_node("[role='profile-info']");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue