mirror of
https://github.com/BlossomiShymae/Needlework.Net.git
synced 2025-12-06 10:10:48 +01:00
Fix issues
This commit is contained in:
@@ -26,7 +26,7 @@ namespace Needlework.Net.Desktop.ViewModels
|
|||||||
[ObservableProperty] private string? _requestBody = null;
|
[ObservableProperty] private string? _requestBody = null;
|
||||||
[ObservableProperty] private string? _responsePath = null;
|
[ObservableProperty] private string? _responsePath = null;
|
||||||
[ObservableProperty] private string? _responseStatus = null;
|
[ObservableProperty] private string? _responseStatus = null;
|
||||||
[ObservableProperty] private string? _responseAuthentication = null;
|
[ObservableProperty] private string? _responseAuthorization = null;
|
||||||
|
|
||||||
public WindowService WindowService { get; }
|
public WindowService WindowService { get; }
|
||||||
|
|
||||||
@@ -65,20 +65,20 @@ namespace Needlework.Net.Desktop.ViewModels
|
|||||||
var riotAuthentication = new RiotAuthentication(processInfo.RemotingAuthToken);
|
var riotAuthentication = new RiotAuthentication(processInfo.RemotingAuthToken);
|
||||||
var body = await response.Content.ReadAsStringAsync();
|
var body = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
body = JsonSerializer.Serialize(JsonSerializer.Deserialize<object>(body, App.JsonSerializerOptions));
|
body = !string.IsNullOrEmpty(body) ? JsonSerializer.Serialize(JsonSerializer.Deserialize<object>(body), App.JsonSerializerOptions) : string.Empty;
|
||||||
if (body.Length >= App.MaxCharacters) WindowService.ShowOopsiesWindow(body);
|
if (body.Length >= App.MaxCharacters) WindowService.ShowOopsiesWindow(body);
|
||||||
else WeakReferenceMessenger.Default.Send(new ResponseUpdatedMessage(body), nameof(ConsoleViewModel));
|
else WeakReferenceMessenger.Default.Send(new ResponseUpdatedMessage(body), nameof(ConsoleViewModel));
|
||||||
|
|
||||||
ResponseStatus = response.StatusCode.ToString();
|
ResponseStatus = $"{(int)response.StatusCode} {response.StatusCode.ToString()}";
|
||||||
ResponsePath = $"https://127.0.0.1:{processInfo.AppPort}{RequestPath}";
|
ResponsePath = $"https://127.0.0.1:{processInfo.AppPort}{RequestPath}";
|
||||||
ResponseAuthentication = $"Basic {riotAuthentication.Value}";
|
ResponseAuthorization = $"Basic {riotAuthentication.Value}";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await SukiHost.ShowToast("Request Failed", ex.Message, SukiUI.Enums.NotificationType.Error);
|
await SukiHost.ShowToast("Request Failed", ex.Message, SukiUI.Enums.NotificationType.Error);
|
||||||
ResponseStatus = null;
|
ResponseStatus = null;
|
||||||
ResponsePath = null;
|
ResponsePath = null;
|
||||||
ResponseAuthentication = null;
|
ResponseAuthorization = null;
|
||||||
WeakReferenceMessenger.Default.Send(new ResponseUpdatedMessage(string.Empty), nameof(ConsoleViewModel));
|
WeakReferenceMessenger.Default.Send(new ResponseUpdatedMessage(string.Empty), nameof(ConsoleViewModel));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace Needlework.Net.Desktop.ViewModels
|
|||||||
var riotAuthentication = new RiotAuthentication(processInfo.RemotingAuthToken);
|
var riotAuthentication = new RiotAuthentication(processInfo.RemotingAuthToken);
|
||||||
var responseBody = await response.Content.ReadAsStringAsync();
|
var responseBody = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
responseBody = JsonSerializer.Serialize(JsonSerializer.Deserialize<object>(responseBody, App.JsonSerializerOptions));
|
responseBody = !string.IsNullOrEmpty(responseBody) ? JsonSerializer.Serialize(JsonSerializer.Deserialize<object>(responseBody), App.JsonSerializerOptions) : string.Empty;
|
||||||
if (responseBody.Length >= App.MaxCharacters) WeakReferenceMessenger.Default.Send(new OopsiesWindowRequestedMessage(responseBody));
|
if (responseBody.Length >= App.MaxCharacters) WeakReferenceMessenger.Default.Send(new OopsiesWindowRequestedMessage(responseBody));
|
||||||
else WeakReferenceMessenger.Default.Send(new EditorUpdateMessage(new(responseBody, "EndpointResponseEditor")));
|
else WeakReferenceMessenger.Default.Send(new EditorUpdateMessage(new(responseBody, "EndpointResponseEditor")));
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
</suki:GroupBox>
|
</suki:GroupBox>
|
||||||
</suki:GlassCard>
|
</suki:GlassCard>
|
||||||
<suki:GlassCard Margin="0 4">
|
<suki:GlassCard Margin="0 4">
|
||||||
<suki:GroupBox Header="Authentication">
|
<suki:GroupBox Header="Authorization">
|
||||||
<TextBlock Text="{Binding ResponseAuthentication}" />
|
<TextBlock Text="{Binding ResponseAuthentication}" />
|
||||||
</suki:GroupBox>
|
</suki:GroupBox>
|
||||||
</suki:GlassCard>
|
</suki:GlassCard>
|
||||||
|
|||||||
Reference in New Issue
Block a user