Metadata for monthly active accounts

merge-requests/3/merge
Bob Mottram 2019-11-13 15:19:43 +00:00
parent 4e97b26bfa
commit d0c1ff3603
1 changed files with 5 additions and 2 deletions

View File

@ -10,11 +10,14 @@ import os
import json import json
import commentjson import commentjson
from utils import noOfAccounts from utils import noOfAccounts
from utils import noOfActiveAccountsMonthly
def metaDataNodeInfo(baseDir: str,registration: bool,version: str) -> {}: def metaDataNodeInfo(baseDir: str,registration: bool,version: str) -> {}:
""" /nodeinfo/2.0 endpoint """ /nodeinfo/2.0 endpoint
""" """
activeAccounts=noOfAccounts(baseDir) activeAccounts=noOfAccounts(baseDir)
activeAccountsMonthly=noOfActiveAccountsMonthly(baseDir,1)
activeAccountsHalfYear=noOfActiveAccountsMonthly(baseDir,6)
nodeinfo = { nodeinfo = {
'openRegistrations': registration, 'openRegistrations': registration,
'protocols': ['activitypub'], 'protocols': ['activitypub'],
@ -25,8 +28,8 @@ def metaDataNodeInfo(baseDir: str,registration: bool,version: str) -> {}:
'usage': { 'usage': {
'localPosts': 1, 'localPosts': 1,
'users': { 'users': {
'activeHalfyear': 1, 'activeHalfyear': activeAccountsHalfYear,
'activeMonth': 1, 'activeMonth': activeAccountsMonthly,
'total': activeAccounts 'total': activeAccounts
} }
}, },