snarfed / bridgy-fed

🌉 A bridge between decentralized social network protocols
https://fed.brid.gy/
Creative Commons Zero v1.0 Universal
486 stars 28 forks source link

ActivityPub: use Webfinger `subject` to support Mastodon split domain aka WEB_DOMAIN #1031

Open trbutler opened 1 month ago

trbutler commented 1 month ago

My Mastodon instance has a LOCAL_DOMAIN of "faithtree.social" and WEB_DOMAIN of "mastodon.faithtree.social." So, while it is accessed on the web at "mastodon.faithtree.social," the proper Fediverse identifier is "@trbutler@faithtree.social" (for example) not "@trbutler@mastodon.faithtree.social." However, when Bridgy bridges to Bluesky, the account adopts the WEB_DOMAIN, rendering it "@trbutler.mastodon.faithtree.social.ap.brid.gy" instead of the proper to the canonical handle "@trbutler.faithtree.social.ap.brid.gy."

Near as I can tell, web finger is properly configured.

Thanks for your help!

snarfed commented 1 month ago

Thanks for filing! Related: https://github.com/snarfed/bridgy/issues/1638

This is an interesting one. Bridgy Fed doesn't start from Webfinger, it starts from AP actor id URLs. Yours is https://mastodon.faithtree.social/users/trbutler . Nothing in your AP actor that I can see says to use faithtree.social instead of mastodon.faithtree.social. Looking at your Webfinger, the only thing I see is "subject": "acct:trbutler@faithtree.social", which I don't currently look at, but definitely could!

Your AP actor (pruned down a bit):

{
   "alsoKnownAs" : [
      "https://mastodon.cloud/users/Trbutler"
   ],
   "attachment" : ["..."],
   "devices" : "https://mastodon.faithtree.social/users/trbutler/collections/devices",
   "discoverable" : true,
   "endpoints" : {
      "sharedInbox" : "https://mastodon.faithtree.social/inbox"
   },
   "featured" : "https://mastodon.faithtree.social/users/trbutler/collections/featured",
   "featuredTags" : "https://mastodon.faithtree.social/users/trbutler/collections/tags",
   "followers" : "https://mastodon.faithtree.social/users/trbutler/followers",
   "following" : "https://mastodon.faithtree.social/users/trbutler/following",
   "icon" : {
      "mediaType" : "image/jpeg",
      "type" : "Image",
      "url" : "https://files.faithtree.social/accounts/avatars/109/762/503/392/984/571/original/3f58a809494a1dc3.jpg"
   },
   "id" : "https://mastodon.faithtree.social/users/trbutler",
   "image" : {
      "mediaType" : "image/jpeg",
      "type" : "Image",
      "url" : "https://files.faithtree.social/accounts/headers/109/762/503/392/984/571/original/0cefaf1528f2be20.jpg"
   },
   "inbox" : "https://mastodon.faithtree.social/users/trbutler/inbox",
   "indexable" : true,
   "manuallyApprovesFollowers" : false,
   "memorial" : false,
   "name" : "Timothy R. Butler",
   "outbox" : "https://mastodon.faithtree.social/users/trbutler/outbox",
   "preferredUsername" : "trbutler",
   "publicKey" : "...",
   "published" : "2023-01-27T00:00:00Z",
   "summary" : "<p>Pastor, <span class=\"h-card\" translate=\"no\"><a href=\"https://mastodon.faithtree.social/@littlehillschurch\" class=\"u-url mention\">@<span>littlehillschurch</span></a></span> and <span class=\"h-card\" translate=\"no\"><a href=\"https://mastodon.faithtree.social/@faithtreecf\" class=\"u-url mention\">@<span>faithtreecf</span></a></span> (outreach ministry). Editor, <span class=\"h-card\" translate=\"no\"><a href=\"https://mastodon.faithtree.social/@ofb\" class=\"u-url mention\">@<span>ofb</span></a></span>. Shakespeare lover, Apple/*nix geek in <a href=\"https://mastodon.faithtree.social/tags/StLouis\" class=\"mention hashtag\" rel=\"tag\">#<span>StLouis</span></a> <a href=\"https://mastodon.faithtree.social/tags/Missouri\" class=\"mention hashtag\" rel=\"tag\">#<span>Missouri</span></a>.</p><p><a href=\"https://mastodon.faithtree.social/tags/Christian\" class=\"mention hashtag\" rel=\"tag\">#<span>Christian</span></a> <a href=\"https://mastodon.faithtree.social/tags/ChurchHistory\" class=\"mention hashtag\" rel=\"tag\">#<span>ChurchHistory</span></a> <a href=\"https://mastodon.faithtree.social/tags/Reformed\" class=\"mention hashtag\" rel=\"tag\">#<span>Reformed</span></a> <a href=\"https://mastodon.faithtree.social/tags/Theology\" class=\"mention hashtag\" rel=\"tag\">#<span>Theology</span></a> <a href=\"https://mastodon.faithtree.social/tags/Aquinas\" class=\"mention hashtag\" rel=\"tag\">#<span>Aquinas</span></a> <a href=\"https://mastodon.faithtree.social/tags/Shakespeare\" class=\"mention hashtag\" rel=\"tag\">#<span>Shakespeare</span></a> <a href=\"https://mastodon.faithtree.social/tags/Photography\" class=\"mention hashtag\" rel=\"tag\">#<span>Photography</span></a> <a href=\"https://mastodon.faithtree.social/tags/Technology\" class=\"mention hashtag\" rel=\"tag\">#<span>Technology</span></a> <a href=\"https://mastodon.faithtree.social/tags/Apple\" class=\"mention hashtag\" rel=\"tag\">#<span>Apple</span></a> <a href=\"https://mastodon.faithtree.social/tags/Linux\" class=\"mention hashtag\" rel=\"tag\">#<span>Linux</span></a> <a href=\"https://mastodon.faithtree.social/tags/Perl\" class=\"mention hashtag\" rel=\"tag\">#<span>Perl</span></a> </p><p>Tags for Fediverse tools: <a href=\"https://mastodon.faithtree.social/tags/Searchable\" class=\"mention hashtag\" rel=\"tag\">#<span>Searchable</span></a> <a href=\"https://mastodon.faithtree.social/tags/fedi22\" class=\"mention hashtag\" rel=\"tag\">#<span>fedi22</span></a></p>",
   "tag" : [],
   "type" : "Person",
   "url" : "https://mastodon.faithtree.social/@trbutler"
}

Your Webfinger:

{
  "subject": "acct:trbutler@faithtree.social",
  "aliases": [
    "https://mastodon.faithtree.social/@trbutler",
    "https://mastodon.faithtree.social/users/trbutler"
  ],
  "links": [
    {
      "rel": "http://webfinger.net/rel/profile-page",
      "type": "text/html",
      "href": "https://mastodon.faithtree.social/@trbutler"
    },
    {
      "rel": "self",
      "type": "application/activity+json",
      "href": "https://mastodon.faithtree.social/users/trbutler"
    },
    {
      "rel": "http://ostatus.org/schema/1.0/subscribe",
      "template": "https://mastodon.faithtree.social/authorize_interaction?uri={uri}"
    },
    {
      "rel": "http://webfinger.net/rel/avatar",
      "type": "image/jpeg",
      "href": "https://files.faithtree.social/accounts/avatars/109/762/503/392/984/571/original/3f58a809494a1dc3.jpg"
    }
  ]
}
trbutler commented 1 month ago

Interesting, thank you! I guess Mastodon only exposes the difference between LOCAL_DOMAIN and WEB_DOMAIN in Webfinger then? I actually regret splitting them, much like it sounds like the person on the other ticket you referred to, although since one is not supposed to change it after beginning usage, I'm stuck with the configuration. The tricky thing is if anyone looks on the web, it will say my user id is @trbutler@faithtree.social, so the bridge ends up being unexpectedly in a different location. Picking up support for paying attention to subject seems like it would be a wonderful help for this sort of configuration. (Short of Mastodon upstream adding an explicit reference to the account handle in the AP actor.)

qazmlp commented 1 month ago

(Short of Mastodon upstream adding an explicit reference to the account handle in the AP actor.)

There's work on that being done here, could arrive relatively shortly for certain software: https://socialhub.activitypub.rocks/t/fep-2c59-discovery-of-a-webfinger-address-from-an-activitypub-actor/3813

cooperaj commented 1 month ago

Just adding my plus one to this boat.

Would be nice if I wasn't bridged to bsky with 'social' in my handle when it's not actually my "proper" handle.