aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-07-06 17:22:46 -0500
committerGitHub <noreply@github.com>2025-07-06 17:22:46 -0500
commit64be2396d66a6861e4525a4aba0faeabf14035e0 (patch)
tree10dda353aeeea18ce7846ae7c6f028c4e273edc2 /src
parentd3352909f719ed297c9fe974eb9356570ed2c3f9 (diff)
parent537f9363b966f2b183c7b312c1299dba1c78bab8 (diff)
downloadslskd-64be2396d66a6861e4525a4aba0faeabf14035e0.tar.gz
Merge pull request #1389 from slskd/fix-json
Fix regression in scripts and webhooks causing json to be missing detail
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Integrations/Scripts/ScriptService.cs6
-rw-r--r--src/slskd/Integrations/Webhooks/WebhookService.cs5
2 files changed, 9 insertions, 2 deletions
diff --git a/src/slskd/Integrations/Scripts/ScriptService.cs b/src/slskd/Integrations/Scripts/ScriptService.cs
index 109cf5ff..f5cc4d4c 100644
--- a/src/slskd/Integrations/Scripts/ScriptService.cs
+++ b/src/slskd/Integrations/Scripts/ScriptService.cs
@@ -180,7 +180,11 @@ public class ScriptService
Log.Debug("Running script '{Script}': \"{Executable}\" {Args} (id: {ProcessId})", script.Key, executable, run.Args ?? string.Join(' ', run.Arglist ?? []), processId);
var sw = Stopwatch.StartNew();
- process.StartInfo.EnvironmentVariables["SLSKD_SCRIPT_DATA"] = JsonSerializer.Serialize(data, JsonSerializerOptions);
+ process.StartInfo.EnvironmentVariables["SLSKD_SCRIPT_DATA"] = JsonSerializer.Serialize(
+ value: data,
+ inputType: data.GetType(), // if omitted object is serialized as EventType, losing everything else
+ options: JsonSerializerOptions);
+
process.Start();
process.WaitForExit();
diff --git a/src/slskd/Integrations/Webhooks/WebhookService.cs b/src/slskd/Integrations/Webhooks/WebhookService.cs
index b08b0484..62739d7a 100644
--- a/src/slskd/Integrations/Webhooks/WebhookService.cs
+++ b/src/slskd/Integrations/Webhooks/WebhookService.cs
@@ -94,7 +94,10 @@ public class WebhookService
}
var content = new StringContent(
- content: JsonSerializer.Serialize(data, JsonSerializerOptions),
+ content: JsonSerializer.Serialize(
+ value: data,
+ inputType: data.GetType(), // if omitted object is serialized as EventType, losing everything else
+ options: JsonSerializerOptions),
encoding: Encoding.UTF8,
mediaType: "application/json");