- }
+ data.Remove(payloadKey);
+ foreach (var item in data.Where(p => p.Value?.GetValueKind() is null or JsonValueKind.Null).ToList())
+ data.Remove(item.Key);
-
Body
- var json = JsonSerializer.Serialize(JsonDocument.Parse(data.Body), new JsonSerializerOptions { WriteIndented = true });
-
@json
- }
- else if (Model.Job.Queue == "deliver")
- {
- var data = JsonSerializer.Deserialize(Model.Job.Data) ??
- throw new Exception("Failed to deserialize deliver job data");
-
-
-
-
-
Inbox URL
-
@data.InboxUrl
-
-
-
Content type
-
@data.ContentType
-
-
-
User ID
-
@data.UserId
-
-
-
Recipient host
-
@data.RecipientHost
-
-
-
-
-
Payload
- var json = JsonSerializer.Serialize(JsonDocument.Parse(data.Payload), new JsonSerializerOptions { WriteIndented = true });
-
@json
- }
- else if (Model.Job.Queue == "pre-deliver")
- {
- var data = JsonSerializer.Deserialize(Model.Job.Data) ??
- throw new Exception("Failed to deserialize pre-deliver job data");
-
-
-
-
-
Actor ID
-
@data.ActorId
-
-
-
Recipient IDs
-
[@string.Join(", ", data.RecipientIds)]
-
-
-
Deliver to followers
-
@data.DeliverToFollowers
-
-
-
-
-
Serialized activity
- var json = JsonSerializer.Serialize(JsonDocument.Parse(data.SerializedActivity), new JsonSerializerOptions { WriteIndented = true });
-
@json
+ var dataJson = data.ToJsonString(dataOpts);
+
@dataJson
+
Job payload
+
@payloadJson
}
else
{
- var json = JsonSerializer.Serialize(JsonDocument.Parse(Model.Job.Data), new JsonSerializerOptions { WriteIndented = true });
-
@json
+ var json = JsonNode.Parse(Model.Job.Data)?.ToJsonString(payloadOpts) ??
+ throw new Exception($"Failed to serialize {Model.Job.Queue} job data");
+
@json
}
}
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Iceshrimp.Backend/Pages/QueueJob.cshtml.cs b/Iceshrimp.Backend/Pages/QueueJob.cshtml.cs
index 8b4ba3ee..a6b739d3 100644
--- a/Iceshrimp.Backend/Pages/QueueJob.cshtml.cs
+++ b/Iceshrimp.Backend/Pages/QueueJob.cshtml.cs
@@ -1,6 +1,7 @@
using Iceshrimp.Backend.Core.Database;
using Iceshrimp.Backend.Core.Database.Tables;
using Iceshrimp.Backend.Core.Middleware;
+using Iceshrimp.Backend.Core.Queues;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
@@ -22,4 +23,13 @@ public class QueueJobModel(DatabaseContext db) : PageModel
throw GracefulException.NotFound($"Job {id} not found");
return Page();
}
+
+ private static Dictionary _lookup = new()
+ {
+ { "inbox", "body" },
+ { "deliver", "payload" },
+ { "pre-deliver", "serializedActivity" }
+ };
+
+ public Dictionary Lookup => _lookup;
}
\ No newline at end of file