kopia lustrzana https://github.com/snarfed/bridgy-fed
rodzic
92798bc434
commit
29fb93ca92
|
@ -24,7 +24,7 @@ HEADERS = {
|
|||
'User-Agent': 'Bridgy Fed (https://fed.brid.gy/)',
|
||||
}
|
||||
XML_UTF8 = "<?xml version='1.0' encoding='UTF-8'?>\n"
|
||||
USERNAME = 'me'
|
||||
# USERNAME = 'me'
|
||||
# USERNAME_EMOJI = '🌎' # globe
|
||||
LINK_HEADER_RE = re.compile(r""" *< *([^ >]+) *> *; *rel=['"]([^'"]+)['"] *""")
|
||||
AS2_PUBLIC_AUDIENCE = 'https://www.w3.org/ns/activitystreams#Public'
|
||||
|
@ -285,9 +285,8 @@ def postprocess_as2_actor(actor):
|
|||
Args:
|
||||
actor: dict, AS2 actor object
|
||||
"""
|
||||
actor.setdefault('preferredUsername', USERNAME)
|
||||
|
||||
url = actor.get('url')
|
||||
if url:
|
||||
actor['id'] = '%s/%s' % (appengine_config.HOST_URL,
|
||||
urlparse.urlparse(url).netloc)
|
||||
domain = urlparse.urlparse(url).netloc
|
||||
actor.setdefault('preferredUsername', domain)
|
||||
actor['id'] = '%s/%s' % (appengine_config.HOST_URL, domain)
|
||||
|
|
|
@ -179,7 +179,7 @@ https://en.support.wordpress.com/site-redirect/
|
|||
<li class="answer">
|
||||
|
||||
<p>
|
||||
Federated social network identities take the form <code>@username@example.com</code>, like an email address with a leading <code>@</code>. Your site's identity via Bridgy Fed will be <code>@me@yourdomain.com</code>. Once you've <a href="#setup">set up Atom and WebSub on your site</a>, people can follow you at that address.
|
||||
Federated social network identities take the form <code>@username@example.com</code>, like an email address with a leading <code>@</code>. Your site's identity via Bridgy Fed will be <code>@yourdomain.com@yourdomain.com</code>. Once you've <a href="#setup">set up Atom and WebSub on your site</a>, people can follow you at that address.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
|
|
@ -40,7 +40,7 @@ class ActivityPubTest(testutil.TestCase):
|
|||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'type' : 'Person',
|
||||
'name': 'Mrs. ☕ Foo',
|
||||
'preferredUsername': 'me',
|
||||
'preferredUsername': 'foo.com',
|
||||
'id': 'http://localhost/foo.com',
|
||||
'url': 'https://foo.com/about-me',
|
||||
'inbox': 'http://localhost/foo.com/inbox',
|
||||
|
|
|
@ -51,7 +51,7 @@ class SalmonTest(testutil.TestCase):
|
|||
mock_post.return_value = requests_response()
|
||||
|
||||
slap = magicsigs.magic_envelope(atom_slap, common.CONTENT_TYPE_ATOM, self.key)
|
||||
got = app.get_response('/me@foo.com/salmon', method='POST', body=slap)
|
||||
got = app.get_response('/foo.com@foo.com/salmon', method='POST', body=slap)
|
||||
self.assertEquals(200, got.status_int)
|
||||
|
||||
# check salmon magic key discovery
|
||||
|
|
|
@ -17,7 +17,7 @@ import models
|
|||
import testutil
|
||||
from webfinger import app
|
||||
|
||||
USER = '%s@foo.com' % common.USERNAME
|
||||
USER = 'foo.com@foo.com'
|
||||
|
||||
|
||||
class WebFingerTest(testutil.TestCase):
|
||||
|
@ -179,7 +179,7 @@ class WebFingerTest(testutil.TestCase):
|
|||
def test_webfinger_handler(self, mock_get):
|
||||
mock_get.return_value = requests_response(self.html, url='https://foo.com/')
|
||||
|
||||
for resource in ('me@foo.com', 'acct:me@foo.com', 'xyz@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/'):
|
||||
url = '/.well-known/webfinger?%s' % urllib.urlencode(
|
||||
{'resource': resource})
|
||||
|
|
|
@ -120,7 +120,7 @@ class WebmentionTest(testutil.TestCase):
|
|||
'id': 'http://localhost/orig',
|
||||
'url': 'http://orig',
|
||||
'name': 'Ms. ☕ Baz',
|
||||
'preferredUsername': 'me',
|
||||
'preferredUsername': 'orig',
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ class WebmentionTest(testutil.TestCase):
|
|||
'type': 'Person',
|
||||
'id': 'http://localhost/orig',
|
||||
'url': 'http://orig',
|
||||
'preferredUsername': 'me',
|
||||
'preferredUsername': 'orig',
|
||||
'name': 'Ms. ☕ Baz',
|
||||
}],
|
||||
},
|
||||
|
|
|
@ -58,7 +58,7 @@ class UserHandler(handlers.XrdOrJrdHandler):
|
|||
Couldn't find a <a href="http://microformats.org/wiki/representative-hcard-parsing">\
|
||||
representative h-card</a> on %s""" % resp.url)
|
||||
|
||||
acct = '%s@%s' % (common.USERNAME, domain)
|
||||
acct = '%s@%s' % (domain, domain)
|
||||
logging.info('Generating WebFinger data for %s', acct)
|
||||
key = models.MagicKey.get_or_create(domain)
|
||||
props = hcard.get('properties', {})
|
||||
|
|
|
@ -139,7 +139,7 @@ class WebmentionHandler(webapp2.RequestHandler):
|
|||
# https://w3c.github.io/activitypub/#authorization-lds
|
||||
# https://tools.ietf.org/html/draft-cavage-http-signatures-07
|
||||
# https://github.com/tootsuite/mastodon/issues/4906#issuecomment-328844846
|
||||
acct = 'acct:me@%s' % source_domain
|
||||
acct = 'acct:%s@%s' % (source_domain, source_domain)
|
||||
auth = HTTPSignatureAuth(secret=key.private_pem(), key_id=acct,
|
||||
algorithm='rsa-sha256')
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue