forked from indymedia/epicyon
Metadata reports the number of accounts
parent
afcd2e29ac
commit
4b53029376
|
@ -380,7 +380,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return False
|
return False
|
||||||
if self.server.debug:
|
if self.server.debug:
|
||||||
print('DEBUG: nodeinfo '+self.path)
|
print('DEBUG: nodeinfo '+self.path)
|
||||||
info=metaDataNodeInfo(self.server.registration,self.server.projectVersion)
|
info=metaDataNodeInfo(self.server.baseDir,self.server.registration,self.server.projectVersion)
|
||||||
if info:
|
if info:
|
||||||
msg=json.dumps(info).encode('utf-8')
|
msg=json.dumps(info).encode('utf-8')
|
||||||
self._set_headers('application/ld+json',len(msg),None)
|
self._set_headers('application/ld+json',len(msg),None)
|
||||||
|
|
12
metadata.py
12
metadata.py
|
@ -9,10 +9,12 @@ __status__ = "Production"
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import commentjson
|
import commentjson
|
||||||
|
from utils import noOfAccounts
|
||||||
|
|
||||||
def metaDataNodeInfo(registration: bool,version: str) -> {}:
|
def metaDataNodeInfo(baseDir: str,registration: bool,version: str) -> {}:
|
||||||
""" /nodeinfo/2.0 endpoint
|
""" /nodeinfo/2.0 endpoint
|
||||||
"""
|
"""
|
||||||
|
activeAccounts=noOfAccounts(baseDir)
|
||||||
nodeinfo = {
|
nodeinfo = {
|
||||||
'openRegistrations': registration,
|
'openRegistrations': registration,
|
||||||
'protocols': ['activitypub'],
|
'protocols': ['activitypub'],
|
||||||
|
@ -25,7 +27,7 @@ def metaDataNodeInfo(registration: bool,version: str) -> {}:
|
||||||
'users': {
|
'users': {
|
||||||
'activeHalfyear': 1,
|
'activeHalfyear': 1,
|
||||||
'activeMonth': 1,
|
'activeMonth': 1,
|
||||||
'total': 1
|
'total': activeAccounts
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'version': '2.0'
|
'version': '2.0'
|
||||||
|
@ -58,7 +60,7 @@ def metaDataInstance(instanceTitle: str, \
|
||||||
isBot=False
|
isBot=False
|
||||||
if adminActor['type']!='Person':
|
if adminActor['type']!='Person':
|
||||||
isBot=True
|
isBot=True
|
||||||
|
|
||||||
instance = {
|
instance = {
|
||||||
'approval_required': False,
|
'approval_required': False,
|
||||||
'contact_account': {'acct': adminActor['preferredUsername'],
|
'contact_account': {'acct': adminActor['preferredUsername'],
|
||||||
|
@ -87,9 +89,9 @@ def metaDataInstance(instanceTitle: str, \
|
||||||
'registrations': registration,
|
'registrations': registration,
|
||||||
'short_description': instanceDescriptionShort,
|
'short_description': instanceDescriptionShort,
|
||||||
'stats': {
|
'stats': {
|
||||||
'domain_count': 1,
|
'domain_count': 2,
|
||||||
'status_count': 1,
|
'status_count': 1,
|
||||||
'user_count': 1
|
'user_count': noOfAccounts(baseDir)
|
||||||
},
|
},
|
||||||
'thumbnail': httpPrefix+'://'+domainFull+'/login.png',
|
'thumbnail': httpPrefix+'://'+domainFull+'/login.png',
|
||||||
'title': instanceTitle,
|
'title': instanceTitle,
|
||||||
|
|
Loading…
Reference in New Issue