1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-25 14:46:08 +03:00

add shareLink to qrcode

This commit is contained in:
next-autumn 2021-04-19 16:02:13 +08:00
parent 95380c5e47
commit b4ad1bde74
4 changed files with 105 additions and 103 deletions

View File

@ -43,7 +43,7 @@ namespace ProxySU_Core.Models
var _port = settings.ShadowSocksPort;
var base64URL = Base64.Encode($"{_method}:{_password}@{_server}:{_port}");
return "ss://" + base64URL;
return "ss://" + base64URL + "#ShadowSocks";
}
private static string BuildVmessShareLink(XrayType xrayType, XraySettings settings)
@ -156,7 +156,7 @@ namespace ProxySU_Core.Models
if (xrayType != XrayType.Trojan_TCP)
{
// 4.3 传输层相关段
parametersURL = $"?type={_type}&encryption={_encryption}&security={_security}&host={_host}&path={HttpUtility.UrlEncode(_path)}&headerType={_headerType}";
parametersURL = $"?type={_type}&encryption={_encryption}&security={_security}&path={HttpUtility.UrlEncode(_path)}&headerType={_headerType}";
// kcp
if (xrayType == XrayType.VLESS_KCP)

View File

@ -13,7 +13,13 @@
"streamSettings": {
"network": "grpc",
"grpcSettings": {
"serviceName": ""
"serviceName": "",
"certificates": [
{
"certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
"keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
}
]
}
}
}

View File

@ -17,14 +17,13 @@
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<TabControl Grid.Column="0" BorderThickness="0,1,0,0" BorderBrush="#DDD">
<TabItem metro:HeaderedControlHelper.HeaderFontSize="20" Padding="10,5,10,5" Header="VLESS">
<TabControl
Background="#fff"
SelectionChanged="BuildQrCode"
Style="{StaticResource MaterialDesignNavigatilRailTabControl}"
Padding="10">
<TabItem Width="200"
<TabControl Grid.Column="0"
Padding="10"
BorderThickness="1,0,1,0"
BorderBrush="#DDD"
TabStripPlacement="Left"
SelectionChanged="BuildQrCode">
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VLESS_TCP_XTLS}"
IsEnabled="{Binding Settings.Checked_VLESS_TCP_XTLS}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
@ -32,15 +31,16 @@
<local:VLESS_XTLS_Control />
</TabItem>
<TabItem Width="200"
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VLESS_TCP}"
IsEnabled="{Binding Settings.Checked_VLESS_TCP}"
metro:HeaderedControlHelper.HeaderMargin="0"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="VLESS-TCP-TLS">
<local:VLESS_TCP_TLS_Control />
</TabItem>
<TabItem Width="200"
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VLESS_WS}"
IsEnabled="{Binding Settings.Checked_VLESS_WS}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
@ -48,7 +48,7 @@
<local:VLESS_WS_TLS_Control />
</TabItem>
<TabItem Width="200"
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VLESS_KCP}"
IsEnabled="{Binding Settings.Checked_VLESS_KCP}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
@ -57,72 +57,53 @@
</TabItem>
<!--<TabItem Width="200"
Tag="{x:Static models:XrayType.VLESS_gRPC}"
IsEnabled="{Binding Settings.Checked_VLESS_gRPC}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="VLESS-gRPC">
<local:VLESS_gRPC_Control />
</TabItem>-->
</TabControl>
</TabItem>
<TabItem metro:HeaderedControlHelper.HeaderFontSize="20" Padding="10,5,10,5" Header="VMESS">
<TabControl
SelectionChanged="BuildQrCode"
Padding="10"
Style="{StaticResource MaterialDesignNavigatilRailTabControl}">
<TabItem Width="200"
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VMESS_TCP}"
IsEnabled="{Binding Settings.Checked_VMESS_TCP}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="VMESS-TCP-TLS">
<local:VMESS_TCP_TLS_Control />
</TabItem>
<TabItem Width="200"
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VMESS_WS}"
IsEnabled="{Binding Settings.Checked_VMESS_WS}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="VMESS-WebSocket-TLS">
<local:VMESS_WS_TLS_Control />
</TabItem>
<TabItem Width="200"
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VMESS_KCP}"
IsEnabled="{Binding Settings.Checked_VMESS_KCP}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="VMESS-mKCP">
<local:VMESS_KCP_Control />
</TabItem>
</TabControl>
</TabItem>
<TabItem metro:HeaderedControlHelper.HeaderFontSize="20" Padding="10,5,10,5" Header="Trojan">
<TabControl
SelectionChanged="BuildQrCode"
Padding="10"
Style="{StaticResource MaterialDesignNavigatilRailTabControl}">
<TabItem Width="200"
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.Trojan_TCP}"
IsEnabled="{Binding Settings.Checked_Trojan_TCP}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="Trojan-TCP">
<local:Trojan_TCP_Control />
</TabItem>
</TabControl>
</TabItem>
<TabItem metro:HeaderedControlHelper.HeaderFontSize="20" Padding="10,5,10,5" Header="ShadowSocks">
<TabControl
SelectionChanged="BuildQrCode"
Padding="10"
Style="{StaticResource MaterialDesignNavigatilRailTabControl}">
<TabItem Width="200"
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.ShadowsocksAEAD}"
IsEnabled="{Binding Settings.CheckedShadowSocks}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="ShadowSocks">
<local:ShadowSocksControl />
</TabItem>
</TabControl>
</TabItem>
</TabControl>
<Image Grid.Column="1" Width="150" Height="150" x:Name="QrImage" />

View File

@ -36,12 +36,27 @@ namespace ProxySU_Core.Views.ClientInfo
DataContext = this;
}
private void SelectDefault(object sender, SelectionChangedEventArgs e)
{
var tabControl = e.Source as TabControl;
var item = (tabControl.SelectedItem as TabItem);
var itemControl = item.Content as ContentControl;
if (itemControl == null) return;
Console.WriteLine(itemControl.Tag);
}
private void BuildQrCode(object sender, SelectionChangedEventArgs e)
{
var tabControl = e.Source as TabControl;
var item = (tabControl.SelectedItem as TabItem);
if (item == null) return;
var type = (XrayType)item.Tag;
if (type == null) return;
BuildQrCode(type);
}
private void BuildQrCode(XrayType type)
{
string shareLink = string.Empty;
switch (type)
{