MRF.InlineQuotePolicy: Add link to post URL, not ID #733

Merged
floatingghost merged 1 commits from erincandescent/akkoma:quote-url into develop 2024-04-12 17:02:53 +00:00
Contributor

"id" is used for the canonical link to the AS2 representation of an object. "url" is typically used for the canonical link to the HTTP representation. It is what we use, for example, when following the "external source" link in the frontend. However, it's not the link we include in the post contents for quote posts.

Using URL instead means we include a more user-friendly URL for Mastodon, and a working (in the browser) URL for Threads

"id" is used for the canonical link to the AS2 representation of an object. "url" is typically used for the canonical link to the HTTP representation. It is what we use, for example, when following the "external source" link in the frontend. However, it's not the link we include in the post contents for quote posts. Using URL instead means we include a more user-friendly URL for Mastodon, and a working (in the browser) URL for Threads
erincandescent added 1 commit 2024-04-02 22:43:16 +00:00
ci/woodpecker/pr/build-amd64 Pipeline is pending Details
ci/woodpecker/pr/build-arm64 Pipeline is pending Details
ci/woodpecker/pr/docs Pipeline is pending Details
ci/woodpecker/pr/lint Pipeline is pending Details
ci/woodpecker/pr/test Pipeline is pending Details
ae9f51a0c8
MRF.InlineQuotePolicy: Add link to post URL, not ID
"id" is used for the canonical link to the AS2 representation of an object.
"url" is typically used for the canonical link to the HTTP representation.
It is what we use, for example, when following the "external source" link
in the frontend. However, it's not the link we include in the post contents
for quote posts.

Using URL instead means we include a more user-friendly URL for Mastodon,
and a working (in the browser) URL for Threads
Author
Contributor

I'm pretty ambivalent about Threads related interoperability fixes, but if we're gonna be subjected to quotes of threads'ers then at least the link should work

I'm pretty ambivalent about Threads related interoperability fixes, but if we're gonna be subjected to quotes of threads'ers then at least the link should work
Oneric reviewed 2024-04-02 22:56:56 +00:00
@ -34,3 +48,3 @@
String.trim_trailing(content, "</p>") <> build_inline_quote(prefix, quote_url) <> "</p>"
String.trim_trailing(content, "</p>") <> build_inline_quote(prefix, preferred_url) <> "</p>"
else
content <> build_inline_quote(prefix, quote_url)
Member

ig this should also switch to preferred_url instead of quote_url?

ig this should also switch to `preferred_url` instead of `quote_url`?
Author
Contributor

Good catch!

Good catch!
erincandescent marked this conversation as resolved
erincandescent force-pushed quote-url from ae9f51a0c8 to 6f521fd9bf 2024-04-02 23:38:16 +00:00 Compare

commits look good, but there's a lint issue - any chance you could mix format this? thankies

commits look good, but there's a lint issue - any chance you could `mix format` this? thankies
erincandescent force-pushed quote-url from 6f521fd9bf to b675b47c53 2024-04-11 19:08:19 +00:00 Compare
Author
Contributor

Oops, fixed

Oops, fixed

hm, tests indicate that this introduces a recursion issue when fetching quotes

i shall look into it

hm, tests indicate that this introduces a recursion issue when fetching quotes i shall look into it
floatingghost requested changes 2024-04-11 20:53:25 +00:00
floatingghost left a comment
Owner

i'm not sure the best path to resolving this right now - i'm about 80% sure that quotes would have been fetched already, so refetching them here shouldn't be required, but i'd have to double-check the pipeline on that to confirm

i'm not sure the best path to resolving this right now - i'm about 80% sure that quotes would have been fetched already, so refetching them here shouldn't be required, but i'd have to double-check the pipeline on that to confirm
@ -12,2 +14,3 @@
defp has_inline_quote?(content, quote_url) do
defp resolve_urls(quote_url) do
with %Object{} = obj <- Object.normalize(quote_url, fetch: true) do

the issue is the fetch: true you've added

we've got a test to check for handling self-referential quotes (as naturally it'd be a DoS vector) - having this fetch: true here makes that fail

the issue is the `fetch: true` you've added we've got a test to check for handling self-referential quotes (as naturally it'd be a DoS vector) - having this `fetch: true` here makes that fail

for reference, why this happens:

we try to fetch a quote

pipeline

It goes through the inbound AP pipeline

which puts it through this (as it is enabled by default)

quote URL is detected, let's fetch it (because fetch is true here)

GOTO pipeline

for reference, why this happens: we try to fetch a quote pipeline It goes through the inbound AP pipeline which puts it through this (as it is enabled by default) quote URL is detected, let's fetch it (because fetch is true here) GOTO pipeline
Author
Contributor

I wonder if we could just run this for outbound messages? I will have to take a look at precisely how MRFs are run to see if thats a feasible option

I wonder if we could just run this for outbound messages? I will have to take a look at precisely how MRFs are run to see if thats a feasible option
Author
Contributor

You know what, I'm tempted to just change it to fetch: false. Its gotta be astoundingly rare for someone to be quoting a post the server doesn't know about

You know what, I'm tempted to just change it to `fetch: false`. Its gotta be astoundingly rare for someone to be quoting a post the server doesn't know about
erincandescent force-pushed quote-url from b675b47c53 to 75d9e2b375 2024-04-12 11:24:03 +00:00 Compare
Author
Contributor

OK, I made it not fetch. If the object isn't fetched (exceptional case!) we'll fall back to the old behaviour, which was fine.

OK, I made it not fetch. If the object isn't fetched (exceptional case!) we'll fall back to the old behaviour, which was fine.

all good now, thanks for fixing it~

all good now, thanks for fixing it~
floatingghost merged commit 8e60177466 into develop 2024-04-12 17:02:53 +00:00
floatingghost deleted branch quote-url 2024-04-12 17:02:53 +00:00
Sign in to join this conversation.
No description provided.