kopia lustrzana https://github.com/snarfed/bridgy-fed
add Mastodon instance info at /api/v1/instance
https://docs.joinmastodon.org/methods/instance/#v1 right now just for FediSeer: https://fediseer.com/faq/eng#how-can-i-claim-my-instancepull/775/head
rodzic
415e2392e1
commit
49eb9b8541
27
pages.py
27
pages.py
|
@ -372,6 +372,33 @@ def nodeinfo():
|
|||
}
|
||||
|
||||
|
||||
@app.get('/api/v1/instance')
|
||||
@canonicalize_request_domain(common.PROTOCOL_DOMAINS, common.PRIMARY_DOMAIN)
|
||||
@flask_util.cached(cache, datetime.timedelta(days=1))
|
||||
def instance_info():
|
||||
"""
|
||||
https://docs.joinmastodon.org/methods/instance/#v1
|
||||
"""
|
||||
return {
|
||||
'uri': 'fed.brid.gy',
|
||||
'title': 'Bridgy Fed',
|
||||
'version': os.getenv('GAE_VERSION'),
|
||||
'short_description': 'Bridging the new social internet',
|
||||
'description': 'Bridging the new social internet',
|
||||
'email': 'feedback@ryanb.org',
|
||||
'thumbnail': 'https://fed.brid.gy/static/bridgy_logo_with_alpha.png',
|
||||
'registrations': True,
|
||||
'approval_required': False,
|
||||
'invites_enabled': False,
|
||||
'contact_account': {
|
||||
'username': 'snarfed.org',
|
||||
'acct': 'snarfed.org',
|
||||
'display_name': 'Ryan',
|
||||
'url': 'https://snarfed.org/',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@app.get('/log')
|
||||
@canonicalize_request_domain(common.PROTOCOL_DOMAINS, common.PRIMARY_DOMAIN)
|
||||
@flask_util.cached(cache, logs.CACHE_TIME)
|
||||
|
|
|
@ -445,6 +445,10 @@ class PagesTest(TestCase):
|
|||
# just check that it doesn't crash
|
||||
self.client.get('/nodeinfo.json')
|
||||
|
||||
def test_instance_info(self):
|
||||
# just check that it doesn't crash
|
||||
self.client.get('/api/v1/instance')
|
||||
|
||||
def test_canonicalize_domain(self):
|
||||
got = self.client.get('/', base_url='https://ap.brid.gy/')
|
||||
self.assert_equals(301, got.status_code)
|
||||
|
|
Ładowanie…
Reference in New Issue