franzaps / zapthreads

The Unlicense
33 stars 8 forks source link

Comments do not get posted when anchors are used in the article #44

Closed bitcoin21ideas closed 6 months ago

bitcoin21ideas commented 9 months ago

If the article has subheadings and Table of Content with anchors functionality, and the reader clicks that and then writes a nostr comment, the comment does not get published.

Example: https://21ideas.org/cena/1/#есть-ли-альтернатива

Here the point in ToC was chosen and it reflects in the url as a ../#something-in-cyrillic

Seems like the change in the url overall, or the fact that there are Cyrillic characters added is the problem.

franzaps commented 6 months ago

Fixed in 0.5.1 that I just released! I'm stripping the hash now so it should be normalized and work in this kind of scenario. Try it out on https://zapthreads.dev (select 21ideas article from the dropdown)

Radiokot commented 6 months ago

Many thanks! 👏🏻

franzaps commented 6 months ago

@Radiokot @bitcoin21ideas just published 0.5.2 that should fix the issue you were having with 0.5.1 because of how I was cleaning/querying URLs

The issue however is that the relay you use (https://21ideas.nostr1.com) is buggy because it does not follow NIP-01, it fails when querying multiple r tags (which is what we do in 0.5.2 due to URL normalization).

Requests for anchor events now look like:

["REQ","sub:1",{"#r":["https://21ideas.org/lightning-wallets", "https://21ideas.org/lightning-wallets/"],"kinds":[1,8812]}]

and your relay returns zero events, it only works when asking for ONE r tag. As I said this does not follow NIP-01 and this query is fulfilled correctly by most other relays like Damus, nostr.band, etc.

That said I introduced an argument just for you guys, legacy-url. If you use it like <zap-threads legacy-url='true' ...> then it will query just the supplied URL (trailing slash or not), but I strongly encourage you to make your relay provider fix this or look for a new one that works.

Radiokot commented 6 months ago

Well noted, thank you @fr4nzap for investigating this issue and publishing the fix so quickly 🤝🏻 We'll try to get the relay fixed.