From b528b21cf7ec1ad8687a2f1028fe011f6cc35cb2 Mon Sep 17 00:00:00 2001 From: Aigio Liu Date: Sun, 7 Mar 2021 18:53:25 +0800 Subject: [PATCH] add new web api and test --- .github/ISSUE_TEMPLATE/bug-report.md | 1 - .github/ISSUE_TEMPLATE/feature-request.md | 2 +- .github/ISSUE_TEMPLATE/question.md | 2 +- .../NetEaseCloud/SmsSenderProvider.cs | 4 +- .../_21VianetBlueCloud/SmsSenderProvider.cs | 10 +- .../App.axaml.cs | 5 +- .../Implementation/SteamServiceImpl.cs | 2 +- .../UI/Resx/AppResources.Designer.cs | 9 ++ .../UI/Resx/AppResources.en.resx | 3 + .../UI/Resx/AppResources.ja.resx | 4 + .../UI/Resx/AppResources.resx | 3 + .../UI/Resx/AppResources.ru.resx | 3 + .../UI/Resx/AppResources.zh-Hant.resx | 3 + .../HttpTest.cs | 46 ++++++ .../SetupFixture.cs | 50 ++++++- ....Application.SteamTools.Client.Test.csproj | 3 + .../Models/ApiResponse.cs | 4 + .../Models/ApiResponseCode.cs | 5 + .../Models/ChangePhoneNumberRequest.cs | 48 +++++++ .../Properties/SR.Designer.cs | 9 ++ .../Properties/SR.en.resx | 132 ++++++++++++++++++ .../Properties/SR.resx | 3 + .../Services.CloudService/Constants.cs | 2 + .../Clients/Abstractions/IManageClient.cs | 28 ++++ .../CloudService/Clients/AccountClient.cs | 1 + .../CloudService/Clients/AuthMessageClient.cs | 1 + .../CloudService/CloudServiceClientBase.cs | 15 +- System.Common.UnitTest/Utils/Serializable2.cs | 2 +- 28 files changed, 388 insertions(+), 12 deletions(-) create mode 100644 System.Application.SteamTools.Services.CloudService.Models/Models/ChangePhoneNumberRequest.cs create mode 100644 System.Application.SteamTools.Services.CloudService.Models/Properties/SR.en.resx create mode 100644 System.Application.SteamTools.Services.CloudService/Services/CloudService/Clients/Abstractions/IManageClient.cs diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index 37e458c21..f5535ea0b 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -26,7 +26,6 @@ assignees: '' ### 🚑 基本信息(Basic Information) -- 有问题的版本(Version with issue): - 程序版本(Program Version): - 系统版本号(OS Version): diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md index c76f57e1e..b8ef44899 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.md +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -1,5 +1,5 @@ --- -name: Feature request +name: Feature request 👑 about: 对程序的需求或建议 / Suggest an idea for program title: "👑[Enhancement] " labels: enhancement diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index 116d925bc..a3595fc18 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -1,5 +1,5 @@ --- -name: question +name: question 🧐 about: 对程序使用的疑问或需要帮助 / Questions about the use of the program or need help title: "🧐[Question] " labels: question diff --git a/System.Application.Services.SmsSender/Services/Implementation/NetEaseCloud/SmsSenderProvider.cs b/System.Application.Services.SmsSender/Services/Implementation/NetEaseCloud/SmsSenderProvider.cs index d6eff72a2..99c2fe168 100644 --- a/System.Application.Services.SmsSender/Services/Implementation/NetEaseCloud/SmsSenderProvider.cs +++ b/System.Application.Services.SmsSender/Services/Implementation/NetEaseCloud/SmsSenderProvider.cs @@ -157,7 +157,7 @@ namespace System.Application.Services.Implementation.NetEaseCloud { logger.LogError( $"调用网易云短信接口失败," + - $"手机号码:{number}," + + $"手机号码:{PhoneNumberHelper.ToStringHideMiddleFour(number)}," + $"短信内容:{message}," + $"短信类型:{type}," + $"HTTP状态码:{result.HttpStatusCode}"); @@ -182,7 +182,7 @@ namespace System.Application.Services.Implementation.NetEaseCloud { logger.LogError( $"调用网易云短信验证接口失败," + - $"手机号码:{number}," + + $"手机号码:{PhoneNumberHelper.ToStringHideMiddleFour(number)}," + $"短信内容:{message}," + $"HTTP状态码:{result.HttpStatusCode}"); } diff --git a/System.Application.Services.SmsSender/Services/Implementation/_21VianetBlueCloud/SmsSenderProvider.cs b/System.Application.Services.SmsSender/Services/Implementation/_21VianetBlueCloud/SmsSenderProvider.cs index bcb1932cb..3a97014be 100644 --- a/System.Application.Services.SmsSender/Services/Implementation/_21VianetBlueCloud/SmsSenderProvider.cs +++ b/System.Application.Services.SmsSender/Services/Implementation/_21VianetBlueCloud/SmsSenderProvider.cs @@ -48,7 +48,7 @@ namespace System.Application.Services.Implementation._21VianetBlueCloud const string SignKey = "sig"; const string KeyNameKey = "skn"; const string ExpiryKey = "se"; - const string _endpoint = "https://bluecloudccs.21vbluecloud.com:443/services/sms/messages?api-version=2018-10-01"; + const string _endpoint = "https://bluecloudccs.21vbluecloud.com/services/sms/messages?api-version=2018-10-01"; /// /// create token @@ -123,6 +123,14 @@ namespace System.Application.Services.Implementation._21VianetBlueCloud using var json = new JsonTextReader(reader); jsonObject = jsonSerializer.Deserialize(json); } + else + { + logger.LogError( + $"调用世纪互联蓝云短信接口接口失败," + + $"手机号码:{PhoneNumberHelper.ToStringHideMiddleFour(number)}," + + $"短信内容:{message}," + + $"HTTP状态码:{(int)response.StatusCode}"); + } var result = new SendSmsResult { diff --git a/System.Application.SteamTools.Client.Desktop.Avalonia.App/App.axaml.cs b/System.Application.SteamTools.Client.Desktop.Avalonia.App/App.axaml.cs index f1a0b9807..43dffe07f 100644 --- a/System.Application.SteamTools.Client.Desktop.Avalonia.App/App.axaml.cs +++ b/System.Application.SteamTools.Client.Desktop.Avalonia.App/App.axaml.cs @@ -26,6 +26,7 @@ using System.Application.Models; using System.Windows.Shell; using WpfApplication = System.Windows.Application; #endif +using APIConst = System.Application.Services.CloudService.Constants; namespace System.Application.UI { @@ -116,8 +117,8 @@ namespace System.Application.UI static void IsNotOfficialChannelPackageWarning() { - var text = "The program currently running is not from the official channel."; - var title = "Warning"; + var text = APIConst.IsNotOfficialChannelPackageWarning; + var title = AppResources.Warning; MessageBoxCompat.Show(text, title, MessageBoxButtonCompat.OK, MessageBoxImageCompat.Warning); } diff --git a/System.Application.SteamTools.Client.Desktop/Services/Implementation/SteamServiceImpl.cs b/System.Application.SteamTools.Client.Desktop/Services/Implementation/SteamServiceImpl.cs index 33ad3aecd..e6a6e6fda 100644 --- a/System.Application.SteamTools.Client.Desktop/Services/Implementation/SteamServiceImpl.cs +++ b/System.Application.SteamTools.Client.Desktop/Services/Implementation/SteamServiceImpl.cs @@ -104,7 +104,7 @@ namespace System.Application.Services.Implementation var users = new List(); try { - if (File.Exists(UserVdfPath)) + if (!string.IsNullOrWhiteSpace(UserVdfPath) && File.Exists(UserVdfPath)) { // 注意:动态类型在移动端受限,且运行时可能抛出异常 dynamic v = VdfHelper.Read(UserVdfPath); diff --git a/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.Designer.cs b/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.Designer.cs index ee1e54026..5dbb836ed 100644 --- a/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.Designer.cs +++ b/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.Designer.cs @@ -312,6 +312,15 @@ namespace System.Application.UI.Resx { } } + /// + /// 查找类似 警告 的本地化字符串。 + /// + public static string Warning { + get { + return ResourceManager.GetString("Warning", resourceCulture); + } + } + /// /// 查找类似 起始页 的本地化字符串。 /// diff --git a/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.en.resx b/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.en.resx index 0125ee8fa..278ab5762 100644 --- a/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.en.resx +++ b/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.en.resx @@ -162,6 +162,9 @@ Account Change + + Warning + Start Page diff --git a/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.ja.resx b/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.ja.resx index 0125ee8fa..113e2a1f1 100644 --- a/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.ja.resx +++ b/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.ja.resx @@ -162,6 +162,10 @@ Account Change + + 警告 + 此值是日语不是中文! + Start Page diff --git a/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.resx b/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.resx index e8b69cd08..211de82b0 100644 --- a/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.resx +++ b/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.resx @@ -201,6 +201,9 @@ 账号切换 + + 警告 + 起始页 diff --git a/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.ru.resx b/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.ru.resx index 0125ee8fa..98c31222b 100644 --- a/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.ru.resx +++ b/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.ru.resx @@ -162,6 +162,9 @@ Account Change + + Предупреждение + Start Page diff --git a/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.zh-Hant.resx b/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.zh-Hant.resx index ff8d79993..62e862d69 100644 --- a/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.zh-Hant.resx +++ b/System.Application.SteamTools.Client.Desktop/UI/Resx/AppResources.zh-Hant.resx @@ -162,6 +162,9 @@ 帳號切換 + + 警告 + 起始頁 diff --git a/System.Application.SteamTools.Client.Test/HttpTest.cs b/System.Application.SteamTools.Client.Test/HttpTest.cs index 20030ecd1..1fe0cc37c 100644 --- a/System.Application.SteamTools.Client.Test/HttpTest.cs +++ b/System.Application.SteamTools.Client.Test/HttpTest.cs @@ -1,4 +1,5 @@ using NUnit.Framework; +using System.Application.Models; using System.Application.Services; using System.Linq; using System.Threading; @@ -9,6 +10,9 @@ namespace System.Application [TestFixture] public class HttpTest { + /// + /// 测试图片下载缓存,同一个图片地址,多次请求,仅发送一次,且优先从缓存中加载图片 + /// [Test] public void GetImage() { @@ -39,5 +43,47 @@ namespace System.Application TestContext.WriteLine($"({tid}-{tid2})requestUri: {requestUri}, length: {result?.Length}"); } } + +#if DEBUG + + /// + /// 测试 登陆与注册 接口,先开服务端(私有),再测试 + /// + /// + [Test] + public async Task LoginOrRegister() + { + var client = ICloudServiceClient.Instance; + + var req1 = new SendSmsRequest + { + PhoneNumber = "18611112222", + Type = SmsCodeType.LoginOrRegister, + }; + + var rsp1 = await client.AuthMessage.SendSms(req1); + + Assert.IsTrue(rsp1.IsSuccess); + + var req2 = new LoginOrRegisterRequest + { + PhoneNumber = req1.PhoneNumber, + SmsCode = "666666", + }; + var rsp2 = await ICloudServiceClient.Instance.Account.LoginOrRegister(req2); + + Assert.IsTrue(rsp2.IsSuccess); + + var isLoginOrRegister = rsp2.Content.ThrowIsNull(nameof(rsp2.Content)).IsLoginOrRegister; + + TestContext.WriteLine($"isLoginOrRegister: {isLoginOrRegister}"); + + var jsonStr = Serializable2.S(rsp2.Content); + + TestContext.WriteLine("jsonStr: "); + TestContext.WriteLine(jsonStr); + } + +#endif } } \ No newline at end of file diff --git a/System.Application.SteamTools.Client.Test/SetupFixture.cs b/System.Application.SteamTools.Client.Test/SetupFixture.cs index e5959551d..347c6cceb 100644 --- a/System.Application.SteamTools.Client.Test/SetupFixture.cs +++ b/System.Application.SteamTools.Client.Test/SetupFixture.cs @@ -1,6 +1,9 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using NUnit.Framework; +using System.Application.Models; +using System.Application.Services; +using System.Application.Services.Implementation; using System.IO; using System.Logging; @@ -18,6 +21,7 @@ namespace System.Application // all tests in the assembly are run if (!DIInit) { + ModelValidatorProvider.Init(); DI.Init(ConfigureServices); var path = AppContext.BaseDirectory; @@ -38,6 +42,9 @@ namespace System.Application // all tests in the assembly have been run } + const string DevAppVersion = "00000000000000000000000000000001"; + const string DevRSAPublicKey = "{\"v\":\"AQAB\",\"n\":\"u4iAALIX2NLyh9-GeWbBdNK2gpa1qFx1S2fFoRKuzxspTP4oyJ2uMF7xZ1yWogup-M7x3BPYrXMTzmyYTmJFDDsWt3nEl-mk6ABJ5RKeCUO1GfHXo8jvHod_pfs8gmFmyzSoYdxUp6BayXT7LkxZz9pO2ZEK2JU1dkSQKRyy_U9ceDsy9D-xsmkX2MrtYTdG51CxdFD_SrStI1YOEhbBv_A97JYJv_F5UyP2CGJ_zWG-MVWO-2Ir2AiVQMBR9PUfNweAGEAsm-AAnRHqIGHjOIMm8PqmkY4Lft2zwDE2TMcw-yUBOwYUvWanIKbO-T3KdBIc7ZbNe9Vut8aVWJa8UQ\"}"; + static void ConfigureServices(IServiceCollection services) { services.AddLogging(l => l.AddProvider(NUnitLoggerProvider.Instance)); @@ -45,8 +52,49 @@ namespace System.Application { o.MinLevel = LogLevel.Trace; }); - services.TryAddHttpPlatformHelper(); + + var options = new AppSettings + { + ApiBaseUrl = "https://localhost:5001", + AppVersion = Guid.ParseExact(DevAppVersion, "N"), + RSASecret = DevRSAPublicKey, + }; + // app 配置项 + services.TryAddOptions(options); + + // 模型验证框架 + services.TryAddModelValidator(); + + services.AddRepositories(); + + // 键值对存储 + services.TryAddStorage(); + + // 业务平台用户管理 + services.TryAddUserManager(); + + // 服务端API调用 + services.TryAddCloudServiceClient(); + + // 通用 Http 服务 services.AddHttpService(); + + PlatformToastImpl.TryAddToast(services); } } + + internal sealed class PlatformToastImpl : ToastImpl + { + public PlatformToastImpl(IToastIntercept intercept) : base(intercept) + { + } + + protected override void PlatformShow(string text, int duration) + { + Log.Info("Toast", text); + } + + public static IServiceCollection TryAddToast(IServiceCollection services) + => TryAddToast(services); + } } \ No newline at end of file diff --git a/System.Application.SteamTools.Client.Test/System.Application.SteamTools.Client.Test.csproj b/System.Application.SteamTools.Client.Test/System.Application.SteamTools.Client.Test.csproj index 663398c9e..9eed66ddf 100644 --- a/System.Application.SteamTools.Client.Test/System.Application.SteamTools.Client.Test.csproj +++ b/System.Application.SteamTools.Client.Test/System.Application.SteamTools.Client.Test.csproj @@ -16,6 +16,9 @@ Logging\NUnitLoggerProvider.cs + + Utils\Serializable2.cs + diff --git a/System.Application.SteamTools.Services.CloudService.Models/Models/ApiResponse.cs b/System.Application.SteamTools.Services.CloudService.Models/Models/ApiResponse.cs index 4866c8726..469ba1b60 100644 --- a/System.Application.SteamTools.Services.CloudService.Models/Models/ApiResponse.cs +++ b/System.Application.SteamTools.Services.CloudService.Models/Models/ApiResponse.cs @@ -51,6 +51,10 @@ namespace System.Application.Models { return SR.ApiResponseCode_Unauthorized; } + else if (code == ApiResponseCode.IsNotOfficialChannelPackage) + { + return SR.IsNotOfficialChannelPackageWarning; + } return string.Format(SR.ServerError_, (int)code); } diff --git a/System.Application.SteamTools.Services.CloudService.Models/Models/ApiResponseCode.cs b/System.Application.SteamTools.Services.CloudService.Models/Models/ApiResponseCode.cs index 156e26588..7c6142f85 100644 --- a/System.Application.SteamTools.Services.CloudService.Models/Models/ApiResponseCode.cs +++ b/System.Application.SteamTools.Services.CloudService.Models/Models/ApiResponseCode.cs @@ -111,6 +111,11 @@ namespace System.Application.Models RequiredSecurityKey, + /// + /// 当前运行程序不为官方渠道包 + /// + IsNotOfficialChannelPackage, + #endregion } } \ No newline at end of file diff --git a/System.Application.SteamTools.Services.CloudService.Models/Models/ChangePhoneNumberRequest.cs b/System.Application.SteamTools.Services.CloudService.Models/Models/ChangePhoneNumberRequest.cs new file mode 100644 index 000000000..fe2b271ba --- /dev/null +++ b/System.Application.SteamTools.Services.CloudService.Models/Models/ChangePhoneNumberRequest.cs @@ -0,0 +1,48 @@ +using System.Application.Columns; +using MPKey = MessagePack.KeyAttribute; +using MPObj = MessagePack.MessagePackObjectAttribute; +using N_JsonProperty = Newtonsoft.Json.JsonPropertyAttribute; +using S_JsonProperty = System.Text.Json.Serialization.JsonPropertyNameAttribute; + +namespace System.Application.Models +{ + /// + /// 请求 - 换绑手机 + /// + public static class ChangePhoneNumberRequest + { + public class Validation : IReadOnlySmsCode + { + [MPKey(0)] + [N_JsonProperty("0")] + [S_JsonProperty("0")] + public string? SmsCode { get; set; } + + [MPKey(1)] + [N_JsonProperty("1")] + [S_JsonProperty("1")] + public string? PhoneNumber { get; set; } + } + + public class New : IReadOnlyPhoneNumber, IReadOnlySmsCode + { + [MPKey(0)] + [N_JsonProperty("0")] + [S_JsonProperty("0")] + public string? PhoneNumber { get; set; } + + [MPKey(1)] + [N_JsonProperty("1")] + [S_JsonProperty("1")] + public string? SmsCode { get; set; } + + /// + /// 上一个接口返回的CODE + /// + [MPKey(2)] + [N_JsonProperty("2")] + [S_JsonProperty("2")] + public string? Code { get; set; } + } + } +} diff --git a/System.Application.SteamTools.Services.CloudService.Models/Properties/SR.Designer.cs b/System.Application.SteamTools.Services.CloudService.Models/Properties/SR.Designer.cs index 8e3e05ce2..e3cc9e8dd 100644 --- a/System.Application.SteamTools.Services.CloudService.Models/Properties/SR.Designer.cs +++ b/System.Application.SteamTools.Services.CloudService.Models/Properties/SR.Designer.cs @@ -69,6 +69,15 @@ namespace System.Application.Properties { } } + /// + /// 查找类似 当前运行的程序不是来自官方渠道 的本地化字符串。 + /// + internal static string IsNotOfficialChannelPackageWarning { + get { + return ResourceManager.GetString("IsNotOfficialChannelPackageWarning", resourceCulture); + } + } + /// /// 查找类似 网络连接中断 的本地化字符串。 /// diff --git a/System.Application.SteamTools.Services.CloudService.Models/Properties/SR.en.resx b/System.Application.SteamTools.Services.CloudService.Models/Properties/SR.en.resx new file mode 100644 index 000000000..75dc4d3fd --- /dev/null +++ b/System.Application.SteamTools.Services.CloudService.Models/Properties/SR.en.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Login credentials are invalid, please log in again + + + The program currently running is not from the official channel + + + Network connection lost + + + Server error {0} + + \ No newline at end of file diff --git a/System.Application.SteamTools.Services.CloudService.Models/Properties/SR.resx b/System.Application.SteamTools.Services.CloudService.Models/Properties/SR.resx index e19fb37d7..7b73b9be3 100644 --- a/System.Application.SteamTools.Services.CloudService.Models/Properties/SR.resx +++ b/System.Application.SteamTools.Services.CloudService.Models/Properties/SR.resx @@ -120,6 +120,9 @@ 登录凭证失效,请重新登录 + + 当前运行的程序不是来自官方渠道 + 网络连接中断 diff --git a/System.Application.SteamTools.Services.CloudService.Models/Services.CloudService/Constants.cs b/System.Application.SteamTools.Services.CloudService.Models/Services.CloudService/Constants.cs index ed365afc8..ef639f60f 100644 --- a/System.Application.SteamTools.Services.CloudService.Models/Services.CloudService/Constants.cs +++ b/System.Application.SteamTools.Services.CloudService.Models/Services.CloudService/Constants.cs @@ -32,5 +32,7 @@ namespace System.Application.Services.CloudService public const string Prefix_HTTPS = "https://"; public const string Prefix_HTTP = "http://"; + + public static string IsNotOfficialChannelPackageWarning => SR.IsNotOfficialChannelPackageWarning; } } \ No newline at end of file diff --git a/System.Application.SteamTools.Services.CloudService/Services/CloudService/Clients/Abstractions/IManageClient.cs b/System.Application.SteamTools.Services.CloudService/Services/CloudService/Clients/Abstractions/IManageClient.cs new file mode 100644 index 000000000..8e2e887c5 --- /dev/null +++ b/System.Application.SteamTools.Services.CloudService/Services/CloudService/Clients/Abstractions/IManageClient.cs @@ -0,0 +1,28 @@ +using System.Application.Models; +using System.Threading.Tasks; + +namespace System.Application.Services.CloudService.Clients.Abstractions +{ + public interface IManageClient + { + /// + /// 换绑手机(安全验证) + /// + /// + /// + Task> ChangeBindPhoneNumber(ChangePhoneNumberRequest.Validation request); + + /// + /// 绑定新手机号 + /// + /// + /// + Task ChangeBindPhoneNumber(ChangePhoneNumberRequest.New request); + + /// + /// 删除账号 + /// + /// + Task DeleteAccount(); + } +} \ No newline at end of file diff --git a/System.Application.SteamTools.Services.CloudService/Services/CloudService/Clients/AccountClient.cs b/System.Application.SteamTools.Services.CloudService/Services/CloudService/Clients/AccountClient.cs index 3fc045a0d..eb87c8308 100644 --- a/System.Application.SteamTools.Services.CloudService/Services/CloudService/Clients/AccountClient.cs +++ b/System.Application.SteamTools.Services.CloudService/Services/CloudService/Clients/AccountClient.cs @@ -13,6 +13,7 @@ namespace System.Application.Services.CloudService.Clients public Task> LoginOrRegister(LoginOrRegisterRequest request) => conn.SendAsync( + isSecurity: true, method: HttpMethod.Post, requestUri: "api/Account/LoginOrRegister", request: request, diff --git a/System.Application.SteamTools.Services.CloudService/Services/CloudService/Clients/AuthMessageClient.cs b/System.Application.SteamTools.Services.CloudService/Services/CloudService/Clients/AuthMessageClient.cs index 50db87fb3..4b927d602 100644 --- a/System.Application.SteamTools.Services.CloudService/Services/CloudService/Clients/AuthMessageClient.cs +++ b/System.Application.SteamTools.Services.CloudService/Services/CloudService/Clients/AuthMessageClient.cs @@ -17,6 +17,7 @@ namespace System.Application.Services.CloudService.Clients Task SendSmsCore(SendSmsRequest request) => conn.SendAsync( + isSecurity: true, method: HttpMethod.Post, requestUri: "api/AuthMessage/SendSms", request: request, diff --git a/System.Application.SteamTools.Services.CloudService/Services/CloudService/CloudServiceClientBase.cs b/System.Application.SteamTools.Services.CloudService/Services/CloudService/CloudServiceClientBase.cs index 158288e66..b99cdd3c0 100644 --- a/System.Application.SteamTools.Services.CloudService/Services/CloudService/CloudServiceClientBase.cs +++ b/System.Application.SteamTools.Services.CloudService/Services/CloudService/CloudServiceClientBase.cs @@ -32,7 +32,20 @@ namespace System.Application.Services.CloudService internal ICloudServiceSettings Settings => settings; - RSA IApiConnectionPlatformHelper.RSA => Settings.RSA; + RSA IApiConnectionPlatformHelper.RSA + { + get + { + try + { + return Settings.RSA; + } + catch + { + throw new ApiResponseCodeException(ApiResponseCode.IsNotOfficialChannelPackage); + } + } + } protected sealed override string? ClientName => ClientName_; diff --git a/System.Common.UnitTest/Utils/Serializable2.cs b/System.Common.UnitTest/Utils/Serializable2.cs index 0fe6a8ef6..d88fbc5de 100644 --- a/System.Common.UnitTest/Utils/Serializable2.cs +++ b/System.Common.UnitTest/Utils/Serializable2.cs @@ -15,7 +15,7 @@ namespace System /// public static class Serializable2 { - static readonly Lazy mDebugViewTextSettings = new Lazy(GetDebugViewTextSettings); + static readonly Lazy mDebugViewTextSettings = new(GetDebugViewTextSettings); static JsonSerializerSettings GetDebugViewTextSettings() => new JsonSerializerSettings {