mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-15 08:00:40 +00:00
Closes #3060
This commit is contained in:
@@ -186,6 +186,6 @@ public sealed class ASFController : ArchiController {
|
||||
message = success ? Strings.Success : Strings.WarningFailed;
|
||||
}
|
||||
|
||||
return Ok(new GenericResponse<string>(success, message!, version?.ToString()));
|
||||
return Ok(new GenericResponse<string>(success, message, version?.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,10 +62,8 @@ public sealed class CommandController : ArchiController {
|
||||
string command = request.Command;
|
||||
string? commandPrefix = ASF.GlobalConfig != null ? ASF.GlobalConfig.CommandPrefix : GlobalConfig.DefaultCommandPrefix;
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (!string.IsNullOrEmpty(commandPrefix) && command.StartsWith(commandPrefix!, StringComparison.Ordinal)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (command.Length == commandPrefix!.Length) {
|
||||
if (!string.IsNullOrEmpty(commandPrefix) && command.StartsWith(commandPrefix, StringComparison.Ordinal)) {
|
||||
if (command.Length == commandPrefix.Length) {
|
||||
// If the message starts with command prefix and is of the same length as command prefix, then it's just empty command trigger, useless
|
||||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(command))));
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public sealed class NLogController : ArchiController {
|
||||
}
|
||||
|
||||
if (!HttpContext.WebSockets.IsWebSocketRequest) {
|
||||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError!, $"{nameof(HttpContext.WebSockets.IsWebSocketRequest)}: {HttpContext.WebSockets.IsWebSocketRequest}")));
|
||||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, $"{nameof(HttpContext.WebSockets.IsWebSocketRequest)}: {HttpContext.WebSockets.IsWebSocketRequest}")));
|
||||
}
|
||||
|
||||
// From now on we can return only EmptyResult as the response stream is already being used by existing websocket connection
|
||||
|
||||
@@ -67,8 +67,7 @@ public sealed class TypeController : ArchiController {
|
||||
string? unifiedName = field.FieldType.GetUnifiedName();
|
||||
|
||||
if (!string.IsNullOrEmpty(unifiedName)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
body[jsonProperty.PropertyName ?? field.Name] = unifiedName!;
|
||||
body[jsonProperty.PropertyName ?? field.Name] = unifiedName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,8 +79,7 @@ public sealed class TypeController : ArchiController {
|
||||
string? unifiedName = property.PropertyType.GetUnifiedName();
|
||||
|
||||
if (!string.IsNullOrEmpty(unifiedName)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
body[jsonProperty.PropertyName ?? property.Name] = unifiedName!;
|
||||
body[jsonProperty.PropertyName ?? property.Name] = unifiedName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,10 +102,7 @@ public sealed class TypeController : ArchiController {
|
||||
continue;
|
||||
}
|
||||
|
||||
// ReSharper disable RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
body[valueText!] = valueObjText!;
|
||||
|
||||
// ReSharper restore RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
body[valueText] = valueObjText;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user