this post was submitted on 12 Sep 2022
14 points (100.0% liked)

Lemmy Support

4718 readers
14 users here now

Support / questions about Lemmy.

Matrix Space: #lemmy-space

founded 5 years ago
MODERATORS
 

I'm not 100% certain that's the cause, but my testing so far suggests it's probably that. Basically if you have a URL that doesn't point to the original resource, but some copy of it on another instance, it won't resolve. So far I've only tested that on a third instance, but from my experience with the same bug on pleroma, this will occur even if you do it on the resource's origin instance. (fse post referred to from poa.st can't be resolved on fse.) As example: https://lemmy.perthchat.org/api/v3/resolve_object?q=https://lemmy.ml/post/472799. It's possible that this is actually just a federation block, but https://beehaw.org/post/125367/comment/32382 also fails, (and fetching that post works,) which I'm pretty sure isn't.

top 14 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 2 years ago (1 children)

If you are writing a client, there is really no reason to browse instances using browser/lemmy-ui. Instead you can directly connect with your client to the api of any instance. Then when you want to interact with any object (eg vote, write a post, subscribe), you take the value of ap_id field (on post, comment) or actor_id field (user, community, site), and pass that to resolve_object.

What resolve_object does is essentially the command below, and then transform the data to store it in Lemmy db. Note that each fetchable object has an id, and that is where you can resolve it.

curl -H 'Accept: application/activity+json' https://lemmy.ml/post/472799 | jq

https://lemmy.perthchat.org/api/v3/resolve_object?q=https://lemmy.ml/post/472799

This fails because it was posted on lemmygrad.ml, which is blocked on perthchat.

To fetch comments, the url should look like this: https://sopuli.xyz/comment/104283

[–] [email protected] 2 points 2 years ago (1 children)

Oh, title got munched, heh. I'll fix that... So basically you're saying that before resolve_object I should transform it on given instance and load from there, pull ap_id from it and then resolve on that. How annoying, now I have to figure out if I can easily and reliably transform any valid lemmy URL to an API link. Probably yes, regex something like https://[a-zA-Z0-9\.\-\_]+/(.*/?)\w+/\d+ and replace the capture with api/v3. So much for simplicity.

[–] [email protected] 0 points 2 years ago (1 children)

That sounds overly complicated. Why do you open Lemmy in your browser, when you can directly connect with your client to the API of any instance?

And if you do use the browser, theres the fedilink icon which has the link you need. If that isnt rendered properly in your browser, send me the details and i can open an issue for you.

[–] [email protected] 2 points 2 years ago (2 children)

Why do you open Lemmy in your browser I don't.

you can directly connect with your client to the API of any instance The complexity is necessary for this. When given a link, I need to translate it into an API link so I can load the object and grab the ap_id.

If that isnt rendered properly in your browser Lynx. I've detailed the problem in the matrix room, basically for some reason it's in a title element so lynx correctly sets the page title to "fedilink" 100 times.

[–] [email protected] 1 points 2 years ago

Thinking about this more, I realised it's impossible: The link might not even be a lemmy link at all! How am I meant to guess the other node's API? I'd use federation API, I guess, which I still haven't found nice docs for.

[–] [email protected] 1 points 2 years ago (1 children)

You are wrong, it uses the title attribute which is valid html, and not the title element. Maybe Lynx doesnt support that attribute on a elements, I dont know.

Btw you need to add a newline after each quote so that its rendered correctly as markdown.

[–] [email protected] 1 points 2 years ago (1 children)

yun-wuxin:[wisknort]:~$ curl https://beehaw.org/post/125367/comment/32382 -s | grep -Eo '.{10}fedilink.{10}' id="icon-fedilink" viewBox= ef="#icon-fedilink"><d y">fedilink</

Do you mean a blank line? Because I added newlines. Frankly I consider this to be markdown's fault, because the behaviour is, put simply, removed. If I want to quote two lines, I will quote two lines. (Worse is the part where a single newline is ignored, but two newlines is two newlines. I just want one newline, thanks.)

[–] [email protected] 1 points 2 years ago (1 children)

Hmm i was inspecting the HTML in Firefox, but if i curl the source and look at it directly, it looks quite different, with a <title> element in the <body> as you say. @[email protected] can you look into this?

[–] [email protected] 1 points 2 years ago (1 children)

@[email protected] open up an issue on the github because its not clear to me what you're trying to do.

[–] [email protected] 1 points 2 years ago (1 children)

He browses lemmy-ui in Lynx, and it doesnt render the fedilink icon correctly because of that invalid tag. Also doesnt use github.

[–] [email protected] 1 points 2 years ago (1 children)

The title tag is correct, its for screen reader support for icons.

[–] [email protected] 1 points 2 years ago (1 children)
[–] [email protected] 1 points 2 years ago (1 children)
[–] [email protected] 1 points 2 years ago

Pretty much all the comments there are pointing out that it's not a good idea.