Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridgy Fed webmentions not working #8

Closed
srijan opened this issue Oct 26, 2023 · 8 comments
Closed

Bridgy Fed webmentions not working #8

srijan opened this issue Oct 26, 2023 · 8 comments

Comments

@srijan
Copy link

srijan commented Oct 26, 2023

Hi. I set this up, and looks like webmentions from mastodon via fed.brid.gy are not working.

I got this error:

AH01071: Got error 'PHP message: Whoops\Exception\ErrorException: Attempt to read property "properties" on null in /var/www/html/site/plugins/indieconnector/utils/receiver.php:94
Stack trace:
#0 /var/www/html/site/plugins/indieconnector/utils/receiver.php(94): Whoops\Run->handleError()
#1 /var/www/html/site/plugins/indieconnector/index.php(56): mauricerenck\IndieConnector\WebmentionReceiver->getTransformedSourceUrl()
#2 [internal function]: Kirby\Http\Route->mauricerenck\IndieConnector\{closure}()
#3 /var/www/html/vendor/getkirby/cms/src/Http/Router.php(120): Closure->call()
#4 /var/www/html/vendor/getkirby/cms/src/Cms/App.php(340): Kirby\Http\Router->call()
#5 /var/www/html/vendor/getkirby/cms/src/Cms/App.php(1239): Kirby\Cms\App->call()
#6 /var/www/html/public/index.php(18): Kirby\Cms\App->render()
#7 {main}'

Looking into receiver.php's getTransformedSourceUrl function, the custom handling for bridgy might not be required.

If I remove the if block if (strpos($url, 'brid.gy') !== false), then it works fine.

Do you remember the original reason for this if condition? Should I raise a PR to remove it?

@mauricerenck
Copy link
Owner

Hi,

this extra round is an attempt to get the author url not the source url of the mastodon post. Adding the ?format.json returns some details of the mastodon post, including all the urls. That's why I do that.

Please do the following:

  1. go to webmention.io and chose a mastodon webmention from the dashboard
  2. copy the bridgy url and append the ?format=json
  3. check the json result (or post it here)

it should look something like this:

{
  "properties": {
    "author": [
      {
        "properties": {
          "name": [
            "XYZ"
          ],
          "nickname": [
            "XYZ"
          ],
          "numeric-id": [
            "12345667889"
          ],
          "photo": [
            "https://files.mastodon.online/cache/accounts/avatars/109/313/671/852/657/869/original/XYZ.png"
          ],
          "published": [
            "2022-11-09T00:00:00+00:00"
          ],
          "uid": [
            "tag:norden.social,2013:XYZ"
          ],
          "url": [
            "https://norden.social/@XYZ",
            "https://XYZ.de"
          ]
        },
        "type": [
          "h-card"
        ]
      }
    ],
    "like-of": [
      "https://mastodon.online/@mauricerenck/111279092881044988",
      "https://maurice-renck.de/de/blog/2023/kw42"
    ],
    "uid": [
      "tag:mastodon.online,2013:111279092881044988_favorited_by_112345678999"
    ],
    "url": [
      "https://mastodon.online/@mauricerenck/111279092881044988#favorited-by-12344567890"
    ]
  },
  "type": [
    "h-entry"
  ]
}

It seems like you don't get such a result.
I will add better error handling for that case, but it is good to know, why you don't get a result.

@srijan
Copy link
Author

srijan commented Oct 29, 2023

The URL I got was https://ap.brid.gy/convert/web/https:/mas.to/users/srijan/statuses/111300574765321090/activity , and even with ?format=json, it returns html, not json.

$ curl -L "https://ap.brid.gy/convert/web/https:/mas.to/users/srijan/statuses/111300574765321090/activity?format.json"
<!DOCTYPE html>
<html>
<head><meta charset="utf-8">
<meta http-equiv="refresh" content="0;url=https://mas.to/@srijan/111300574765321090"></head>
<body class="">

<article class="h-entry">
  <span class="p-uid">https://mas.to/users/srijan/statuses/111300574765321090</span>

  <time class="dt-published" datetime="2023-10-26T09:19:52+00:00">2023-10-26T09:19:52+00:00</time>

  <span class="p-author h-card">
    <data class="p-uid" value="https://mas.to/users/srijan"></data>
    <a class="p-name u-url" href="https://mas.to/@srijan">Srijan Choudhary</a>
    <span class="p-nickname">srijan</span>
    <img class="u-photo" src="https://media.mas.to/masto-public/accounts/avatars/111/276/301/174/418/921/original/100dad9f447a27a3.jpeg" alt="" />
  </span>

  <a title="mas.to/@srijan/111300574765321090" class="u-url" href="https://mas.to/@srijan/111300574765321090">mas.to/@srijan/111300...</a>
  <div class="e-content p-name">

  <p>Reply without a @ mention maybe...</p>
  </div>





  <a class="u-in-reply-to" href="https://srijan.ch/notes/2023-10-26-001"></a>


</article>

</body>
</html>

The links in the docs here: https://brid.gy/about#source-urls are of the format: https://brid.gy/comment/SITE/USER_ID/POST_ID/COMMENT_ID etc..

But the link I got from webmention.io was of the form https://ap.brid.gy/convert/web/ORIGINAL_URL.

So maybe that's the gap.

Also pinging @snarfed for any pointers.

@snarfed
Copy link

snarfed commented Oct 29, 2023

Hi all!

It looks like the main point of confusion here is that @mauricerenck is talking about Bridgy classic (https://brid.gy/), while @srijan is trying to debug a webmention from Bridgy Fed (https://fed.brid.gy/). Different services. Sorry for the similar naming!

@snarfed
Copy link

snarfed commented Oct 29, 2023

(@srijan, you were looking at Bridgy classic docs. Bridgy Fed docs are https://fed.brid.gy/docs . It doesn't support ?format=json, but you can get that format by parsing the HTML with any microformats2 parser, or an online service like https://pin13.net/mf2/ or https://python.microformats.io/ )

@srijan
Copy link
Author

srijan commented Oct 29, 2023

@snarfed - yeah, that's what I guessed.

@mauricerenck - Moreover, it looks like for Bridgy Fed, at least, we don't need the extra round for the author URL because the author URL coming in the webmention is correct (at least it was for me).

I think the workaround was added at a point when webmention.io was not parsing the author URL correctly from bridgy, but now it seems to be correct.

@srijan
Copy link
Author

srijan commented Oct 29, 2023

Also, Bridgy fed webmentions were affected because the additional check uses this condition:

if (strpos($url, 'brid.gy') !== false)

which matches the Bridgy fed URLs as well.

@mauricerenck
Copy link
Owner

Thank you both for clarification, I only realized the difference when you posted the response.

I guess the best thing for now is to remove that part so it works for everyone and maybe add a better solution if this might still be needed for bridgy classic.

mauricerenck added a commit that referenced this issue Oct 29, 2023
the bridgy json request does not work with bridgy fed see issue  #8
github-actions bot pushed a commit that referenced this issue Oct 29, 2023
## [1.8.2](v1.8.1...v1.8.2) (2023-10-29)

### Bug Fixes

* remove bridgy json request ([dbc7a5a](dbc7a5a)), closes [#8](#8)
@srijan
Copy link
Author

srijan commented Oct 30, 2023

It works now. Thanks :)

@srijan srijan closed this as completed Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants