chore(bot): revert temp fix (407e0ce) + update watson

This commit is contained in:
asleepyskye 2025-08-11 21:28:22 -04:00
parent aa103f85e7
commit 3c4644f3cc
4 changed files with 21 additions and 57 deletions

View file

@ -24,6 +24,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Humanizer.Core" Version="2.14.1" /> <PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Sentry" Version="4.13.0" /> <PackageReference Include="Sentry" Version="4.13.0" />
<PackageReference Include="Watson.Lite" Version="6.3.5" /> <PackageReference Include="Watson.Lite" Version="6.3.12" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -1,4 +1,3 @@
using System.Text;
using System.Text.Json; using System.Text.Json;
using Serilog; using Serilog;
@ -58,7 +57,7 @@ public class HttpListenerService
private async Task RuntimeConfigSet(HttpContextBase ctx) private async Task RuntimeConfigSet(HttpContextBase ctx)
{ {
var key = ctx.Request.Url.Parameters["key"]; var key = ctx.Request.Url.Parameters["key"];
var value = ReadStream(ctx.Request.Data, ctx.Request.ContentLength); var value = ctx.Request.DataAsString;
await _runtimeConfig.Set(key, value); await _runtimeConfig.Set(key, value);
await RuntimeConfigGet(ctx); await RuntimeConfigGet(ctx);
} }
@ -77,7 +76,7 @@ public class HttpListenerService
var shardIdString = ctx.Request.Url.Parameters["shard_id"]; var shardIdString = ctx.Request.Url.Parameters["shard_id"];
if (!int.TryParse(shardIdString, out var shardId)) return; if (!int.TryParse(shardIdString, out var shardId)) return;
var packet = JsonSerializer.Deserialize<GatewayPacket>(ReadStream(ctx.Request.Data, ctx.Request.ContentLength), _jsonSerializerOptions); var packet = JsonSerializer.Deserialize<GatewayPacket>(ctx.Request.DataAsString, _jsonSerializerOptions);
var evt = DeserializeEvent(shardId, packet.EventType!, (JsonElement)packet.Payload!); var evt = DeserializeEvent(shardId, packet.EventType!, (JsonElement)packet.Payload!);
if (evt != null) if (evt != null)
{ {
@ -108,39 +107,4 @@ public class HttpListenerService
return null; return null;
} }
} }
//temporary re-implementation of the ReadStream function found in WatsonWebserver.Lite, but with handling for closed connections
//https://github.com/dotnet/WatsonWebserver/issues/171
private static string ReadStream(Stream input, long contentLength)
{
if (input == null) throw new ArgumentNullException(nameof(input));
if (!input.CanRead) throw new InvalidOperationException("Input stream is not readable");
if (contentLength < 1) return "";
byte[] buffer = new byte[65536];
long bytesRemaining = contentLength;
using (MemoryStream ms = new MemoryStream())
{
int read;
while (bytesRemaining > 0)
{
read = input.Read(buffer, 0, buffer.Length);
if (read > 0)
{
ms.Write(buffer, 0, read);
bytesRemaining -= read;
}
else
{
throw new IOException("Connection closed before reading end of stream.");
}
}
if (ms.Length < 1) return null;
var str = Encoding.Default.GetString(ms.ToArray());
return str;
}
}
} }

View file

@ -16,12 +16,12 @@
}, },
"Watson.Lite": { "Watson.Lite": {
"type": "Direct", "type": "Direct",
"requested": "[6.3.5, )", "requested": "[6.3.12, )",
"resolved": "6.3.5", "resolved": "6.3.12",
"contentHash": "YF8+se3IVenn8YlyNeb4wSJK6QMnVD0QHIOEiZ22wS4K2wkwoSDzWS+ZAjk1MaPeB+XO5gRoENUN//pOc+wI2g==", "contentHash": "L/TfJadyOwK9bhhvOnEKXLeyDaTAn8v6hnYPVPIwQ7JlnUXDbDqsUa3qHFdFIHiuK8vMZOnDL7+k/mY10yxdYw==",
"dependencies": { "dependencies": {
"CavemanTcp": "2.0.5", "CavemanTcp": "2.0.9",
"Watson.Core": "6.3.5" "Watson.Core": "6.3.12"
} }
}, },
"App.Metrics": { "App.Metrics": {
@ -119,8 +119,8 @@
}, },
"CavemanTcp": { "CavemanTcp": {
"type": "Transitive", "type": "Transitive",
"resolved": "2.0.5", "resolved": "2.0.9",
"contentHash": "90wywmGpjrj26HMAkufYZwuZI8sVYB1mRwEdqugSR3kgDnPX+3l0jO86gwtFKsPvsEpsS4Dn/1EbhguzUxMU8Q==" "contentHash": "KgIwYhPhGkBTm+wwVAmWonkKPw4xYVnutzzlIeqOLcX1fti+8d+MEGTvbern1smf3S/UpjFjihkf6XRziTddzQ=="
}, },
"Dapper": { "Dapper": {
"type": "Transitive", "type": "Transitive",
@ -746,8 +746,8 @@
}, },
"Watson.Core": { "Watson.Core": {
"type": "Transitive", "type": "Transitive",
"resolved": "6.3.5", "resolved": "6.3.12",
"contentHash": "Y5YxKOCSLe2KDmfwvI/J0qApgmmZR77LwyoufRVfKH7GLdHiE7fY0IfoNxWTG7nNv8knBfgwyOxdehRm+4HaCg==", "contentHash": "lCWv+7rz++z/1ceu+aBdJYw+nO7u/dgXxVYrmdUO/3ylFeEbbPQP19MYjOJbhSQY4+bmQRex79YJ1IneLZhprA==",
"dependencies": { "dependencies": {
"IpMatcher": "1.0.5", "IpMatcher": "1.0.5",
"RegexMatcher": "1.0.9", "RegexMatcher": "1.0.9",

View file

@ -130,8 +130,8 @@
}, },
"CavemanTcp": { "CavemanTcp": {
"type": "Transitive", "type": "Transitive",
"resolved": "2.0.5", "resolved": "2.0.9",
"contentHash": "90wywmGpjrj26HMAkufYZwuZI8sVYB1mRwEdqugSR3kgDnPX+3l0jO86gwtFKsPvsEpsS4Dn/1EbhguzUxMU8Q==" "contentHash": "KgIwYhPhGkBTm+wwVAmWonkKPw4xYVnutzzlIeqOLcX1fti+8d+MEGTvbern1smf3S/UpjFjihkf6XRziTddzQ=="
}, },
"Dapper": { "Dapper": {
"type": "Transitive", "type": "Transitive",
@ -912,8 +912,8 @@
}, },
"Watson.Core": { "Watson.Core": {
"type": "Transitive", "type": "Transitive",
"resolved": "6.3.5", "resolved": "6.3.12",
"contentHash": "Y5YxKOCSLe2KDmfwvI/J0qApgmmZR77LwyoufRVfKH7GLdHiE7fY0IfoNxWTG7nNv8knBfgwyOxdehRm+4HaCg==", "contentHash": "lCWv+7rz++z/1ceu+aBdJYw+nO7u/dgXxVYrmdUO/3ylFeEbbPQP19MYjOJbhSQY4+bmQRex79YJ1IneLZhprA==",
"dependencies": { "dependencies": {
"IpMatcher": "1.0.5", "IpMatcher": "1.0.5",
"RegexMatcher": "1.0.9", "RegexMatcher": "1.0.9",
@ -924,11 +924,11 @@
}, },
"Watson.Lite": { "Watson.Lite": {
"type": "Transitive", "type": "Transitive",
"resolved": "6.3.5", "resolved": "6.3.12",
"contentHash": "YF8+se3IVenn8YlyNeb4wSJK6QMnVD0QHIOEiZ22wS4K2wkwoSDzWS+ZAjk1MaPeB+XO5gRoENUN//pOc+wI2g==", "contentHash": "L/TfJadyOwK9bhhvOnEKXLeyDaTAn8v6hnYPVPIwQ7JlnUXDbDqsUa3qHFdFIHiuK8vMZOnDL7+k/mY10yxdYw==",
"dependencies": { "dependencies": {
"CavemanTcp": "2.0.5", "CavemanTcp": "2.0.9",
"Watson.Core": "6.3.5" "Watson.Core": "6.3.12"
} }
}, },
"xunit.abstractions": { "xunit.abstractions": {
@ -1001,7 +1001,7 @@
"Myriad": "[1.0.0, )", "Myriad": "[1.0.0, )",
"PluralKit.Core": "[1.0.0, )", "PluralKit.Core": "[1.0.0, )",
"Sentry": "[4.13.0, )", "Sentry": "[4.13.0, )",
"Watson.Lite": "[6.3.5, )" "Watson.Lite": "[6.3.12, )"
} }
}, },
"pluralkit.core": { "pluralkit.core": {