diff --git a/src/App/App.csproj b/src/App/App.csproj index ee13ca13b..431b28d3b 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -26,6 +26,7 @@ 0 App_TemporaryKey.pfx False + C3B9A35BB185E430F381F524A644B2598DDF2500 false diff --git a/src/App/App_TemporaryKey.pfx b/src/App/App_TemporaryKey.pfx index 2269759f8..50b9911fa 100644 Binary files a/src/App/App_TemporaryKey.pfx and b/src/App/App_TemporaryKey.pfx differ diff --git a/src/Lib/SignIn.Uwp/AuthorizeProvider/AuthorizeProvider.Extension.cs b/src/Lib/SignIn.Uwp/AuthorizeProvider/AuthorizeProvider.Extension.cs index eea101d77..2d4a310b6 100644 --- a/src/Lib/SignIn.Uwp/AuthorizeProvider/AuthorizeProvider.Extension.cs +++ b/src/Lib/SignIn.Uwp/AuthorizeProvider/AuthorizeProvider.Extension.cs @@ -2,6 +2,8 @@ using System; using System.Collections.Generic; +using System.Drawing.Imaging; +using System.IO; using System.Linq; using System.Net.Http; using System.Runtime.InteropServices.WindowsRuntime; @@ -17,13 +19,13 @@ using Bili.Models.Enums; using Bili.Toolkit.Interfaces; using Newtonsoft.Json.Linq; +using QRCoder; using Windows.Security.Cryptography.Core; using Windows.Storage; +using Windows.Storage.Streams; using Windows.UI.Xaml; using Windows.UI.Xaml.Media.Imaging; using Windows.Web.Http.Filters; -using ZXing; -using ZXing.Common; using static Bili.Models.App.Constants.ApiConstants; using static Bili.Models.App.Constants.ServiceConstants; @@ -229,7 +231,7 @@ internal async Task GetConfirmUriAsync() return null; } - internal async Task GetQRImageAsync() + internal async Task GetQRImageAsync() { try { @@ -244,17 +246,22 @@ internal async Task GetQRImageAsync() var result = await httpProvider.ParseAsync>(response); _internalQRAuthCode = result.Data.AuthCode; - var barcodeWriter = new BarcodeWriter(); - barcodeWriter.Format = BarcodeFormat.QR_CODE; - barcodeWriter.Options = new EncodingOptions() + var generator = new QRCodeGenerator(); + var data = generator.CreateQrCode(result.Data.Url, QRCodeGenerator.ECCLevel.Q); + var code = new BitmapByteQRCode(data); + var image = code.GetGraphic(20); + using (var stream = new InMemoryRandomAccessStream()) { - Margin = 1, - Height = 200, - Width = 200, - }; + using (var writer = new DataWriter(stream.GetOutputStreamAt(0))) + { + writer.WriteBytes(image); + await writer.StoreAsync(); + } - var img = barcodeWriter.Write(result.Data.Url); - return img; + var bitmap = new BitmapImage(); + await bitmap.SetSourceAsync(stream); + return bitmap; + } } catch { diff --git a/src/Lib/SignIn.Uwp/SignIn.Uwp.csproj b/src/Lib/SignIn.Uwp/SignIn.Uwp.csproj index e222b8534..56ac8056c 100644 --- a/src/Lib/SignIn.Uwp/SignIn.Uwp.csproj +++ b/src/Lib/SignIn.Uwp/SignIn.Uwp.csproj @@ -133,12 +133,12 @@ 6.2.14 + + 1.4.3 + 1.0.0 - - 0.16.8 - diff --git a/src/Lib/SignIn.Uwp/SignInDialog.xaml.cs b/src/Lib/SignIn.Uwp/SignInDialog.xaml.cs index eb82f0528..431cfc849 100644 --- a/src/Lib/SignIn.Uwp/SignInDialog.xaml.cs +++ b/src/Lib/SignIn.Uwp/SignInDialog.xaml.cs @@ -172,11 +172,12 @@ private async Task LoadQRCodeAsync() { HideQRTip(); QRLoadingRing.IsActive = true; - var imgSource = await _authorizeProvider.GetQRImageAsync(); - if (imgSource != null) + var bitmapImage = await _authorizeProvider.GetQRImageAsync(); + if (bitmapImage != null) { - QRCodeImage.Source = imgSource; + QRCodeImage.Source = bitmapImage; _authorizeProvider.StartQRLoginListener(); + QRTipBlock.Visibility = Visibility.Visible; } else { diff --git a/src/Models/Models.App/Constants/ApiConstants.cs b/src/Models/Models.App/Constants/ApiConstants.cs index 62fc6097d..e13270600 100644 --- a/src/Models/Models.App/Constants/ApiConstants.cs +++ b/src/Models/Models.App/Constants/ApiConstants.cs @@ -14,6 +14,7 @@ public static class ApiConstants public const string _vcBase = "https://api.vc.bilibili.com"; public const string _liveBase = "https://api.live.bilibili.com"; public const string _passBase = "https://passport.bilibili.com"; + public const string _passSnmBase = "https://passport.snm0516.aisee.tv"; public const string _bangumiBase = "https://bangumi.bilibili.com"; public const string _grpcBase = "https://grpc.biliapi.net"; @@ -50,12 +51,12 @@ public static class Passport /// /// 获取登录二维码. /// - public const string QRCode = _passBase + "/x/passport-tv-login/qrcode/auth_code"; + public const string QRCode = _passSnmBase + "/x/passport-tv-login/qrcode/auth_code"; /// /// 登录二维码轮询状态. /// - public const string QRCodeCheck = _passBase + "/x/passport-tv-login/qrcode/poll"; + public const string QRCodeCheck = _passSnmBase + "/x/passport-tv-login/qrcode/poll"; /// /// cookie转访问令牌.