Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<local:MyPageRight
<local:MyPageRight
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Expand Down Expand Up @@ -189,7 +189,10 @@
</Grid.ColumnDefinitions>
<local:MyButton x:Name="BtnServerNideWeb" Grid.Column="0" MinWidth="140" Text="服主后台" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" ColorType="Highlight" />
</Grid>
<local:MyButton x:Name="BtnServerAuthLittle" Height="35" MinWidth="150" Margin="0,12,0,0" Text="设置为 LittleSkin" HorizontalAlignment="Left" ColorType="Highlight" />
<StackPanel x:Name="PanServerAuth" Orientation="Horizontal">
<local:MyButton x:Name="BtnServerAuthDetect" Height="35" MinWidth="150" Margin="0,12,20,0" Text="设置为服务器默认" HorizontalAlignment="Left" ColorType="Highlight" ToolTip="请求认证服务器,以此获取并自动填写信息。&#xA;此为可选选项,认证服务器可能并不会提供这些信息。"/>
<local:MyButton x:Name="BtnServerAuthLittle" Height="35" MinWidth="150" Margin="0,12,0,0" Text="设置为 LittleSkin" HorizontalAlignment="Left" ColorType="Highlight" />
</StackPanel>
</StackPanel>
</local:MyCard>
<local:MyCard x:Name="CardAdvance" Margin="0,0,0,15" Title="高级选项" IsSwapped="True" CanSwap="True">
Expand Down Expand Up @@ -239,4 +242,4 @@
LogoScale="0.9" Logo="M73 584L920 584 608 896C579 925 579 972 608 1001 637 1030 683 1030 712 1001L1149 565C1164 550 1170 531 1170 511 1170 492 1164 472 1149 457L712 21C683-7 637-7 608 21 579 50 579 97 608 126L920 438 73 438C33 438 0 471 0 511 0 551 33 584 73 584Z" />
</StackPanel>
</local:MyScrollViewer>
</local:MyPageRight>
</local:MyPageRight>
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ PreFin:
TextServerAuthRegister.Visibility = If(Type = 4, Visibility.Visible, Visibility.Collapsed)
LabServerAuthServer.Visibility = If(Type = 4, Visibility.Visible, Visibility.Collapsed)
TextServerAuthServer.Visibility = If(Type = 4, Visibility.Visible, Visibility.Collapsed)
BtnServerAuthLittle.Visibility = If(Type = 4, Visibility.Visible, Visibility.Collapsed)
PanServerAuth.Visibility = If(Type = 4, Visibility.Visible, Visibility.Collapsed)
CardServer.TriggerForceResize()
End Sub

Expand All @@ -400,6 +400,41 @@ PreFin:
OpenWebsite("https://login.mc-user.com:233/server/intro")
End Sub

'自动填写信息
Private Sub BtnServerAuthDetect_Click(sender As Object, e As EventArgs) Handles BtnServerAuthDetect.Click
If TextServerAuthServer.Text = "" Then
Hint("请先设置认证服务器!", HintType.Red)
Return
End If
If MyMsgBox("即将把第三方登录设置覆盖为认证服务器提供的信息。" & vbCrLf & "请务必确保认证服务器地址正确。" & vbCrLf & vbCrLf & "是否确实要覆盖当前设置?", "设置覆盖确认", "继续", "取消") = 2 Then Return
RunInNewThread(Sub()
Try
Dim AuthServer As String = Dispatcher.Invoke(Function()
TextServerAuthName.IsEnabled = False
TextServerAuthRegister.IsEnabled = False
Return TextServerAuthServer.Text
End Function)
Dim Result = NetRequestByClientRetry(
AuthServer & "?lang=zh_CN", HttpMethod.Get,
ContentType:="application/json",
RequireJson:=True)
'获取结果
Dim ResultJson As JObject = GetJson(Result)
RunInUi(Sub()
TextServerAuthName.Text = ResultJson("meta")("serverName").ToString & " 登录"
TextServerAuthRegister.Text = ResultJson("meta")("links")("register").ToString
End Sub)
Hint("信息获取成功!", HintType.Green)
Catch ex As Exception
Hint("信息获取失败,还是手动输入吧......", HintType.Red)
Finally
RunInUi(Sub()
TextServerAuthName.IsEnabled = True
TextServerAuthRegister.IsEnabled = True
End Sub)
End Try
End Sub)
End Sub
'LittleSkin
Private Sub BtnServerAuthLittle_Click(sender As Object, e As EventArgs) Handles BtnServerAuthLittle.Click
If TextServerAuthServer.Text <> "" AndAlso TextServerAuthServer.Text <> "https://littleskin.cn/api/yggdrasil" AndAlso
Expand Down