do not search debug nodes

This commit is contained in:
Your Name 2024-05-27 14:20:58 -04:00 committed by Henri Dickson
parent 76a1114bf7
commit 846404a036
2 changed files with 8 additions and 5 deletions

View file

@ -38,7 +38,7 @@ def ap_redirect(request, uri):
def nodeinfo2(request):
usage = cache.get("nodeinfo_usage") or {}
usage = cache.get("nodeinfo_usage", default={})
return JsonResponse(
{
"version": "2.0",
@ -55,6 +55,7 @@ def nodeinfo2(request):
"metadata": {
"nodeName": settings.SITE_INFO["site_name"],
"nodeRevision": settings.NEODB_VERSION,
"nodeEnvironment": "development" if settings.DEBUG else "production",
},
}
)

View file

@ -879,18 +879,20 @@ class Takahe:
if peers is None:
peers = list(
Domain.objects.filter(
nodeinfo__protocols__contains="neodb", local=False
nodeinfo__protocols__contains="neodb",
nodeinfo__metadata__nodeEnvironment="production",
local=False,
).values_list("pk", flat=True)
)
cache.set(cache_key, peers, timeout=1800)
return peers
@staticmethod
def verify_invite(token):
def verify_invite(token: str) -> bool:
if not token:
return False
invite = Invite.objects.filter(token=token).first()
return invite and invite.valid
return invite is not None and invite.valid
@staticmethod
def get_announcements():
@ -944,7 +946,7 @@ class Takahe:
a.seen.add(user)
@staticmethod
def get_events(identity_id: int, types):
def get_events(identity_id: int, types: list[str]):
return (
TimelineEvent.objects.select_related(
"subject_post",