From dbe57075d386d7474bafc208b654507d9a2d769e Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sun, 6 Nov 2022 13:48:04 -0700 Subject: Rework to a domains model for better vhosting --- miniq/migrations/0001_initial.py | 9 +++++++-- miniq/views.py | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'miniq') diff --git a/miniq/migrations/0001_initial.py b/miniq/migrations/0001_initial.py index 6775ff3..32c5d53 100644 --- a/miniq/migrations/0001_initial.py +++ b/miniq/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 4.1.3 on 2022-11-06 03:59 +# Generated by Django 4.1.3 on 2022-11-06 19:58 from django.db import migrations, models @@ -22,7 +22,12 @@ class Migration(migrations.Migration): verbose_name="ID", ), ), - ("type", models.CharField(max_length=500)), + ( + "type", + models.CharField( + choices=[("identity_fetch", "Identity Fetch")], max_length=500 + ), + ), ("priority", models.IntegerField(default=0)), ("subject", models.TextField()), ("payload", models.JSONField(blank=True, null=True)), diff --git a/miniq/views.py b/miniq/views.py index 12da7cd..21275f8 100644 --- a/miniq/views.py +++ b/miniq/views.py @@ -64,5 +64,8 @@ class QueueProcessor(View): await task.fail(f"{e}\n\n" + traceback.format_exc()) async def handle_identity_fetch(self, subject, payload): - identity = await sync_to_async(Identity.by_handle)(subject) - await identity.fetch_details() + # Get the actor URI via webfinger + actor_uri, handle = await Identity.fetch_webfinger(subject) + # Get or create the identity, then fetch + identity = await sync_to_async(Identity.by_actor_uri)(actor_uri, create=True) + await identity.fetch_actor() -- cgit v1.2.3