typed elem so that it returns the exact type of the HTMLElement,
and that name must be a key of HTMLElementTagNameMap.
example:
elem('form'); // returns HTMLFormElement
elem('abc'); // not assignable to parameter of type 'keyof HTMLElementTagNameMap'
convert pubkey to npub and event id to note and store for
later. use npub and note for uri's so that we dont need to
guess what the view of a specific uri has to render.
this is only the first step that changes uri's, next step is
for the view to react to npub or note and render the
correct view accordingly.
move and typed relay related code to relays.ts
upgrade nostr-tools to latest greatest, major version with
breaking changes:
- relayPool is gone in favor of SimplePool, but this commit just
used relayInit directly as relays should become configurable at
some point
proof of concept to use generic view containers instead of specifc
functions to show and hide particular views.
a view has an identifier (path) which is used to subscribe to
relevant data. changing a view updates the history so that browser
back displays the last view. each view container has its own
scrollbar so that the scrolling position should be preserved when
changing back and forth between different views.
this change also removes CSS tabs in favor of view or overlays
such settings or write a new text note.
profile and notes deeplink use now native HTML anchors to improve
accessibility (copy/paste, open-in-new-tab, search engines).
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
relay.snort.social seems to be a popular relay, adding a new one
to the hardcoded list of relays, this should be configurable in
the future.
related damus relay is often not responding or slow, but keeping
it for now.
replies were not sorted correctly, reason for this was that an
array of dom elements was sorted, but instead it should sort the
notes.
regression introduced in:
- 2e40a273c4
a fast relay might return a newly published note within the same
second, but nostrweb only shows notes that are older than now.
was introduced in 4a68940681
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
before this change every new incoming text note called a render,
that filters, sorts and iterates all known text notes and creates
missing dom elements and appends into the right place.
this change throttles and debounces (both!) the render function,
that less checks have to be performed, especially on page load
when potentially 100s of events arrive within a short time.
it is important to throttle and debounce, else either the last call
is missed or no render is called while events are being received.
this change surfaced an error in recommend server that depended on
all known text notes already being rendered and inside the dom.
this function should probably be handled by render feed itself.
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
some replies rendered twice in different positions, seems to be
related to deprecated positional event tags and a regression
introduced in a596121821
on receiving events it analizes the event tags and stores the id
of the replied event so the client can easily search for replies
later. marked tags are prefered with a fallback to positional tags
as described in nip-10.
mentions are ignored at the moment.
example event that had some replies rendered twice:
22e4ea80161ac591059da611d3ab63c583cb1d47a706826db2fc6955ac0a70b5
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
before it was only testing if the nonce commitment is high enough
but didn't verify leading zero bits.
with this change rendering checks now the leading zero bits count
of the event id.
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
some notes have a created at field that is 1 year in the future,
these are always shown on to of the feed. changed to only render
notes that are from the past.
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
added a slider to adjust the difficulty filter, current default is
0 so all notes are rendered. increasing the filter will hide notes
with lower difficulty target.
changed the max difficulty from 256 to 32 for now so that the
range slider is usable.
this does not yet hide reactions with lower difficulty.
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
mining often takes a few seconds. it can be confusing if nothing
happens when a user is publishing their profile, upvoting a note
or posting a new note.
added visual feedback that nostrweb is working with an option to
cancel the mining process.
adding settings to change mining difficulty and timeout, so users
can change or disable pow. also added some explanation and link
to nip-13.
setting arbitrary low default to 16 zero mining difficulty and
5 seconds timeout.
now that nonce tag is always the first element in the tags list,
a bug surfaced that replies from nostrweb did not render anymore.
reason was that the code expected the first tag to be an e tag and
took its reply-id. this commit is a quick fix that takes the first
reply-id from the first e tag.
the proper way is a bit more complicated as nip-10 defines a
preferred and deprecated way.
this is a quick and dirty fix so that replies work with nip-13 pow
events, but nip-10 event tags should be properly supported but in
a later commit.
mining may take a long time if the mining difficulty is high.
calculating pow for text notes, upvotes and profile meta
data now has a timeout of 10s. if the timeout exceeds a user
facing error is shown with the option to try again.
the error is currently very basic, and only displays timeout -
something went wrong, cancel and try again button.
added pow to text notes, reactions and metadata events. pow is
mined async in a worker so that the main process does not freeze.
noxy profile images, link and image previews are now now only
invoked if an event has some valid work proof. noxy can decide
if there is enough work and whether or not to serve data for a
certain event.
target difficulty can be implemented in a later step, this change
only check if there is any valid nonce tag with commitment target
greater than 0.
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
the actual event that is being reacted must be the last event tag,
was wrongly using the first one and displayed wrong star if tags
had more than 1 event tag.
upvoting now also includes e and p tags from the event that is
upvoted.
see also https://github.com/nostr-protocol/nips/blob/master/25.md
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
adding damus again (was disabled when it was down and heavy spam
happened last year), remove nostr.sandwich.farm as it currently
errors with '502 Bad Gateway'.
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
Added deeplinks with browser history support. Each note and author
have now a detail view under nostr.ch/<event-id-or-pubkey> in a
future commit also /e/<event-id> and /p/<pubkey> could be supported.
User can now navigate with browser back (with the expection of the
settings overlay).
Not everything is supported in the detail view (yet) i.e reply and
stars are partially working (dont update visually), leaving this as
open bug. This should fix itself once only 1 render container is
used instead of different divs in the html for each view.
Ideally the detail view should also query for related events,
something to add in a future commit
Notes often miss name or picture of authors if the note was
rendered before any metadata (kind 0) has been recieved.
Update name and picture of existing notes. Pictures are only
updated if a valid url.
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
this is another relay, so we have two to play with. this one is running
on the same machine where live nostrweb is hosted at.
at the moment, relay is running nostr-rs-relay v0.7.2:
$ curl -H 'accept: application/nostr+json' https://relay.nostr.ch/
{
"id": "wss://relay.nostr.ch/",
"name": "a nostr relay",
"description": "just another nostr relay",
"supported_nips": [
1,
2,
9,
11,
12,
15,
16,
20,
22,
26
],
"software": "https://git.sr.ht/~gheartsfield/nostr-rs-relay",
"version": "0.7.2"
}
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
Metadata can contain empty fields or broken images. Improved
rendering of meta preview links with missing info, also added a
subtile transparent dark background color to preview images, as
some images contain white text on transparent background and are
invisible in light mode.
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
Instead of just blindly fetch noxy requests, this adds a simple
fetch queue and waits until the pending response is done. It
continues with the next one in the queue whichever seen first,
This is not in chronological order, but incoming event order
(incoming events from different relays are probably out of order).
Only for browsers that support loading=lazy attribute, but this
should reduce the load on noxy and only fetch images that are
relevant (in the viewport of close to it).
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
The pubkey should not always be regenerated when a privatekey is
pasted. The reason is that on paste event is fired before the
privateKeyInput value is updated.
Added code comments on when the condition passes and should be save
to re-generate the pubkey.
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
If the user pastes a private-key and the pubkey field is empty,
it should be ok to generate and autofill the pubkey without
confusing the user. There might be circumstances where it is
preferred to see an error if the pubkey does not correspond with
the private key.
Added an on paste event listener that tries to generate and auto-
fill the pubkey (if empty).
Also disabled autocomplete on the settings form to indicate to not
save the key in password manager.
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
Links should be rendered as anchors so that they are clickable.
For now only links starting with http:// https:// or www. are
supported.
Temporary disabled text notes shortening.
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
Move canvas placeholder image to getMetadata so that the logic is
in one place. Also added an exception for pubkeys starting with
at least 6 zeros to invert the color.
ci/woodpecker/pr/woodpecker Pipeline was successfulDetails
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
This is an approach to close the reply-to-form automatically when
focus is lost and only if the input is empty. A second way to close
the reply-to-form is provided by toggling the reply icon.
Text notes longer than 280 are shortened and appended with '…' to
indicate that this note can be expanded, but this dotdotdot was
real text and was not removed once the note is expanded.
Changed to showing the dots through CSS and only if the attribute
exists, so it does not show on expanded notes.