From 99b2adb64690c98b236b8c83108739709ed3229f Mon Sep 17 00:00:00 2001 From: Pigeon0v0 Date: Sat, 1 Jun 2024 10:00:48 +0800 Subject: [PATCH 1/9] =?UTF-8?q?feat:=20=E5=BE=AE=E8=BD=AF=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E8=AE=BE=E5=A4=87=E4=BB=A3=E7=A0=81=E6=B5=81=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E7=A7=BB=E9=99=A4=E4=BA=86=E6=B5=8F=E8=A7=88=E5=99=A8?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Minecraft/ModLaunch.vb | 146 ++++++++---------- 1 file changed, 61 insertions(+), 85 deletions(-) diff --git a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb index 48a82285..1139dc38 100644 --- a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb +++ b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb @@ -498,16 +498,17 @@ NextInner: End If '尝试登录 Dim OAuthTokens As String() + Dim ClientId As String = "" If Input.OAuthRefreshToken = "" Then '无 RefreshToken Relogin: - Dim OAuthCode As String = MsLoginStep1(Data) + Dim OAuthCode As String = MsLoginStep1(Data, ClientId) If Data.IsAborted Then Throw New ThreadInterruptedException Data.Progress = 0.2 - OAuthTokens = MsLoginStep2(OAuthCode, False) + OAuthTokens = MsLoginStep2(OAuthCode, False, ClientId) Else '有 RefreshToken - OAuthTokens = MsLoginStep2(Input.OAuthRefreshToken, True) + OAuthTokens = MsLoginStep2(Input.OAuthRefreshToken, True, ClientId) End If '要求重新打开登录网页认证 If OAuthTokens(0) = "Relogin" Then GoTo Relogin @@ -797,100 +798,75 @@ LoginFinish: End Try End Function - '微软登录步骤 1:打开网页认证,获取 OAuth Code - Private Function MsLoginStep1(Data As LoaderTask(Of McLoginMs, McLoginResult)) As String + '微软登录步骤 1:获取 DeviceCode 并显示验证提示 + Private Function MsLoginStep1(Data As LoaderTask(Of McLoginMs, McLoginResult), ClientId As String) As String McLaunchLog("开始微软登录步骤 1") - If True OrElse OsVersion <= New Version(10, 0, 17763, 0) Then '由于 #3849,WebBrowser 已经无法正常加载微软登录网页了 -SystemBrowser: - 'Windows 7 或老版 Windows 10 登录 - OpenWebsite(FormLoginOAuth.LoginUrl1) - Dim Result As String = - MyMsgBoxInput("等待网页登录", - "登录完成后,网页会变得完全空白,把那个空白网页的网址复制到下面的框中就行了!" & vbCrLf & - "如果网络环境不佳,它可能一直加载不出来,那就只能试试用 VPN 或加速器了。", - ValidateRules:=New ObjectModel.Collection(Of Validate) From {New ValidateRegex("(?<=code\=)[^&]+", "返回网址应以 https://login.live.com/oauth20_desktop.srf?code= 开头")}, - HintText:="https://login.live.com/oauth20_desktop.srf?code=XXXXXX") - If Result Is Nothing Then - McLaunchLog("微软登录已在步骤 1 被取消") - Throw New ThreadInterruptedException("$$") - Else - Return RegexSeek(Result, "(?<=code\=)[^&]+") - End If - Hint("网页登录成功,你可以关闭浏览器啦!", HintType.Finish) - Else - 'Windows 10 登录 - Dim ReturnCode As String = Nothing - Dim ReturnEx As Exception = Nothing - Dim IsFinished As LoadState = LoadState.Loading - Dim LoginForm As FormLoginOAuth = Nothing - Dim IsSwitchToSystemBrowser As Boolean = False - RunInUi(Sub() - Try - LoginForm = New FormLoginOAuth - LoginForm.Show() - AddHandler LoginForm.OnLoginSuccess, Sub(Code As String) - ReturnCode = Code - IsFinished = LoadState.Finished - End Sub - AddHandler LoginForm.OnLoginCanceled, Sub(IsSwitch As Boolean) - IsFinished = LoadState.Aborted - IsSwitchToSystemBrowser = IsSwitch - End Sub - Catch ex As Exception - ReturnEx = ex - IsFinished = LoadState.Failed - End Try - End Sub) - Do While IsFinished = LoadState.Loading AndAlso Not Data.IsAborted - Thread.Sleep(20) - Loop - RunInUi(Sub() If LoginForm IsNot Nothing Then LoginForm.Close()) - If IsFinished = LoadState.Finished Then - Return ReturnCode - ElseIf IsFinished = LoadState.Failed Then - Throw ReturnEx - ElseIf IsSwitchToSystemBrowser Then - McLaunchLog("微软登录在步骤 1 要求切换到系统浏览器") - GoTo SystemBrowser - Else - McLaunchLog("微软登录已在步骤 1 被取消") - Throw New ThreadInterruptedException("$$") - End If - End If + + Dim DeviceCode As String + Dim UserCode As String + Dim VerifyUri As String + Dim ExpiresIn As String + Dim Request As String = "client_id=" & ClientId & "&" & "scope=XboxLive.signin%20offline_access" + Dim Result As String = NetRequestMulty("https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode", "POST", Request, "application/x-www-form-urlencoded", 2) + + Dim ResultJson As JObject = GetJson(Result) + DeviceCode = ResultJson("device_code") + UserCode = ResultJson("user_code") + VerifyUri = ResultJson("verification_uri") + ExpiresIn = ResultJson("expires_in") + ClipboardSet(UserCode) + OpenWebsite(VerifyUri) + MyMsgBox("请在打开的网页里输入 PCL2 提供的设备代码并登录微软账户,然后允许 PCL2 访问相关信息。" & vbCrLf & "设备代码有时效性,若操作时间过长需要重新进行登录流程。" & vbCrLf & vbCrLf & "本次验证的设备代码为:" & UserCode & vbCrLf & vbCrLf & "你也可以在任意设备上打开下列网址进行验证:" & vbCrLf & VerifyUri & vbCrLf & vbCrLf & "请在完成后点击继续。", "正版验证", "继续") + Return DeviceCode End Function + '微软登录步骤 2:从 OAuth Code 或 OAuth RefreshToken 获取 {OAuth AccessToken, OAuth RefreshToken} - Private Function MsLoginStep2(Code As String, IsRefresh As Boolean) As String() + Private Function MsLoginStep2(Code As String, IsRefresh As Boolean, ClientId As String, Optional ExpiresIn As String = "900") As String() McLaunchLog("开始微软登录步骤 2(" & If(IsRefresh, "", "非") & "刷新登录)") Dim Request As String If IsRefresh Then - Request = "client_id=00000000402b5328" & "&" & + Request = "grant_type=refresh_token" & "&" & + "client_id=" & ClientId & "&" & + "device_code=" & Code & "&" & "refresh_token=" & Uri.EscapeDataString(Code) & "&" & - "grant_type=refresh_token" & "&" & - "redirect_uri=" & Uri.EscapeDataString("https://login.live.com/oauth20_desktop.srf") & "&" & - "scope=" & Uri.EscapeDataString("service::user.auth.xboxlive.com::MBI_SSL") + "scope=XboxLive.signin%20offline_access" Else - Request = "client_id=00000000402b5328" & "&" & - "code=" & Uri.EscapeDataString(Code) & "&" & - "grant_type=authorization_code" & "&" & - "redirect_uri=" & Uri.EscapeDataString("https://login.live.com/oauth20_desktop.srf") & "&" & - "scope=" & Uri.EscapeDataString("service::user.auth.xboxlive.com::MBI_SSL") + Request = "grant_type=urn:ietf:params:oauth:grant-type:device_code" & "&" & + "client_id=" & ClientId & "&" & + "device_code=" & Code & "&" & + "scope=XboxLive.signin%20offline_access" End If Dim Result As String - Try - Result = NetRequestMulty("https://login.live.com/oauth20_token.srf", "POST", Request, "application/x-www-form-urlencoded", 2) - Catch ex As Exception - If ex.Message.Contains("must sign in again") OrElse ex.Message.Contains("invalid_grant") Then '#269 - Return {"Relogin", ""} - Else - Throw + Dim stopwatch As Stopwatch = Stopwatch.StartNew() + + While stopwatch.Elapsed < TimeSpan.FromSeconds(ExpiresIn) + Try + Result = NetRequestMulty("https://login.microsoftonline.com/consumers/oauth2/v2.0/token", "POST", Request, "application/x-www-form-urlencoded", 2) + Catch ex As Exception + If ex.Message.Contains("must sign in again") OrElse ex.Message.Contains("invalid_grant") Then '#269 + Return {"Relogin", ""} + ElseIf ex.Message.Contains("authorization_declined") Then + Hint("你取消了验证过程!") + ElseIf ex.Message.Contains("expired_token") Then + Hint("设备代码已过期,请尝试重新验证!") + ElseIf ex.Message.Contains("AADSTS70016") Then + Continue While + Else + Throw + End If + End Try + + If Result IsNot Nothing Then + Dim ResultJson As JObject = GetJson(Result) + Dim AccessToken As String = ResultJson("access_token").ToString + Dim RefreshToken As String = ResultJson("refresh_token").ToString + Return {AccessToken, RefreshToken} End If - End Try + End While + + Hint("验证超时,请尝试重新验证!") - Dim ResultJson As JObject = GetJson(Result) - Dim AccessToken As String = ResultJson("access_token").ToString - Dim RefreshToken As String = ResultJson("refresh_token").ToString - Return {AccessToken, RefreshToken} End Function '微软登录步骤 3:从 OAuth AccessToken 获取 XBLToken Private Function MsLoginStep3(AccessToken As String) As String @@ -900,7 +876,7 @@ SystemBrowser: ""Properties"": { ""AuthMethod"": ""RPS"", ""SiteName"": ""user.auth.xboxlive.com"", - ""RpsTicket"": """ & AccessToken & """ + ""RpsTicket"": ""d=" & AccessToken & """ }, ""RelyingParty"": ""http://auth.xboxlive.com"", ""TokenType"": ""JWT"" From 236557ab9eada3562dfa23f2b243f6effe625e68 Mon Sep 17 00:00:00 2001 From: Pigeon0v0 Date: Sat, 1 Jun 2024 10:32:09 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=94=B9=E4=BA=86=E6=94=B9=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E8=AE=A9=E7=94=A8=E6=88=B7=E7=9F=A5=E9=81=93?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=E8=AE=BE=E5=A4=87=E4=BB=A3=E7=A0=81=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E5=88=B0=E5=89=AA=E8=B4=B4=E6=9D=BF=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb index 1139dc38..b537a2e9 100644 --- a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb +++ b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb @@ -816,7 +816,7 @@ LoginFinish: ExpiresIn = ResultJson("expires_in") ClipboardSet(UserCode) OpenWebsite(VerifyUri) - MyMsgBox("请在打开的网页里输入 PCL2 提供的设备代码并登录微软账户,然后允许 PCL2 访问相关信息。" & vbCrLf & "设备代码有时效性,若操作时间过长需要重新进行登录流程。" & vbCrLf & vbCrLf & "本次验证的设备代码为:" & UserCode & vbCrLf & vbCrLf & "你也可以在任意设备上打开下列网址进行验证:" & vbCrLf & VerifyUri & vbCrLf & vbCrLf & "请在完成后点击继续。", "正版验证", "继续") + MyMsgBox("请在打开的网页里输入 PCL2 提供的设备代码(已经复制到剪贴板)并登录微软账户,然后允许 PCL2 访问相关信息。" & vbCrLf & "设备代码有时效性,若操作时间过长需要重新进行登录流程。" & vbCrLf & vbCrLf & "本次验证的设备代码为:" & UserCode & vbCrLf & vbCrLf & "你也可以在任意设备上打开下列网址进行验证:" & vbCrLf & VerifyUri & vbCrLf & vbCrLf & "请在完成后点击继续。", "正版验证", "继续") Return DeviceCode End Function @@ -849,7 +849,7 @@ LoginFinish: ElseIf ex.Message.Contains("authorization_declined") Then Hint("你取消了验证过程!") ElseIf ex.Message.Contains("expired_token") Then - Hint("设备代码已过期,请尝试重新验证!") + Hint("Token 已过期,请尝试重新验证!") ElseIf ex.Message.Contains("AADSTS70016") Then Continue While Else From 8b5187bff41aff86a64db0ee07cb8d97ef37f635 Mon Sep 17 00:00:00 2001 From: Pigeon0v0 Date: Sat, 1 Jun 2024 11:44:15 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E5=8A=A0=E4=BA=86=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E5=B9=B6=E6=94=AF=E6=8C=81=E5=8F=96=E6=B6=88?= =?UTF-8?q?=EF=BC=8C=E5=8A=A0=E4=BA=86=E8=BD=AE=E8=AF=A2=E9=A2=91=E7=8E=87?= =?UTF-8?q?=EF=BC=8C=E5=8A=A0=E4=BA=86=E4=B8=80=E4=BA=9B=E5=85=9C=E5=BA=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Minecraft/ModLaunch.vb | 48 ++++++++++++------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb index b537a2e9..9cd57eca 100644 --- a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb +++ b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb @@ -503,6 +503,9 @@ NextInner: '无 RefreshToken Relogin: Dim OAuthCode As String = MsLoginStep1(Data, ClientId) + If OAuthCode = "Cancel" Then + Exit Sub + End If If Data.IsAborted Then Throw New ThreadInterruptedException Data.Progress = 0.2 OAuthTokens = MsLoginStep2(OAuthCode, False, ClientId) @@ -511,6 +514,7 @@ Relogin: OAuthTokens = MsLoginStep2(Input.OAuthRefreshToken, True, ClientId) End If '要求重新打开登录网页认证 + If OAuthTokens(0) = "Cancel" Then Exit Sub If OAuthTokens(0) = "Relogin" Then GoTo Relogin Data.Progress = 0.35 If Data.IsAborted Then Throw New ThreadInterruptedException @@ -800,24 +804,29 @@ LoginFinish: '微软登录步骤 1:获取 DeviceCode 并显示验证提示 Private Function MsLoginStep1(Data As LoaderTask(Of McLoginMs, McLoginResult), ClientId As String) As String - McLaunchLog("开始微软登录步骤 1") + If MyMsgBox("请在打开的网页里输入 PCL2 提供的设备代码(会自动复制到剪贴板)并登录微软账户,然后允许 PCL2 访问相关信息。" & vbCrLf & "设备代码有时效性,若操作时间过长需要重新进行登录流程。", "正版验证确认", "继续", "取消") = 1 Then + McLaunchLog("开始微软登录步骤 1") - Dim DeviceCode As String - Dim UserCode As String - Dim VerifyUri As String - Dim ExpiresIn As String - Dim Request As String = "client_id=" & ClientId & "&" & "scope=XboxLive.signin%20offline_access" - Dim Result As String = NetRequestMulty("https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode", "POST", Request, "application/x-www-form-urlencoded", 2) + Dim DeviceCode As String + Dim UserCode As String + Dim VerifyUri As String + Dim ExpiresIn As String + Dim Request As String = "client_id=" & ClientId & "&" & "scope=XboxLive.signin%20offline_access" + Dim Result As String = NetRequestMulty("https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode", "POST", Request, "application/x-www-form-urlencoded", 2) - Dim ResultJson As JObject = GetJson(Result) - DeviceCode = ResultJson("device_code") - UserCode = ResultJson("user_code") - VerifyUri = ResultJson("verification_uri") - ExpiresIn = ResultJson("expires_in") - ClipboardSet(UserCode) - OpenWebsite(VerifyUri) - MyMsgBox("请在打开的网页里输入 PCL2 提供的设备代码(已经复制到剪贴板)并登录微软账户,然后允许 PCL2 访问相关信息。" & vbCrLf & "设备代码有时效性,若操作时间过长需要重新进行登录流程。" & vbCrLf & vbCrLf & "本次验证的设备代码为:" & UserCode & vbCrLf & vbCrLf & "你也可以在任意设备上打开下列网址进行验证:" & vbCrLf & VerifyUri & vbCrLf & vbCrLf & "请在完成后点击继续。", "正版验证", "继续") - Return DeviceCode + Dim ResultJson As JObject = GetJson(Result) + DeviceCode = ResultJson("device_code") + UserCode = ResultJson("user_code") + VerifyUri = ResultJson("verification_uri") + ExpiresIn = ResultJson("expires_in") + ClipboardSet(UserCode) + OpenWebsite(VerifyUri) + + MyMsgBox("本次验证的设备代码为:" & UserCode & vbCrLf & vbCrLf & "你也可以在任意设备上打开下列网址进行验证:" & vbCrLf & VerifyUri & vbCrLf & vbCrLf & "请在完成后点击继续。", "正版验证", "继续") + Return DeviceCode + Else + Return "Cancel" + End If End Function '微软登录步骤 2:从 OAuth Code 或 OAuth RefreshToken 获取 {OAuth AccessToken, OAuth RefreshToken} @@ -847,9 +856,11 @@ LoginFinish: If ex.Message.Contains("must sign in again") OrElse ex.Message.Contains("invalid_grant") Then '#269 Return {"Relogin", ""} ElseIf ex.Message.Contains("authorization_declined") Then - Hint("你取消了验证过程!") + Hint("你拒绝了 PCL2 的访问权限申请,验证过程被中断!") + Return {"Cancel", ""} ElseIf ex.Message.Contains("expired_token") Then Hint("Token 已过期,请尝试重新验证!") + Exit While ElseIf ex.Message.Contains("AADSTS70016") Then Continue While Else @@ -863,9 +874,12 @@ LoginFinish: Dim RefreshToken As String = ResultJson("refresh_token").ToString Return {AccessToken, RefreshToken} End If + + Thread.Sleep(1000) End While Hint("验证超时,请尝试重新验证!") + Return {"Cancel", ""} End Function '微软登录步骤 3:从 OAuth AccessToken 获取 XBLToken From dea21c27c5142bd3296809ba11c3b326eb782a27 Mon Sep 17 00:00:00 2001 From: Pigeon0v0 Date: Sat, 1 Jun 2024 11:58:04 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E6=94=B9=E4=BA=86=E6=94=B9=E6=96=87?= =?UTF-8?q?=E6=A1=88=E9=81=BF=E5=85=8D=E8=AF=AF=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb index 9cd57eca..1ba5d582 100644 --- a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb +++ b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb @@ -822,7 +822,7 @@ LoginFinish: ClipboardSet(UserCode) OpenWebsite(VerifyUri) - MyMsgBox("本次验证的设备代码为:" & UserCode & vbCrLf & vbCrLf & "你也可以在任意设备上打开下列网址进行验证:" & vbCrLf & VerifyUri & vbCrLf & vbCrLf & "请在完成后点击继续。", "正版验证", "继续") + MyMsgBox("本次验证的设备代码为:" & UserCode & vbCrLf & vbCrLf & "你也可以在任意设备上打开下列网址进行验证:" & vbCrLf & VerifyUri & vbCrLf & vbCrLf & "在验证完成后,你可以直接关闭这个弹窗,PCL2 会自动完成接下来的流程。", "正版验证", "关闭") Return DeviceCode Else Return "Cancel" From 96b0018adf47d6e4d89cb9939a4c68c5aa8b2b2f Mon Sep 17 00:00:00 2001 From: Pigeon0v0 Date: Sun, 16 Jun 2024 06:43:13 +0800 Subject: [PATCH 5/9] =?UTF-8?q?chores:=20=E5=BC=80=E6=BA=90=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=8F=90=E7=A4=BA=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plain Craft Launcher 2/Modules/ModSecret.vb | 1 + 1 file changed, 1 insertion(+) diff --git a/Plain Craft Launcher 2/Modules/ModSecret.vb b/Plain Craft Launcher 2/Modules/ModSecret.vb index d60f9524..3cc27573 100644 --- a/Plain Craft Launcher 2/Modules/ModSecret.vb +++ b/Plain Craft Launcher 2/Modules/ModSecret.vb @@ -42,6 +42,7 @@ Friend Module ModSecret End If '开源版本提示 MyMsgBox($"该版本中不包含以下特性: +- 微软账户登录:需要 Client ID(你可以创建并申请一个,然后添加到 McLoginMsStart 方法中) - CurseForge 查询:需要 API Key(你可以申请一个,然后添加到 SecretHeadersSign 方法中) - 更新与联网通知:避免滥用隐患 - 主题切换:这是需要赞助解锁的纪念性质的功能,别让赞助者太伤心啦…… From 4ae3e4aa202074c395230631f701bfe1e5de05c2 Mon Sep 17 00:00:00 2001 From: Pigeon0v0 Date: Thu, 18 Jul 2024 10:46:50 +0800 Subject: [PATCH 6/9] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E8=AE=BE=E5=A4=87=E4=BB=A3=E7=A0=81=E5=92=8C=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=BD=91=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Minecraft/ModLaunch.vb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb index f17b8dd2..2067e777 100644 --- a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb +++ b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb @@ -822,7 +822,20 @@ LoginFinish: ClipboardSet(UserCode) OpenWebsite(VerifyUri) - MyMsgBox("本次验证的设备代码为:" & UserCode & vbCrLf & vbCrLf & "你也可以在任意设备上打开下列网址进行验证:" & vbCrLf & VerifyUri & vbCrLf & vbCrLf & "在验证完成后,你可以直接关闭这个弹窗,PCL2 会自动完成接下来的流程。", "正版验证", "关闭") + Dim MsgBoxValue As String = "" + While MsgBoxValue IsNot "1" + MsgBoxValue = MyMsgBox("本次验证的设备代码为:" & UserCode & vbCrLf & vbCrLf & "你也可以在任意设备上打开下列网址进行验证:" & vbCrLf & VerifyUri & vbCrLf & vbCrLf & "在验证完成后,你可以直接关闭这个弹窗,PCL2 会自动完成接下来的流程。", "正版验证", "关闭", "复制网址", "复制设备代码").ToString + If MsgBoxValue = "2" Then + ClipboardSet(VerifyUri) + Continue While + ElseIf MsgBoxValue = "3" Then + ClipboardSet(UserCode) + Continue While + ElseIf MsgBoxValue = "1" Then + Exit While + End If + End While + Return DeviceCode Else Return "Cancel" From 0bbb048c59f67bae9faab8871660535987f16f20 Mon Sep 17 00:00:00 2001 From: Pigeon0v0 Date: Tue, 30 Jul 2024 21:42:42 +0800 Subject: [PATCH 7/9] =?UTF-8?q?feat(auth):=20=E6=89=93=E5=BC=80=E7=9A=84?= =?UTF-8?q?=E5=BE=AE=E8=BD=AF=E9=AA=8C=E8=AF=81=E7=BD=91=E9=A1=B5=E7=8E=B0?= =?UTF-8?q?=E5=9C=A8=E4=BC=9A=E8=87=AA=E5=8A=A8=E5=A1=AB=E5=85=A5=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb index 2067e777..b39c248f 100644 --- a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb +++ b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb @@ -820,7 +820,7 @@ LoginFinish: VerifyUri = ResultJson("verification_uri") ExpiresIn = ResultJson("expires_in") ClipboardSet(UserCode) - OpenWebsite(VerifyUri) + OpenWebsite(VerifyUri + "?oct=" + UserCode) Dim MsgBoxValue As String = "" While MsgBoxValue IsNot "1" From 22746c3ca9fdb76f491cc063341d206327210bbf Mon Sep 17 00:00:00 2001 From: Pigeon0v0 <60414767+Pigeon0v0@users.noreply.github.com> Date: Wed, 31 Jul 2024 06:59:07 +0800 Subject: [PATCH 8/9] fix: typo Co-authored-by: 3gf8jv4dv <158490944+3gf8jv4dv@users.noreply.github.com> --- Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb index b39c248f..14640c29 100644 --- a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb +++ b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb @@ -820,7 +820,7 @@ LoginFinish: VerifyUri = ResultJson("verification_uri") ExpiresIn = ResultJson("expires_in") ClipboardSet(UserCode) - OpenWebsite(VerifyUri + "?oct=" + UserCode) + OpenWebsite(VerifyUri + "?otc=" + UserCode) Dim MsgBoxValue As String = "" While MsgBoxValue IsNot "1" From 5598ff3239523c6b01db42efbc59511c888f0f7a Mon Sep 17 00:00:00 2001 From: Pigeon0v0 <60414767+Pigeon0v0@users.noreply.github.com> Date: Tue, 13 Aug 2024 21:57:24 +0800 Subject: [PATCH 9/9] =?UTF-8?q?fix:=20=E6=96=B0=E5=A2=9E=E7=9A=84=20otc=20?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=8F=AF=E8=83=BD=E5=AF=BC=E8=87=B4=E7=BD=91?= =?UTF-8?q?=E9=A1=B5=E6=97=A0=E6=B3=95=E6=89=93=E5=BC=80=EF=BC=8C=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E6=96=B9=E6=A1=88=E6=98=AF=E5=8E=BB=E6=8E=89=E4=BA=86?= =?UTF-8?q?=E8=BF=99=E4=B8=AA=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb index 14640c29..2067e777 100644 --- a/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb +++ b/Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb @@ -820,7 +820,7 @@ LoginFinish: VerifyUri = ResultJson("verification_uri") ExpiresIn = ResultJson("expires_in") ClipboardSet(UserCode) - OpenWebsite(VerifyUri + "?otc=" + UserCode) + OpenWebsite(VerifyUri) Dim MsgBoxValue As String = "" While MsgBoxValue IsNot "1"