kopia lustrzana https://github.com/snarfed/bridgy-fed
webfinger: handle Bridgy Fed actor URLs
hoping to fix errors like this on Mastodon AP delivery: `Received 401: Public key not found for key https://fed.brid.gy/snarfed.org`pull/292/head
rodzic
dde86008e2
commit
f127a17fe5
|
@ -185,7 +185,8 @@ class WebfingerTest(testutil.TestCase):
|
|||
mock_get.return_value = requests_response(self.html, url='https://foo.com/')
|
||||
|
||||
for resource in ('foo.com@foo.com', 'acct:foo.com@foo.com', 'xyz@foo.com',
|
||||
'foo.com', 'http://foo.com/', 'https://foo.com/'):
|
||||
'foo.com', 'http://foo.com/', 'https://foo.com/',
|
||||
'http://localhost/foo.com'):
|
||||
url = '/.well-known/webfinger?%s' % urllib.parse.urlencode(
|
||||
{'resource': resource})
|
||||
got = self.client.get(url, headers={'Accept': 'application/json'})
|
||||
|
|
|
@ -162,6 +162,10 @@ class Webfinger(Actor):
|
|||
"""
|
||||
def template_vars(self):
|
||||
resource = flask_util.get_required_param('resource')
|
||||
|
||||
# handle Bridgy Fed actor URLs, eg https://fed.brid.gy/snarfed.org
|
||||
resource = resource.removeprefix(request.host_url)
|
||||
|
||||
try:
|
||||
user, domain = util.parse_acct_uri(resource)
|
||||
if domain in common.DOMAINS:
|
||||
|
|
Ładowanie…
Reference in New Issue