Commit Graph

108 Commits (a3de8f1595525b07f6d64041dc58e3542fab5454)

Author SHA1 Message Date
OFF0 a3de8f1595
feed: improve recommend server (kind 2) messages
- check that event.content is a valid WSS url, drop otherwise
- fix bug that rendered the same server recommendation twice
2023-01-08 16:09:35 +01:00
OFF0 2dd9cf633a
0.0.17 2023-01-07 23:28:56 +01:00
OFF0 37f0a07cf3
nip-13: show working msg and cancel btn while mining
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.
2023-01-07 23:17:26 +01:00
OFF0 898e7265c2
nip-13: add settings for mining difficulty and timeout
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.
2023-01-07 23:17:25 +01:00
OFF0 a596121821
feed: dirty fix to show replies
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.
2023-01-07 23:17:24 +01:00
OFF0 d5e9ef18c7
nip-13: add timeout and show user facing error if it exceeds
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.
2023-01-07 23:17:23 +01:00
OFF0 a1b1f3baee
nip-13: mine pow async in worker any only invoke noxy with pow
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.
2023-01-07 23:17:12 +01:00
OFF0 7edf1151a6
nip-25: use proper reacted to e and p tags
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
2023-01-06 12:53:29 +01:00
OFF0 dc2def3361
0.0.16 2023-01-04 17:43:05 +01:00
OFF0 485510314a
relays: update list of relays
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'.
2023-01-04 17:38:12 +01:00
OFF0 89c54ac08f
0.0.15 2022-12-20 23:11:37 +01:00
OFF0 387f4de3f2
content: parse lightning addresses and render as links
LN addresses use too much screen real estate, render as link seems
more useful.

lightning links are words starting with the following prefix:
lnbc for Bitcoin mainnet, lntb for testnet, lntbs for signet, and
lnbcrt for regtest

https://github.com/lightning/bolts/blob/master/11-payment-encoding.md#human-readable-part
2022-12-20 23:03:47 +01:00
OFF0 d7f75f92e0
content: exlcude links to localhost
No good reason to link to localhost.
2022-12-20 22:50:33 +01:00
OFF0 dc664fc318
content: exclude links to ip addresses
There is no good reason to link to an ip directly.

Excluding links that look like ipv4 or ipv6.
2022-12-20 22:50:16 +01:00
alex 9b11459f2d
css: temporary disable image previews until things calm down
there's too much porn spam at the moment.
revert this when we find an alternative.
2022-12-19 01:07:05 +01:00
OFF0 292ddd4052
0.0.13 2022-12-18 23:35:50 +01:00
OFF0 7cec00805e
feed: increase filter limit to 450
was accidentally lowered in cd99b5e5c1
2022-12-18 23:33:05 +01:00
OFF0 c88dfa03b9
relay: add new relays and temp disable relay.damus.io
relay.damus.io seems to be down, added a few alternatives.
2022-12-18 23:31:13 +01:00
OFF0 f26cb737a4
profile: fix old profile pic still showing
The profile image never changed until a new one is successfully
loaded. This fix clears the picture before loading a new one.
2022-12-18 23:23:37 +01:00
OFF0 136e66ee94
0.0.12 2022-12-18 23:01:10 +01:00
OFF0 cd99b5e5c1
feed: add deeplinking and browser history
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
2022-12-18 22:50:54 +01:00
OFF0 23619bbaaa
noxy: log more useful response error 2022-12-18 22:50:53 +01:00
OFF0 44c1af2381
profile: update kind 0 name and picture
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.
2022-12-18 22:50:52 +01:00
alex c0741f886f
docs: update links in the readme file
some resources are now hosted at new locations.
2022-12-18 17:51:52 +01:00
OFF0 d01a2b7f37
0.0.11 2022-12-11 16:09:38 +01:00
OFF0 b86cf6f687
pwa: add manifest and related app icons
That nostr.ch has a pretty app icon when adding to home screen.
2022-12-11 11:06:25 +01:00
alex 343413355f
pool: add relay.nostr.ch
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"
    }
2022-12-10 23:22:24 +01:00
OFF0 1d23c7098d
0.0.10 2022-12-10 16:57:21 +01:00
OFF0 e2431c7e60
profile: support kind 0 metadata events
Added simple profile form to the setting view to send kind 0
metdata such as: name, about and picture.
2022-12-10 16:56:09 +01:00
OFF0 9df0f723f2
preview: dont render empty meta fields
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.
2022-12-10 16:48:24 +01:00
OFF0 ff0ba4f6e6
preview: show the full preview image
Was set to cover, which is nice but cuts off some sides,
especially since image dimensions are not known.
2022-12-10 16:17:11 +01:00
OFF0 9f992044b2
send: update layout on mobile
On mobile the keyboard covered half of the buttons, changed form
to be aligned at the top of the screen and made textarea a bit
smaller so that the mobile keyboard and the form are both visible.
2022-12-10 16:08:42 +01:00
OFF0 edbb861bf1
send: change wording, use note instead of post
In nostr we write notes, not posts no tweets just notes.
2022-12-10 16:05:05 +01:00
OFF0 b321acde02
noxy: add simple fetch queue and wait for meta data response
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).
2022-12-10 14:11:04 +01:00
OFF0 a580bc67b2
noxy: add lazy load attribute to noxy images
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).
2022-12-10 14:11:03 +01:00
OFF0 9250ccf287
preview: fix limit width of large images 2022-12-10 14:11:02 +01:00
OFF0 2d2643c2c8
feed: display link preview with noxy
fetches the first link and shows it below a text note, all
resources are prxied through noxy.

see nostr/noxy#2
2022-12-10 14:11:00 +01:00
OFF0 0047c0bdc0
settings: document code on when exactly the pubkey is regenerated
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.
2022-12-10 14:05:46 +01:00
OFF0 d8f71b74ec
send: hide new message afer successful send
The write new text note form should be hidden after successful send.
2022-12-10 09:20:38 +01:00
alex be5e88661e
about: link to the original write up on nostr protocol
updates nostr/nostrweb#3
2022-12-09 23:28:20 +01:00
OFF0 96087dc041
feed: fix multiple upvotes (reactions)
Fixes error when upvoting already starred events.

Now the tooltip should display the reactions again.
2022-12-09 22:19:26 +01:00
OFF0 9b6f78dff1
0.0.9 2022-12-09 19:57:49 +01:00
OFF0 71945b105f
settings: pasting private key should update pubkey
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.
2022-12-09 19:49:24 +01:00
OFF0 8ec9420be8
feed: render links in text notes
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.
2022-12-09 19:42:04 +01:00
OFF0 ec9945cf05
feed: reduce newlines in text notes
This change reduces 3 or more newlines to 2 to keep the output
somewhat sane, i.e. somebody spamming newlines.
2022-12-09 19:38:12 +01:00
OFF0 9711ca2ecf feed: refactor profile image placeholder
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.
2022-12-09 10:40:13 +00:00
OFF0 d8c087bb71
about: link to and from the about page
The about page was not linked, added footer section on the settings
view to link to the about page. Also added a link from the about
page to link back to index.html.
2022-12-09 10:47:35 +01:00
alex 8f4c1c8712
docs: add a top link to the live instance
[ci skip]
2022-12-09 01:43:39 +01:00
alex e238bd9018
add an about page
this is a simple static text page showing current version from
the npm package and git commit hash at which the app was built.

it's served at /about.html but i didn't link it from the root.
not sure where the best place is.
2022-12-09 01:04:36 +01:00
OFF0 11fbc7aa7d
feed: ability to close reply form
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.
2022-12-08 22:41:02 +01:00