1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-22 05:06: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 _port = settings.ShadowSocksPort;
var base64URL = Base64.Encode($"{_method}:{_password}@{_server}:{_port}"); var base64URL = Base64.Encode($"{_method}:{_password}@{_server}:{_port}");
return "ss://" + base64URL; return "ss://" + base64URL + "#ShadowSocks";
} }
private static string BuildVmessShareLink(XrayType xrayType, XraySettings settings) private static string BuildVmessShareLink(XrayType xrayType, XraySettings settings)
@ -156,7 +156,7 @@ namespace ProxySU_Core.Models
if (xrayType != XrayType.Trojan_TCP) if (xrayType != XrayType.Trojan_TCP)
{ {
// 4.3 传输层相关段 // 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 // kcp
if (xrayType == XrayType.VLESS_KCP) if (xrayType == XrayType.VLESS_KCP)

View File

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

View File

@ -16,113 +16,94 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="200" /> <ColumnDefinition Width="200" />
</Grid.ColumnDefinitions> </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"
Tag="{x:Static models:XrayType.VLESS_TCP_XTLS}"
IsEnabled="{Binding Settings.Checked_VLESS_TCP_XTLS}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="VLESS-TCP-XTLS">
<local:VLESS_XTLS_Control />
</TabItem>
<TabItem Width="200" <TabControl Grid.Column="0"
Tag="{x:Static models:XrayType.VLESS_TCP}"
IsEnabled="{Binding Settings.Checked_VLESS_TCP}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="VLESS-TCP-TLS">
<local:VLESS_TCP_TLS_Control />
</TabItem>
<TabItem Width="200"
Tag="{x:Static models:XrayType.VLESS_WS}"
IsEnabled="{Binding Settings.Checked_VLESS_WS}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="VLESS-WebSocket-TLS">
<local:VLESS_WS_TLS_Control />
</TabItem>
<TabItem Width="200"
Tag="{x:Static models:XrayType.VLESS_KCP}"
IsEnabled="{Binding Settings.Checked_VLESS_KCP}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="VLESS-mKCP">
<local:VLESS_KCP_Control />
</TabItem>
<!--<TabItem Width="200"
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" Padding="10"
Style="{StaticResource MaterialDesignNavigatilRailTabControl}"> BorderThickness="1,0,1,0"
<TabItem Width="200" BorderBrush="#DDD"
Tag="{x:Static models:XrayType.VMESS_TCP}" TabStripPlacement="Left"
IsEnabled="{Binding Settings.Checked_VMESS_TCP}" SelectionChanged="BuildQrCode">
Style="{StaticResource MaterialDesignNavigationRailTabItem}" <TabItem Width="200" Height="40"
Header="VMESS-TCP-TLS"> Tag="{x:Static models:XrayType.VLESS_TCP_XTLS}"
<local:VMESS_TCP_TLS_Control /> IsEnabled="{Binding Settings.Checked_VLESS_TCP_XTLS}"
</TabItem> Style="{StaticResource MaterialDesignNavigationRailTabItem}"
<TabItem Width="200" Header="VLESS-TCP-XTLS">
Tag="{x:Static models:XrayType.VMESS_WS}" <local:VLESS_XTLS_Control />
IsEnabled="{Binding Settings.Checked_VMESS_WS}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="VMESS-WebSocket-TLS">
<local:VMESS_WS_TLS_Control />
</TabItem>
<TabItem Width="200"
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>
<TabItem metro:HeaderedControlHelper.HeaderFontSize="20" Padding="10,5,10,5" Header="Trojan"> <TabItem Width="200" Height="40"
<TabControl Tag="{x:Static models:XrayType.VLESS_TCP}"
SelectionChanged="BuildQrCode" IsEnabled="{Binding Settings.Checked_VLESS_TCP}"
Padding="10" metro:HeaderedControlHelper.HeaderMargin="0"
Style="{StaticResource MaterialDesignNavigatilRailTabControl}"> Style="{StaticResource MaterialDesignNavigationRailTabItem}"
<TabItem Width="200" Header="VLESS-TCP-TLS">
Tag="{x:Static models:XrayType.Trojan_TCP}" <local:VLESS_TCP_TLS_Control />
IsEnabled="{Binding Settings.Checked_Trojan_TCP}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="Trojan-TCP">
<local:Trojan_TCP_Control />
</TabItem>
</TabControl>
</TabItem> </TabItem>
<TabItem metro:HeaderedControlHelper.HeaderFontSize="20" Padding="10,5,10,5" Header="ShadowSocks"> <TabItem Width="200" Height="40"
<TabControl Tag="{x:Static models:XrayType.VLESS_WS}"
SelectionChanged="BuildQrCode" IsEnabled="{Binding Settings.Checked_VLESS_WS}"
Padding="10" Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Style="{StaticResource MaterialDesignNavigatilRailTabControl}"> Header="VLESS-WebSocket-TLS">
<TabItem Width="200" <local:VLESS_WS_TLS_Control />
Tag="{x:Static models:XrayType.ShadowsocksAEAD}"
IsEnabled="{Binding Settings.CheckedShadowSocks}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="ShadowSocks">
<local:ShadowSocksControl />
</TabItem>
</TabControl>
</TabItem> </TabItem>
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VLESS_KCP}"
IsEnabled="{Binding Settings.Checked_VLESS_KCP}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="VLESS-mKCP">
<local:VLESS_KCP_Control />
</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>-->
<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" 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" 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>
<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>
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.ShadowsocksAEAD}"
IsEnabled="{Binding Settings.CheckedShadowSocks}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="ShadowSocks">
<local:ShadowSocksControl />
</TabItem>
</TabControl> </TabControl>
<Image Grid.Column="1" Width="150" Height="150" x:Name="QrImage" /> <Image Grid.Column="1" Width="150" Height="150" x:Name="QrImage" />

View File

@ -36,12 +36,27 @@ namespace ProxySU_Core.Views.ClientInfo
DataContext = this; 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) private void BuildQrCode(object sender, SelectionChangedEventArgs e)
{ {
var tabControl = e.Source as TabControl; var tabControl = e.Source as TabControl;
var item = (tabControl.SelectedItem as TabItem); var item = (tabControl.SelectedItem as TabItem);
if (item == null) return;
var type = (XrayType)item.Tag; var type = (XrayType)item.Tag;
if (type == null) return;
BuildQrCode(type);
}
private void BuildQrCode(XrayType type)
{
string shareLink = string.Empty; string shareLink = string.Empty;
switch (type) switch (type)
{ {