1.1.3 -> 1.1.4 第61次更新

This commit is contained in:
Space Time 2024-12-14 12:36:21 +08:00
parent bf73c635d3
commit ee99628508
3 changed files with 28 additions and 2 deletions

View File

@ -14,4 +14,6 @@ internal class AboutConst : AboutMultilangConst
public static string PolicyButtonUrl => "https://thoughts.teambition.com/share/6264eda98adeb10041b92fda#title=Sheas_Cealer_隐私政策";
public static string AgreementButtonUrl => "https://thoughts.teambition.com/share/6264edd78adeb10041b92fdb#title=Sheas_Cealer_使用协议";
internal static string ReleaseApiUrl => "https://api.github.com/repos/SpaceTimee/Sheas-Cealer/releases/latest";
}

View File

@ -9,14 +9,14 @@
mc:Ignorable="d"
d:DataContext="{d:DesignInstance preses:AboutPres}"
Style="{DynamicResource CommonWindow}" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" SizeToContent="Height" Width="500"
KeyDown="AboutWin_KeyDown">
Loaded="AboutWin_Loaded" KeyDown="AboutWin_KeyDown">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.16*" />
<ColumnDefinition Width="1.2*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />

View File

@ -1,8 +1,12 @@
using System;
using System.Diagnostics;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using OnaCore;
using Sheas_Cealer.Consts;
using Sheas_Cealer.Preses;
using Sheas_Cealer.Utils;
@ -12,6 +16,7 @@ namespace Sheas_Cealer.Wins;
public partial class AboutWin : Window
{
private readonly AboutPres AboutPres;
private readonly HttpClient AboutClient = new(new HttpClientHandler() { ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator });
internal AboutWin()
{
@ -24,6 +29,25 @@ public partial class AboutWin : Window
IconRemover.RemoveIcon(this);
BorderThemeSetter.SetBorderTheme(this, AboutPres.IsLightTheme);
}
private async void AboutWin_Loaded(object sender, RoutedEventArgs e)
{
await Task.Run(async () =>
{
try
{
AboutClient.DefaultRequestHeaders.Add("User-Agent", "Sheas-Cealer");
JsonElement releaseInfoObject = JsonDocument.Parse(await Http.GetAsync<string>(AboutConst.ReleaseApiUrl, AboutClient)).RootElement;
AboutClient.DefaultRequestHeaders.Clear();
foreach (JsonProperty releaseInfoContent in releaseInfoObject.EnumerateObject())
if (releaseInfoContent.Name == "name" && releaseInfoContent.Value.ToString() != AboutConst.VersionButtonVersionContent)
AboutPres.IsSheasCealerUtd = false;
}
catch { }
});
}
private void AboutButton_Click(object sender, RoutedEventArgs e)
{