gotosocial icon indicating copy to clipboard operation
gotosocial copied to clipboard

[bug] Cannot use Mastodon web redirect to follow account

Open ljcucc opened this issue 2 years ago • 6 comments

Describe the bug with a clear and concise description of what the bug is.

Unable to follow when I trying to follow account on mastodon, similar to #538

Screen Shot 2022-10-25 at 1 08 47 AM

What's your GoToSocial Version?

0.5.2

GoToSocial Arch

armv7

Browser version

Safari Version 16.0 (17614.1.25.9.10, 17614)

What happened?

Unable to follow when I trying to follow account on mastodon, similar to #538

What you expected to happen?

Follow to account by the redirection feature of mastodon.

How to reproduce it?

  1. Goto https://merveilles.town/@neauoire/with_replies
  2. click follow, enter the [username]@[url]
  3. got the error

Anything else we need to know?

while requesting following from mastodon instance, I'll get a log:

timestamp="25/10/2022 01:18:09.502" func=router.loggingMiddleware.func1 level=INFO latency=30.70507ms clientIP=::1 userAgent="http.rb/5.0.4 (Mastodon/1.0.6+3.5.2; +https://merveilles.town/)" method=GET statusCode=200 path=/.well-known/webfinger msg="OK: wrote 190B"

while making a follow to remote account (which is me), I'll got this error on peertube:

Error: No subscribe template in webfinger response

ljcucc avatar Oct 24 '22 17:10 ljcucc

Heya! We don't currently implement this redirect behavior (haven't looked into it yet). Is it OK with you if I edit the title of this issue? To make it a bit clearer I'd change it to something like '[bug] Cannot use Mastodon web redirect to follow account'.

tsmethurst avatar Oct 25 '22 09:10 tsmethurst

Would love to see this feature (mostly for my own convenience, but also for some users on my GTS), any place where we can put money on the table for said feature in GTS?

egon0 avatar Oct 31 '22 10:10 egon0

I thought this would be an easy feature to add as my first attempt at hacking on GtS... I was wrong. :(

Forgive me if any of this is already known, mainly documenting it on the off chance I get back to this before someone else does, but my Go is pretty weak and my JS skills are effectively nonexistent. The first missing piece is indeed webfinger, specifically another entry in links. You can clear the first hurdle with this addition to the links list in GetWebfingerAccount in internal/processing/federation/getwebfinger.go:

			{
				Rel:  "http://ostatus.org/schema/1.0/subscribe",
				Template: "https://somesite.example/lol-i-broke-it?uri={uri}",
			},

The URL can be anything, Mastodon instances use /authorize_interaction but chaos.social accepted my hard-coded example above just fine.

Building this results in a server where you can click the button to follow someone from their instance, put your account in, and get redirected to the URL which 404s. This is where I run out of steam, because GtS is deliberately light on the web UI and I'm not skilled enough to add it. I think it just needs to check for auth, make a request to the remote profile URL (the one passed as the uri argument) to get the ID, show a confirmation, then send a request to the API to follow the given ID, but all that's beyond me for now.

fwaggle avatar Nov 02 '22 08:11 fwaggle

Heya, thanks for looking into it! IIRC Mastodon itself is deprecating this feature soon, and since it's not trivial to implement, it might not be worth putting more time into it now :thinking: Not sure, what do you think?

tsmethurst avatar Nov 03 '22 13:11 tsmethurst

I'm not sure on that to be honest, I'm hardly an expert. I did take a quick (on my lunch break) look through Mastodon's issues tracker and didn't see any mention of it, and there are a few tickets about improving the flow of following folks on other instances, and none of them mention that the feature would be deprecated anyway.

The part that gives me pause is that GtS deliberately avoids having a client built-in, and it seems (to me, but again, not an expert) like this is more functionality that belongs to a client than the server. If Mastodon and other software implement web protocols or similar, then it makes more sense to have that implemented on your chosen client... eg you're using Pinafore, so it's registered as a handler for mastodon-follow:// or whatever, you click the link, Pinafore pops up and does the follow for you? But without other fediverse software implementing (and agreeing upon) web protocols it's of no help.

fwaggle avatar Nov 04 '22 01:11 fwaggle

@tsmethurst you were right by the way! I set up another instance that's on Mastodon proper, and on the 4.0.0 release candidates, this feature is gone in favour of "click here to copy this user's URL and paste it into the search box on your instance". It's the same way in glitch-soc, not sure if they intend on putting it back or not... but if not it doesn't seem like implementing this feature would be terribly helpful, most folks will jump to 4.0 very fast because of the edit feature I think?

fwaggle avatar Nov 11 '22 09:11 fwaggle

I'm gonna close this since it doesn't look likely that we'll implement it. But we can always reopen it if something changes :)

tsmethurst avatar Dec 05 '22 10:12 tsmethurst