mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-18 19:23:40 +00:00
Fix pubkey/anon login
This commit is contained in:
parent
eed863143d
commit
2d45928e8c
@ -3,10 +3,7 @@
|
||||
- [ ] Fix memory usage
|
||||
- [x] Add table of user events, derive profile from this using `watch`.
|
||||
- [x] Make zapper info more compact
|
||||
- [ ] Migrate
|
||||
- [ ] Test
|
||||
- [ ] Test that relays/follows made as anon don't stomp user settings on login
|
||||
- [ ] Test anonymous usage, public key only usage
|
||||
- [ ] Person search doesn't find people on first load
|
||||
- [ ] Fix re-connects
|
||||
- [ ] Show loading/success on zap invoice screen
|
||||
- [ ] Fix iOS/safari/firefox
|
||||
|
@ -75,7 +75,7 @@ export default {
|
||||
|
||||
profile.update(assoc("petnames", $petnames))
|
||||
|
||||
if (profileCopy) {
|
||||
if (keys.canSign()) {
|
||||
return cmd.setPetnames($petnames).publish(profileCopy.relays)
|
||||
}
|
||||
},
|
||||
@ -102,7 +102,7 @@ export default {
|
||||
|
||||
profile.update(assoc("relays", $relays))
|
||||
|
||||
if (profileCopy) {
|
||||
if (keys.canSign()) {
|
||||
return cmd.setRelays($relays).publish($relays)
|
||||
}
|
||||
},
|
||||
@ -132,7 +132,7 @@ export default {
|
||||
|
||||
profile.update(assoc("mutes", $mutes))
|
||||
|
||||
if (profileCopy) {
|
||||
if (keys.canSign()) {
|
||||
return cmd.setMutes($mutes.map(slice(0, 2))).publish(profileCopy.relays)
|
||||
}
|
||||
},
|
||||
|
@ -20,8 +20,6 @@
|
||||
let showNewMessages = false
|
||||
let cursor = new Cursor()
|
||||
|
||||
const {profile} = user
|
||||
|
||||
$: {
|
||||
// Group messages so we're only showing the person once per chunk
|
||||
annotatedMessages = reverse(
|
||||
@ -54,7 +52,7 @@
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (!$profile) {
|
||||
if (!user.getPubkey()) {
|
||||
return navigate("/login")
|
||||
}
|
||||
|
||||
|
@ -59,32 +59,30 @@
|
||||
<i class="fa fa-qrcode mr-2" /> Scan
|
||||
</a>
|
||||
</li>
|
||||
{#if $profile}
|
||||
<li
|
||||
class={cx("relative", {
|
||||
"cursor-pointer": $canPublish,
|
||||
"pointer-events-none opacity-75": !$canPublish,
|
||||
})}>
|
||||
<a class="block px-4 py-2 transition-all hover:bg-accent" href="/messages">
|
||||
<i class="fa fa-envelope mr-2" /> Messages
|
||||
{#if $newDirectMessages}
|
||||
<div class="absolute top-2 left-7 h-2 w-2 rounded bg-accent" />
|
||||
{/if}
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class={cx("relative", {
|
||||
"cursor-pointer": $canPublish,
|
||||
"pointer-events-none opacity-75": !$canPublish,
|
||||
})}>
|
||||
<a class="block px-4 py-2 transition-all hover:bg-accent" href="/chat">
|
||||
<i class="fa fa-comment mr-2" /> Chat
|
||||
{#if $newChatMessages}
|
||||
<div class="absolute top-2 left-7 h-2 w-2 rounded bg-accent" />
|
||||
{/if}
|
||||
</a>
|
||||
</li>
|
||||
{/if}
|
||||
<li
|
||||
class={cx("relative", {
|
||||
"cursor-pointer": $canPublish,
|
||||
"pointer-events-none opacity-75": !$canPublish,
|
||||
})}>
|
||||
<a class="block px-4 py-2 transition-all hover:bg-accent" href="/messages">
|
||||
<i class="fa fa-envelope mr-2" /> Messages
|
||||
{#if $newDirectMessages}
|
||||
<div class="absolute top-2 left-7 h-2 w-2 rounded bg-accent" />
|
||||
{/if}
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class={cx("relative", {
|
||||
"cursor-pointer": $canPublish,
|
||||
"pointer-events-none opacity-75": !$canPublish,
|
||||
})}>
|
||||
<a class="block px-4 py-2 transition-all hover:bg-accent" href="/chat">
|
||||
<i class="fa fa-comment mr-2" /> Chat
|
||||
{#if $newChatMessages}
|
||||
<div class="absolute top-2 left-7 h-2 w-2 rounded bg-accent" />
|
||||
{/if}
|
||||
</a>
|
||||
</li>
|
||||
<li class="mx-3 my-4 h-px bg-medium" />
|
||||
<li class="relative cursor-pointer">
|
||||
<a class="block px-4 py-2 transition-all hover:bg-accent" href="/relays">
|
||||
@ -94,7 +92,7 @@
|
||||
{/if}
|
||||
</a>
|
||||
</li>
|
||||
{#if $profile}
|
||||
{#if $profile.pubkey}
|
||||
<li class="cursor-pointer">
|
||||
<a class="block px-4 py-2 transition-all hover:bg-accent" href="/keys">
|
||||
<i class="fa fa-key mr-2" /> Keys
|
||||
|
@ -22,19 +22,27 @@
|
||||
|
||||
export let stage
|
||||
|
||||
let relays = [
|
||||
{url: "wss://nostr-pub.wellorder.net", write: true},
|
||||
{url: "wss://nostr.zebedee.cloud", write: true},
|
||||
{url: "wss://nos.lol", write: true},
|
||||
{url: "wss://brb.io", write: true},
|
||||
]
|
||||
const {relays: userRelays, petnamePubkeys} = user
|
||||
|
||||
let follows = [
|
||||
"97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322", // hodlbod
|
||||
"3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d", // fiatjaf
|
||||
"82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2", // jack
|
||||
"6e468422dfb74a5738702a8823b9b28168abab8655faacb6853cd0ee15deee93", // Gigi
|
||||
]
|
||||
let relays =
|
||||
$userRelays.length > 0
|
||||
? $userRelays
|
||||
: [
|
||||
{url: "wss://nostr-pub.wellorder.net", write: true},
|
||||
{url: "wss://nostr.zebedee.cloud", write: true},
|
||||
{url: "wss://nos.lol", write: true},
|
||||
{url: "wss://brb.io", write: true},
|
||||
]
|
||||
|
||||
let follows =
|
||||
$petnamePubkeys.length > 0
|
||||
? $petnamePubkeys
|
||||
: [
|
||||
"97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322", // hodlbod
|
||||
"3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d", // fiatjaf
|
||||
"82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2", // jack
|
||||
"6e468422dfb74a5738702a8823b9b28168abab8655faacb6853cd0ee15deee93", // Gigi
|
||||
]
|
||||
|
||||
const privkey = generatePrivateKey()
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
import RelayCard from "src/partials/RelayCard.svelte"
|
||||
import pool from "src/agent/pool"
|
||||
import user from "src/agent/user"
|
||||
import keys from "src/agent/keys"
|
||||
import {loadAppData} from "src/app"
|
||||
|
||||
export let relay
|
||||
@ -17,6 +18,8 @@
|
||||
let joined = false
|
||||
|
||||
const {relays, canPublish} = user
|
||||
const {method} = keys
|
||||
const isPubkeyLogin = $method === "pubkey"
|
||||
|
||||
$: joined = find(propEq("url", relay.url), $relays)
|
||||
|
||||
@ -47,8 +50,8 @@
|
||||
<RelayCard
|
||||
{relay}
|
||||
{theme}
|
||||
addRelay={!joined && $canPublish ? addRelay : null}
|
||||
removeRelay={joined && $relays.length > 1 && canPublish ? removeRelay : null}>
|
||||
addRelay={!joined && !isPubkeyLogin ? addRelay : null}
|
||||
removeRelay={joined && $relays.length > 1 && !isPubkeyLogin ? removeRelay : null}>
|
||||
<div slot="controls" class="flex justify-between gap-2">
|
||||
{#if showControls && $canPublish}
|
||||
<span>Publish to this relay?</span>
|
||||
|
Loading…
Reference in New Issue
Block a user