diff --git a/src/ST.Client.Desktop.Avalonia.App/ST.Client.Desktop.Avalonia.App.csproj b/src/ST.Client.Desktop.Avalonia.App/ST.Client.Desktop.Avalonia.App.csproj
index 98a6887a7..49907c73b 100644
--- a/src/ST.Client.Desktop.Avalonia.App/ST.Client.Desktop.Avalonia.App.csproj
+++ b/src/ST.Client.Desktop.Avalonia.App/ST.Client.Desktop.Avalonia.App.csproj
@@ -64,37 +64,37 @@
-
+
Properties\AssemblyInfo.cs
-
-
-
+
+
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
@@ -55,5 +55,4 @@
AppResources.Designer.cs
-
\ No newline at end of file
diff --git a/src/ST.Client.Desktop/UI/Resx/AppResources.Designer.cs b/src/ST.Client.Desktop/UI/Resx/AppResources.Designer.cs
index b679af69e..e10422989 100644
--- a/src/ST.Client.Desktop/UI/Resx/AppResources.Designer.cs
+++ b/src/ST.Client.Desktop/UI/Resx/AppResources.Designer.cs
@@ -1872,15 +1872,6 @@ namespace System.Application.UI.Resx {
}
}
- ///
- /// 查找类似 脚本市场 的本地化字符串。
- ///
- public static string Script_Shop {
- get {
- return ResourceManager.GetString("Script_Shop", resourceCulture);
- }
- }
-
///
/// 查找类似 更新脚本 的本地化字符串。
///
diff --git a/src/ST.Client.Desktop/UI/Resx/AppResources.en.resx b/src/ST.Client.Desktop/UI/Resx/AppResources.en.resx
index 4479ddc93..858dfc57b 100644
--- a/src/ST.Client.Desktop/UI/Resx/AppResources.en.resx
+++ b/src/ST.Client.Desktop/UI/Resx/AppResources.en.resx
@@ -765,9 +765,6 @@
Refresh the cache
-
- Script market
-
Update the script
@@ -978,4 +975,4 @@
GM is the basic framework and cannot be deleted
-
\ No newline at end of file
+
diff --git a/src/ST.Client.Desktop/UI/Resx/AppResources.ja.resx b/src/ST.Client.Desktop/UI/Resx/AppResources.ja.resx
index 20a83e9ce..427150d23 100644
--- a/src/ST.Client.Desktop/UI/Resx/AppResources.ja.resx
+++ b/src/ST.Client.Desktop/UI/Resx/AppResources.ja.resx
@@ -757,9 +757,6 @@
キャッシュをフラッシュします
-
- スクリプト市場
-
スクリプトを更新します
@@ -973,4 +970,4 @@
GM は基本フレームであり、削除は許可されていません
-
\ No newline at end of file
+
diff --git a/src/ST.Client.Desktop/UI/Resx/AppResources.ko.resx b/src/ST.Client.Desktop/UI/Resx/AppResources.ko.resx
index 8185539cd..9e70b80be 100644
--- a/src/ST.Client.Desktop/UI/Resx/AppResources.ko.resx
+++ b/src/ST.Client.Desktop/UI/Resx/AppResources.ko.resx
@@ -756,9 +756,6 @@
캐시를 새로 고칩니다
-
- 스크립트 마켓
-
스크립트를 업데이트합니다
@@ -972,4 +969,4 @@
GM 은 기본 프레임 인 데 삭제 가 안 돼 요
-
\ No newline at end of file
+
diff --git a/src/ST.Client.Desktop/UI/Resx/AppResources.resx b/src/ST.Client.Desktop/UI/Resx/AppResources.resx
index c9f5a9a1b..bfcb43d31 100644
--- a/src/ST.Client.Desktop/UI/Resx/AppResources.resx
+++ b/src/ST.Client.Desktop/UI/Resx/AppResources.resx
@@ -744,9 +744,6 @@
已安装此脚本确定替换已安装的版本?
-
- 脚本市场
-
更新脚本
@@ -1041,4 +1038,4 @@
起始页
-
\ No newline at end of file
+
diff --git a/src/ST.Client.Desktop/UI/Resx/AppResources.ru.resx b/src/ST.Client.Desktop/UI/Resx/AppResources.ru.resx
index 5d64964f9..1ab3cd6ba 100644
--- a/src/ST.Client.Desktop/UI/Resx/AppResources.ru.resx
+++ b/src/ST.Client.Desktop/UI/Resx/AppResources.ru.resx
@@ -756,9 +756,6 @@
Обновите кэш
-
- Рынок скриптов
-
Обновите сценарий
@@ -972,4 +969,4 @@
GM базовый шаблон не позволяет удалять
-
\ No newline at end of file
+
diff --git a/src/ST.Client.Desktop/UI/Resx/AppResources.zh-Hant.resx b/src/ST.Client.Desktop/UI/Resx/AppResources.zh-Hant.resx
index 95f830024..1ed5cb1dd 100644
--- a/src/ST.Client.Desktop/UI/Resx/AppResources.zh-Hant.resx
+++ b/src/ST.Client.Desktop/UI/Resx/AppResources.zh-Hant.resx
@@ -762,9 +762,6 @@
刷新緩存
-
- 腳本市場
-
更新腳本
@@ -978,4 +975,4 @@
GM 是基礎框架不允許删除
-
\ No newline at end of file
+
diff --git a/src/ST.Client.Desktop/UI/ViewModels/Pages/DebugPageViewModel.cs b/src/ST.Client.Desktop/UI/ViewModels/Pages/DebugPageViewModel.cs
index 15ea5c26e..5e915770f 100644
--- a/src/ST.Client.Desktop/UI/ViewModels/Pages/DebugPageViewModel.cs
+++ b/src/ST.Client.Desktop/UI/ViewModels/Pages/DebugPageViewModel.cs
@@ -16,7 +16,6 @@ using System.Linq;
using System.Security;
using System.Text;
using System.Threading.Tasks;
-using System.Windows;
using static Newtonsoft.Json.JsonConvert;
namespace System.Application.UI.ViewModels
@@ -210,26 +209,10 @@ namespace System.Application.UI.ViewModels
DebugString = @string.ToString();
}
- public /*async*/ void ShowDialogButton_Click()
+ public async void ShowDialogButton_Click()
{
#if DEBUG
- var apiBaseUrl = ICloudServiceClient.Instance.ApiBaseUrl;
- var vm = new WebView3WindowViewModel
- {
- Url = apiBaseUrl + "/ExternalLogin",
- StreamResponseFilterUrls = new[]
- {
- apiBaseUrl + "/ExternalLoginCallback"
- },
- OnStreamResponseFilterResourceLoadComplete = (url, data) =>
- {
-
- },
- FixedSinglePage = true,
- Title = AppResources.User_SteamFastLogin,
- TimeoutErrorMessage = AppResources.User_SteamFastLoginTimeoutErrorMessage,
- };
- IShowWindowService.Instance.Show(CustomWindow.WebView3, vm, resizeMode: ResizeModeCompat.NoResize);
+ await LoginOrRegisterWindowViewModel.FastLoginOrRegisterAsync();
#endif
//DI.Get().OpenDesktopIconsSettings();
diff --git a/src/ST.Client.Desktop/UI/ViewModels/Windows/LoginOrRegisterWindowViewModel.cs b/src/ST.Client.Desktop/UI/ViewModels/Windows/LoginOrRegisterWindowViewModel.cs
index fa9a6daae..a12e8d499 100644
--- a/src/ST.Client.Desktop/UI/ViewModels/Windows/LoginOrRegisterWindowViewModel.cs
+++ b/src/ST.Client.Desktop/UI/ViewModels/Windows/LoginOrRegisterWindowViewModel.cs
@@ -1,9 +1,11 @@
using ReactiveUI;
using System.Application.Models;
using System.Application.Services;
+using System.Application.Services.CloudService;
using System.Application.UI.Resx;
using System.Properties;
using System.Threading;
+using System.Threading.Tasks;
using System.Windows;
using static System.Application.Services.CloudService.Constants;
@@ -77,16 +79,64 @@ namespace System.Application.UI.ViewModels
if (response.IsSuccess)
{
- await UserService.Current.RefreshUserAsync();
- var msg = AppResources.Success_.Format((response.Content?.IsLoginOrRegister ?? false) ? AppResources.User_Login : AppResources.User_Register);
- Toast.Show(msg);
- Close?.Invoke();
+ await SuccessAsync(response.Content!, Close);
return;
}
IsLoading = false;
}
+ static async Task SuccessAsync(LoginOrRegisterResponse rsp, Action? close)
+ {
+ await UserService.Current.RefreshUserAsync();
+ var msg = AppResources.Success_.Format((rsp?.IsLoginOrRegister ?? false) ? AppResources.User_Login : AppResources.User_Register);
+ Toast.Show(msg);
+ close?.Invoke();
+ }
+
+ internal static async Task FastLoginOrRegisterAsync()
+ {
+ var apiBaseUrl = ICloudServiceClient.Instance.ApiBaseUrl;
+ var urlExternalLoginCallback = apiBaseUrl + "/ExternalLoginCallback";
+ WebView3WindowViewModel? vm = null;
+ vm = new WebView3WindowViewModel
+ {
+ Url = apiBaseUrl + "/ExternalLogin",
+ StreamResponseFilterUrls = new[]
+ {
+ urlExternalLoginCallback,
+ },
+ OnStreamResponseFilterResourceLoadComplete = _OnStreamResponseFilterResourceLoadComplete,
+ FixedSinglePage = true,
+ Title = AppResources.User_SteamFastLogin,
+ TimeoutErrorMessage = AppResources.User_SteamFastLoginTimeoutErrorMessage,
+ IsSecurity = true,
+ };
+ async void _OnStreamResponseFilterResourceLoadComplete(string url, byte[] data)
+ {
+ if (url.StartsWith(urlExternalLoginCallback, StringComparison.OrdinalIgnoreCase))
+ {
+ var response = ApiResponse.Deserialize(data);
+ if (response.IsSuccess && response.Content == null)
+ {
+ response.Code = ApiResponseCode.NoResponseContent;
+ }
+ var conn_helper = DI.Get();
+ if (response.IsSuccess)
+ {
+ await conn_helper.OnLoginedAsync(null, response.Content!);
+ await SuccessAsync(response.Content!, vm?.Close);
+ }
+ else
+ {
+ conn_helper.ShowResponseErrorMessage(response);
+ vm?.Close?.Invoke();
+ }
+ }
+ }
+ await IShowWindowService.Instance.Show(CustomWindow.WebView3, vm, resizeMode: ResizeModeCompat.NoResize);
+ }
+
public Action? Close { private get; set; }
public Action? TbPhoneNumberFocus { get; set; }
@@ -99,7 +149,6 @@ namespace System.Application.UI.ViewModels
{
if (this.TimeStart())
{
-
var request = new SendSmsRequest
{
PhoneNumber = PhoneNumber,
diff --git a/src/ST.Client.Desktop/UI/ViewModels/Windows/WebView3WindowViewModel.cs b/src/ST.Client.Desktop/UI/ViewModels/Windows/WebView3WindowViewModel.cs
index e027b5d9d..48b182b91 100644
--- a/src/ST.Client.Desktop/UI/ViewModels/Windows/WebView3WindowViewModel.cs
+++ b/src/ST.Client.Desktop/UI/ViewModels/Windows/WebView3WindowViewModel.cs
@@ -41,5 +41,9 @@ namespace System.Application.UI.ViewModels
/// 网页加载超时时提示文本
///
public string? TimeoutErrorMessage { get; set; }
+
+ public bool IsSecurity { get; set; }
+
+ public Action? Close { get; set; }
}
}
\ No newline at end of file
diff --git a/src/ST.Services.CloudService.Models/Models/ApiResponse.cs b/src/ST.Services.CloudService.Models/Models/ApiResponse.cs
index dd39d6a2a..6fd40fa38 100644
--- a/src/ST.Services.CloudService.Models/Models/ApiResponse.cs
+++ b/src/ST.Services.CloudService.Models/Models/ApiResponse.cs
@@ -39,9 +39,16 @@ namespace System.Application.Models
return (IApiResponse?)obj ?? ClientDeserializeFail();
}
+ public static IApiResponse Deserialize(byte[] buffer)
+ {
+ var type = GetDeserializeType();
+ var obj = MessagePackSerializer.Deserialize(type, buffer, options: Serializable.lz4Options);
+ return (IApiResponse?)obj ?? ClientDeserializeFail();
+ }
+
public static bool TryGetContent(
- this IApiResponse response,
- [NotNullWhen(true)] out T? content)
+ this IApiResponse response,
+ [NotNullWhen(true)] out T? content)
{
content = response.Content;
return response.IsSuccess && content != null;
diff --git a/src/ST.Services.CloudService.Models/Models/ApiResponseCode.cs b/src/ST.Services.CloudService.Models/Models/ApiResponseCode.cs
index cd2623b95..57e410640 100644
--- a/src/ST.Services.CloudService.Models/Models/ApiResponseCode.cs
+++ b/src/ST.Services.CloudService.Models/Models/ApiResponseCode.cs
@@ -1,4 +1,4 @@
-using System.Net;
+using System.Net;
namespace System.Application.Models
{
@@ -127,6 +127,8 @@ namespace System.Application.Models
///
AppObsolete,
+ RequiredWebViwe3,
+
///
/// 短信服务故障
///
diff --git a/src/ST.Services.CloudService/ServiceCollectionExtensions.cs b/src/ST.Services.CloudService/ServiceCollectionExtensions.cs
index 70dc5b866..596b27a47 100644
--- a/src/ST.Services.CloudService/ServiceCollectionExtensions.cs
+++ b/src/ST.Services.CloudService/ServiceCollectionExtensions.cs
@@ -1,4 +1,4 @@
-using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.Extensions.DependencyInjection.Extensions;
using System;
using System.Application.Services;
using System.Application.Services.CloudService;
@@ -48,6 +48,7 @@ namespace Microsoft.Extensions.DependencyInjection
;
services.TryAddSingleton();
services.TryAddSingleton(s => s.GetRequiredService());
+ services.TryAddSingleton(s => s.GetRequiredService());
if (useMock && ThisAssembly.Debuggable)
{
#if DEBUG
diff --git a/src/ST.Services.CloudService/Services/CloudService/ApiConnection.cs b/src/ST.Services.CloudService/Services/CloudService/ApiConnection.cs
index d720af794..9915139ea 100644
--- a/src/ST.Services.CloudService/Services/CloudService/ApiConnection.cs
+++ b/src/ST.Services.CloudService/Services/CloudService/ApiConnection.cs
@@ -267,11 +267,7 @@ namespace System.Application.Services.CloudService
}
void ShowResponseErrorMessage(IApiResponse response, string? errorAppendText = null)
- {
- if (response.Code == ApiResponseCode.Canceled) return;
- var message = ApiResponse.GetMessage(response, errorAppendText);
- conn_helper.ShowResponseErrorMessage(message);
- }
+ => conn_helper.ShowResponseErrorMessage(response, errorAppendText);
async Task GlobalResponseIntercept(
HttpMethod method,
diff --git a/src/ST.Services.CloudService/Services/CloudService/IApiConnectionPlatformHelper.cs b/src/ST.Services.CloudService/Services/CloudService/IApiConnectionPlatformHelper.cs
index 842fc9d8f..f9d7b122d 100644
--- a/src/ST.Services.CloudService/Services/CloudService/IApiConnectionPlatformHelper.cs
+++ b/src/ST.Services.CloudService/Services/CloudService/IApiConnectionPlatformHelper.cs
@@ -1,4 +1,4 @@
-using System.Application.Columns;
+using System.Application.Columns;
using System.Application.Models;
using System.Net.Http;
using System.Security.Cryptography;
@@ -33,6 +33,13 @@ namespace System.Application.Services.CloudService
///
void ShowResponseErrorMessage(string message);
+ void ShowResponseErrorMessage(IApiResponse response, string? errorAppendText = null)
+ {
+ if (response.Code == ApiResponseCode.Canceled) return;
+ var message = ApiResponse.GetMessage(response, errorAppendText);
+ ShowResponseErrorMessage(message);
+ }
+
HttpClient CreateClient();
RSA RSA { get; }
diff --git a/src/ST.Services.CloudService/Services/CloudService/IScriptClient.cs b/src/ST.Services.CloudService/Services/CloudService/IScriptClient.cs
index cf7c267c5..36820979a 100644
--- a/src/ST.Services.CloudService/Services/CloudService/IScriptClient.cs
+++ b/src/ST.Services.CloudService/Services/CloudService/IScriptClient.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Application.Models;
using System.Collections.Generic;
using System.Text;
@@ -14,7 +14,7 @@ namespace System.Application.Services.CloudService
///
Task> Basics(string? errormsg = null);
///
- /// 脚本市场接口
+ /// 脚本工坊接口
///
/// 脚本名称
/// 页码