def nodeinfo(): nodeinfo = NodeInfo(software="social-relay", protocols={ "inbound": ["diaspora"], "outbound": ["diaspora"] }, services={ "inbound": [], "outbound": [] }, open_registrations=False, usage={"users": {}}, metadata={"nodeName": app.config.get("RELAY_NAME")}, skip_validate=True) return Response(nodeinfo.render(), status=200, mimetype="application/json")
def _valid_nodeinfo(self, raise_on_validate=False): return NodeInfo(software={ "name": "diaspora", "version": "0.5.4.3" }, protocols={ "inbound": ["diaspora"], "outbound": ["diaspora"] }, services={ "inbound": ["pumpio"], "outbound": ["twitter"] }, open_registrations=True, usage={"users": {}}, metadata={}, raise_on_validate=raise_on_validate)
def nodeinfo_view(request): """Generate a NodeInfo document.""" site = Site.objects.get_current() nodeinfo = NodeInfo(software={ "name": "socialhome", "version": version }, protocols={ "inbound": ["diaspora"], "outbound": ["diaspora"] }, services={ "inbound": [], "outbound": [] }, open_registrations=settings.ACCOUNT_ALLOW_REGISTRATION, usage={"users": {}}, metadata={"nodeName": site.name}) return JsonResponse(nodeinfo.doc)
def nodeinfo_view(request): """Generate a NodeInfo document.""" site = Site.objects.get_current() usage = {"users": {}} if settings.SOCIALHOME_STATISTICS: usage = { "users": { "total": User.objects.count(), "activeHalfyear": User.objects.filter(last_login__gte=now() - datetime.timedelta(days=180)).count(), "activeMonth": User.objects.filter(last_login__gte=now() - datetime.timedelta(days=30)).count(), }, "localPosts": Content.objects.filter(author__user__isnull=False, content_type=ContentType.CONTENT).count(), "localComments": Content.objects.filter(author__user__isnull=False, content_type=ContentType.REPLY).count(), } nodeinfo = NodeInfo(software={ "name": "socialhome", "version": version }, protocols={ "inbound": ["diaspora"], "outbound": ["diaspora"] }, services={ "inbound": [], "outbound": [] }, open_registrations=settings.ACCOUNT_ALLOW_REGISTRATION, usage=usage, metadata={"nodeName": site.name}) return JsonResponse(nodeinfo.doc)