Include documents within nodeinfo

merge-requests/30/head
Bob Mottram 2021-05-04 10:39:15 +01:00
parent d5c23b4dff
commit eeeec16297
2 changed files with 21 additions and 1 deletions

View File

@ -988,7 +988,20 @@ class PubServer(BaseHTTPRequestHandler):
if brochMode:
showNodeInfoAccounts = False
if callingDomain.endswith('.onion') and \
self.server.onionDomain:
instanceUrl = 'http://' + self.server.onionDomain
elif (callingDomain.endswith('.i2p') and
self.server.i2pDomain):
instanceUrl = 'http://' + self.server.i2pDomain
else:
instanceUrl = \
self.server.httpPrefix + '://' + self.server.domainFull
aboutUrl = instanceUrl + '/about'
termsOfServiceUrl = instanceUrl + '/terms'
info = metaDataNodeInfo(self.server.baseDir,
aboutUrl, termsOfServiceUrl,
self.server.registration,
nodeInfoVersion,
showNodeInfoAccounts)

View File

@ -12,7 +12,10 @@ from utils import noOfAccounts
from utils import noOfActiveAccountsMonthly
def metaDataNodeInfo(baseDir: str, registration: bool, version: str,
def metaDataNodeInfo(baseDir: str,
aboutUrl: str,
termsOfServiceUrl: str,
registration: bool, version: str,
showAccounts: bool) -> {}:
""" /nodeinfo/2.0 endpoint
Also see https://socialhub.activitypub.rocks/t/
@ -40,6 +43,10 @@ def metaDataNodeInfo(baseDir: str, registration: bool, version: str,
'name': 'epicyon',
'version': version
},
'documents': {
'about': aboutUrl,
'terms': termsOfServiceUrl
},
'usage': {
'localPosts': 1,
'users': {