1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-22 05:06:08 +03:00

修正v2ray多协议共存结果显示错误

This commit is contained in:
ProxySU 2020-11-08 09:36:07 +08:00
parent 2dcbcd1b16
commit 7736d9f4b5
4 changed files with 82 additions and 62 deletions

View File

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySU"
mc:Ignorable="d"
Title="ProxySU - v2.4.21 Beta1" Height="675" Width="650">
Title="ProxySU - v2.4.21 Beta2" Height="675" Width="650">
<!--以下样式参考自https://yq.aliyun.com/articles/331878
https://docs.microsoft.co/en-us/dotnet/desktop-wpf/fundamentals/styles-templates-overview-->
<Window.Resources>
@ -32,15 +32,11 @@
</Style>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="274*"/>
<ColumnDefinition Width="369*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="25"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Grid.ColumnSpan="2" Margin="0,0,0.333,0.333">
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"></ColumnDefinition>
<ColumnDefinition Width="1.6*"></ColumnDefinition>
@ -55,7 +51,7 @@
<TextBlock Grid.Column="3" Text="{DynamicResource MainWindowsLanguage}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5"></TextBlock>
<ComboBox x:Name="ComboBoxLanguage" Grid.Column="4" Height="20" Width="80" SelectionChanged="ComboBoxLanguage_SelectionChanged"></ComboBox>
</Grid>
<Grid Grid.ColumnSpan="2" Margin="0,25,0.333,0.333" Grid.RowSpan="2">
<Grid Grid.Row="1">
<TabControl>
<TabItem Header="{DynamicResource TabItemHeaderAppDeployment}" Width="110" Height="30">
<Grid>

View File

@ -1343,9 +1343,13 @@ namespace ProxySU
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
//备份原来的文件
//functionResult = FileCheckExists(client, @"/usr/local/etc/v2ray/config.json");
//if (functionResult == true)
//{
sshShellCommand = @"mv /usr/local/etc/v2ray/config.json /usr/local/etc/v2ray/config.json.1";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
//}
//读取配置文件各个模块
string logConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\00_log\00_log.json";
string apiConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\01_api\01_api.json";
@ -1566,11 +1570,11 @@ namespace ProxySU
jObjectJson["inbounds"][0]["settings"]["fallbacks"][3]["path"] = ReceiveConfigurationParameters[6];
//设置Vless ws Path
jObjectJson["inbounds"][1]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[3];
jObjectJson["inbounds"][2]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[3];
//设置Vmess tcp Path
jObjectJson["inbounds"][2]["streamSettings"]["tcpSettings"]["header"]["request"]["path"][0] = ReceiveConfigurationParameters[9];
jObjectJson["inbounds"][3]["streamSettings"]["tcpSettings"]["header"]["request"]["path"][0] = ReceiveConfigurationParameters[9];
//设置Vmess ws Path
jObjectJson["inbounds"][3]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
jObjectJson["inbounds"][4]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
}

View File

@ -32,6 +32,21 @@ namespace ProxySU
private static string configDomainSavePath = "";
private static string server = MainWindow.ReceiveConfigurationParameters[4];
private static string TextBoxURLDefault;
private static string TextBoxURLVlessTcp;
private static string TextBoxURLVlessWs;
private static string TextBoxURLVmessTcp;
private static string TextBoxURLVmessWs;
private static string TextBoxURLTrojanTcp;
private static BitmapSource ImageShareQRcodeDefault;
private static BitmapSource ImageShareQRcodeVlessTcp;
private static BitmapSource ImageShareQRcodeVlessWs;
private static BitmapSource ImageShareQRcodeVmessTcp;
private static BitmapSource ImageShareQRcodeVmessWs;
private static BitmapSource ImageShareQRcodeTrojanTcp;
[DllImport("user32.dll")]
private static extern int MessageBoxTimeoutA(IntPtr hWnd, string msg, string Caps, int type, int Id, int time); //引用DLL
@ -697,6 +712,8 @@ namespace ProxySU
TextBlockVmessOrVless.Visibility = Visibility.Visible;
//隐藏下面的二维码显示
HideGroupBoxClientQRandURL();
//ImageShareQRcode.Source = ImageShareQRcodeDefault;
//TextBoxURL.Text = TextBoxURLDefault;
TextBoxEncryption.Text = "none";
TextBoxTransmission.Text = "tcp";
@ -709,6 +726,7 @@ namespace ProxySU
ShowPathV2ray();
TextBoxQuicKeyMkcpSeedPath.Text = "";
}
//设置VLESS over TCP with TLS
@ -719,6 +737,8 @@ namespace ProxySU
TextBlockVmessOrVless.Visibility = Visibility.Visible;
//隐藏下面的二维码显示
HideGroupBoxClientQRandURL();
//TextBoxURL.Text = TextBoxURLVlessTcp;
//ImageShareQRcode.Source = ImageShareQRcodeVlessTcp;
TextBoxEncryption.Text = "none";
TextBoxTransmission.Text = "tcp";
@ -740,6 +760,8 @@ namespace ProxySU
TextBlockVmessOrVless.Visibility = Visibility.Visible;
//隐藏下面的二维码显示
HideGroupBoxClientQRandURL();
//TextBoxURL.Text = TextBoxURLVlessWs;
//ImageShareQRcode.Source = ImageShareQRcodeVlessWs;
TextBoxEncryption.Text = "none";
TextBoxTransmission.Text = "ws";
@ -772,6 +794,8 @@ namespace ProxySU
//显示下面的二维码显示。
//HideGroupBoxClientQRandURL();
ShowGroupBoxClientQRandURL();
TextBoxURL.Text = TextBoxURLVmessTcp;
ImageShareQRcode.Source = ImageShareQRcodeVmessTcp;
}
//设置VMess over WS with TLS
@ -790,6 +814,8 @@ namespace ProxySU
TextBoxQuicKeyMkcpSeedPath.Text = MainWindow.ReceiveConfigurationParameters[6];
TextBlockVmessOrVless.Visibility = Visibility.Collapsed;
ShowGroupBoxClientQRandURL();
TextBoxURL.Text = TextBoxURLVmessWs;
ImageShareQRcode.Source = ImageShareQRcodeVmessWs;
}
//设置Trojan over TCP with TLS
@ -799,6 +825,8 @@ namespace ProxySU
GridNotTrojanParameters.Visibility = Visibility.Collapsed;
//显示下面的二维码与分享链接
ShowGroupBoxClientQRandURL();
TextBoxURL.Text = TextBoxURLTrojanTcp;
ImageShareQRcode.Source = ImageShareQRcodeTrojanTcp;
}
#endregion
@ -1364,20 +1392,18 @@ namespace ProxySU
//生成二维码与URL跳过VlessTcpTlsWeb暂时未有URL标准
//string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
//TextBoxURL.Text = vmessUrl;
//TextBoxURLDefault = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
//TextBoxURL.Text = TextBoxURLDefault;
//using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
//{
// if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
// {
// sw.WriteLine(vmessUrl);
// }
//}
//if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
//{
// ImageShareQRcode.Source = CreateQRCode(vmessUrl, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
// sw.WriteLine(TextBoxURLDefault);
//}
// ImageShareQRcodeDefault = CreateQRCode(TextBoxURLDefault, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
// ImageShareQRcode.Source = ImageShareQRcodeDefault;
if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
{
@ -1503,20 +1529,18 @@ namespace ProxySU
//生成二维码与URL跳过VlessTcpTlsWeb暂时未有URL标准
//string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
//TextBoxURL.Text = vmessUrl;
//TextBoxURLVlessTcp = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
//TextBoxURL.Text = TextBoxURLVlessTcp;
//using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
//{
// if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
// {
// sw.WriteLine(vmessUrl);
// }
//}
//if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
//{
// ImageShareQRcode.Source = CreateQRCode(vmessUrl, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
// sw.WriteLine(TextBoxURLVlessTcp);
//}
// ImageShareQRcodeVlessTcp = CreateQRCode(TextBoxURLVlessTcp, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
// ImageShareQRcode.Source = ImageShareQRcodeVlessTcp;
if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
{
@ -1642,20 +1666,18 @@ namespace ProxySU
//生成二维码与URL跳过VlessTcpTlsWeb暂时未有URL标准
//string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
//TextBoxURL.Text = vmessUrl;
//TextBoxURLVlessWs = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
//TextBoxURL.Text = TextBoxURLVlessWs;
//using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
//{
// if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
// {
// sw.WriteLine(vmessUrl);
// }
//}
//if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
//{
// ImageShareQRcode.Source = CreateQRCode(vmessUrl, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
// sw.WriteLine(TextBoxURLVlessWs);
//}
// ImageShareQRcodeVlessWs = CreateQRCode(TextBoxURLVlessWs, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
//ImageShareQRcode.Source = ImageShareQRcodeVlessWs;
if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
{
@ -1771,15 +1793,15 @@ namespace ProxySU
//生成二维码与URL跳过VlessTcpTlsWeb暂时未有URL标准
string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
TextBoxURL.Text = vmessUrl;
TextBoxURLVmessTcp = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
//TextBoxURL.Text = TextBoxURLVmessTcp;
using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
{
sw.WriteLine(vmessUrl);
sw.WriteLine(TextBoxURLVmessTcp);
}
ImageShareQRcode.Source = CreateQRCode(vmessUrl, $"{configSavePath}\\QR.bmp");
ImageShareQRcodeVmessTcp = CreateQRCode(TextBoxURLVmessTcp, $"{configSavePath}\\QR.bmp");
//ImageShareQRcode.Source = ImageShareQRcodeVmessTcp;
if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
@ -1853,20 +1875,17 @@ namespace ProxySU
//生成二维码与URL跳过VlessTcpTlsWeb暂时未有URL标准
string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
TextBoxURL.Text = vmessUrl;
TextBoxURLVmessWs = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
//TextBoxURL.Text = TextBoxURLVmessWs;
using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
{
//if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
// {
sw.WriteLine(vmessUrl);
// }
}
// if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
// {
ImageShareQRcode.Source = CreateQRCode(vmessUrl, $"{configSavePath}\\QR.bmp");
//}
sw.WriteLine(TextBoxURLVmessWs);
}
ImageShareQRcodeVmessWs = CreateQRCode(TextBoxURLVmessWs, $"{configSavePath}\\QR.bmp");
//ImageShareQRcode.Source = ImageShareQRcodeVmessWs;
if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
{
@ -1888,16 +1907,17 @@ namespace ProxySU
string plainSavePath = @"trojan_tcp_tls_client_config";
string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
string trojanUrl = $"trojan://{TextBoxUUID.Text}@{TextBoxHostAddress.Text}:{TextBoxPort.Text}#{TextBoxHostAddress.Text}";
TextBoxURLTrojanTcp = $"trojan://{TextBoxUUID.Text}@{TextBoxHostAddress.Text}:{TextBoxPort.Text}#{TextBoxHostAddress.Text}";
TextBoxURL.Text = trojanUrl;
//TextBoxURL.Text = TextBoxURLTrojanTcp;
using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
{
sw.WriteLine(trojanUrl);
sw.WriteLine(TextBoxURLTrojanTcp);
}
ImageShareQRcode.Source = CreateQRCode(trojanUrl, $"{configSavePath}\\QR.bmp");
//ImageShareQRcode.Source = CreateQRCode(TextBoxURLTrojanTcp, $"{configSavePath}\\QR.bmp");
ImageShareQRcodeTrojanTcp = CreateQRCode(TextBoxURLTrojanTcp, $"{configSavePath}\\QR.bmp");
//ImageShareQRcode.Source = ImageShareQRcodeTrojanTcp;
//移动官方程序配置文件到相应目录
if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
{

Binary file not shown.