change Web.ap_subdomain default to 'web'

pull/741/head
Ryan Barrett 2023-11-30 20:08:41 -08:00
rodzic 1b06b1a758
commit 2f4bae8dc9
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
4 zmienionych plików z 8 dodań i 8 usunięć

Wyświetl plik

@ -177,7 +177,7 @@ class UserTest(TestCase):
'url': 'acct:alice@y.z',
}
self.assertEqual('alice', self.user.username())
self.assertEqual('@y.z@fed.brid.gy', self.user.handle_as('ap'))
self.assertEqual('@y.z@web.brid.gy', self.user.handle_as('ap'))
def test_handle_as_None(self):
class NoHandle(Fake):

Wyświetl plik

@ -1947,7 +1947,7 @@ http://this/404s
self.assertEqual('http://localhost/user.com', self.user.id_as(ActivityPub))
with app.test_request_context('', base_url='https://web.brid.gy/'):
self.assertEqual('https://fed.brid.gy/user.com',
self.assertEqual('https://web.brid.gy/user.com',
self.user.id_as(ActivityPub))
self.user.ap_subdomain = 'fed'

Wyświetl plik

@ -67,11 +67,11 @@ WEBFINGER_NO_HCARD = {
}, {
'rel': 'self',
'type': 'application/activity+json',
'href': 'https://fed.brid.gy/user.com',
'href': 'https://web.brid.gy/user.com',
}, {
'rel': 'inbox',
'type': 'application/activity+json',
'href': 'https://fed.brid.gy/user.com/inbox',
'href': 'https://web.brid.gy/user.com/inbox',
}, {
'rel': 'sharedInbox',
'type': 'application/activity+json',
@ -312,12 +312,12 @@ class WebfingerTest(TestCase):
mock_get.return_value = requests_response(test_web.ACTOR_HTML)
expected = copy.deepcopy(WEBFINGER_NO_HCARD)
expected['subject'] = 'acct:user.com@fed.brid.gy'
expected['subject'] = 'acct:user.com@web.brid.gy'
got = self.client.get(
'/.well-known/webfinger?resource=acct:user.com@fed.brid.gy',
'/.well-known/webfinger?resource=acct:user.com@web.brid.gy',
headers={'Accept': 'application/json'},
base_url='https://fed.brid.gy/')
base_url='https://web.brid.gy/')
self.assertEqual(200, got.status_code)
self.assertEqual(expected, got.json)

2
web.py
Wyświetl plik

@ -95,7 +95,7 @@ class Web(User, Protocol):
# switched to per-protocol subdomains, eg https://web.brid.gy/snarfed.org .
# However, we need to preserve the old users' actor ids as is. So, this
# property tracks which subdomain a given Web user's AP actor uses.
ap_subdomain = ndb.StringProperty(choices=['fed', 'web'], default='fed')
ap_subdomain = ndb.StringProperty(choices=['fed', 'web'], default='web')
@classmethod
def _get_kind(cls):