mirror of
https://github.com/coracle-social/coracle.git
synced 2024-10-06 11:43:30 +00:00
Fix signing function loading, paste as plain text
This commit is contained in:
parent
9279dd29e9
commit
9ad897adef
11
ROADMAP.md
11
ROADMAP.md
@ -1,18 +1,20 @@
|
||||
# Current
|
||||
|
||||
- [ ] Review 10002 usage https://github.com/nostr-protocol/nips/blob/master/65.md
|
||||
- [ ] Make feeds page customizable. This could potentially use the "lists" NIP
|
||||
- nevent1qqspjcqw2hu5gfcpkrjhs0aqvxuzjgtp50l375mcqjfpmk48cg5hevgpr3mhxue69uhkummnw3ez6un9d3shjtnhd3m8xtnnwpskxegpzamhxue69uhkummnw3ezuendwsh8w6t69e3xj7spramhxue69uhkummnw3ez6un9d3shjtnwdahxxefwv93kzer9d4usz9rhwden5te0wfjkccte9ejxzmt4wvhxjmcpr9mhxue69uhkummnw3ezuer9d3hjuum0ve68wctjv5n8hwfg
|
||||
- [ ] Click through on relays page to view a feed for only that relay.
|
||||
- [ ] Custom views should combine pubkeys, relays, and topics
|
||||
- [ ] Likes list on note detail. Maybe a sidebar or header for note detail page?
|
||||
- [ ] Custom views should combine pubkeys, relays, event ids, and topics
|
||||
|
||||
- [ ] Fix anon/new user experience
|
||||
- [ ] Initial user load doesn't have any relays, cache user or wait for people db to be loaded
|
||||
- [ ] Are write relays the only ones that matter? User read relays only matter for global feed, or where there's no relay hints available. But if relays are navigable, this is unnecessary.
|
||||
- [ ] Fix bugs on bugsnag
|
||||
- [ ] Fix bugs on github
|
||||
|
||||
# Snacks
|
||||
|
||||
- [ ] Pinned posts ala snort
|
||||
- [ ] Likes list on note detail. Maybe a sidebar or header for note detail page?
|
||||
- [ ] Support key delegation
|
||||
- https://github.com/nbd-wtf/nostr-tools/blob/master/nip26.ts
|
||||
- [ ] Add keyword mutes
|
||||
@ -21,9 +23,12 @@
|
||||
- [ ] Linkify bech32 entities w/ NIP 21 https://github.com/nostr-protocol/nips/blob/master/21.md
|
||||
- [ ] Sign in as user with one click to view things from their pubkey's perspective - do this with multiple accounts
|
||||
- nevent1qqsyyxtrhpsqeqaqgucd6uzpyh8eq2hkfgr0yzr7ku7tgyl5cn9jw5qpz3mhxue69uhhyetvv9ujumn0wd68ytnzvuq3gamnwvaz7tmjv4kxz7fwv3sk6atn9e5k7l564wx
|
||||
- [ ] Search by nip05 alias
|
||||
- nevent1qqsdt4ux9c0zvd6hzpwnzznjsmd7a337mpxdspu9wd4fq8drvqejdmqpz3mhxue69uhhyetvv9ujuerpd46hxtnfduqs6amnwvaz7tmwdaejumr0dsffemjp
|
||||
|
||||
# Missions
|
||||
|
||||
- [ ] Are write relays the only ones that matter? User read relays only matter for global feed, or where there's no relay hints available. But if relays are navigable, this is unnecessary.
|
||||
- [ ] Topics/hashtag views
|
||||
- [ ] Support paid relays
|
||||
- atlas.nostr.land
|
||||
|
@ -1,11 +1,9 @@
|
||||
import {nip04} from 'nostr-tools'
|
||||
import {getPublicKey, getEventHash, signEvent} from 'nostr-tools'
|
||||
import {prop} from 'ramda'
|
||||
import {nip04, getPublicKey, getEventHash, signEvent} from 'nostr-tools'
|
||||
import {get} from 'svelte/store'
|
||||
import {error} from 'src/util/logger'
|
||||
import {synced} from 'src/util/misc'
|
||||
|
||||
let signingFunction
|
||||
|
||||
const pubkey = synced('agent/user/pubkey')
|
||||
const privkey = synced('agent/user/privkey')
|
||||
const getExtension = () => (window as {nostr?: any}).nostr
|
||||
@ -17,16 +15,6 @@ const setPrivateKey = _privkey => {
|
||||
}
|
||||
|
||||
const setPublicKey = _pubkey => {
|
||||
const nostr = getExtension()
|
||||
|
||||
if (nostr) {
|
||||
signingFunction = async event => {
|
||||
const {sig} = await nostr.signEvent(event)
|
||||
|
||||
return sig
|
||||
}
|
||||
}
|
||||
|
||||
pubkey.set(_pubkey)
|
||||
}
|
||||
|
||||
@ -36,10 +24,12 @@ const clear = () => {
|
||||
}
|
||||
|
||||
const sign = async event => {
|
||||
const ext = getExtension()
|
||||
|
||||
event.pubkey = get(pubkey)
|
||||
event.id = getEventHash(event)
|
||||
event.sig = signingFunction
|
||||
? await signingFunction(event)
|
||||
event.sig = ext
|
||||
? prop('sig', await ext.signEvent(event))
|
||||
: signEvent(event, get(privkey))
|
||||
|
||||
return event
|
||||
@ -73,9 +63,6 @@ const getCrypt = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// Init signing function by re-setting pubkey
|
||||
setPublicKey(get(pubkey))
|
||||
|
||||
export default {
|
||||
pubkey, privkey, canSign, setPrivateKey, setPublicKey, clear,
|
||||
sign, getCrypt,
|
||||
|
@ -1,5 +1,6 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import {prop, reject, sortBy, last} from 'ramda'
|
||||
import {onMount} from 'svelte'
|
||||
import {ensurePlural} from 'hurdak/lib/hurdak'
|
||||
import {fly} from 'svelte/transition'
|
||||
import {fuzzy} from "src/util/misc"
|
||||
@ -183,6 +184,22 @@
|
||||
mentions: validMentions.map(prop('pubkey')),
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
input.addEventListener('paste', e => {
|
||||
e.preventDefault()
|
||||
|
||||
const clipboardData = e.clipboardData || (window as any).clipboardData
|
||||
const text = clipboardData.getData('text')
|
||||
const selection = window.getSelection()
|
||||
|
||||
if (selection.rangeCount) {
|
||||
selection.deleteFromDocument()
|
||||
selection.getRangeAt(0).insertNode(document.createTextNode(text))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<div class="flex">
|
||||
|
Loading…
Reference in New Issue
Block a user