mirror of
https://github.com/proxysu/ProxySU.git
synced 2025-04-02 21:36:17 +03:00
实验某些功能,不成熟未能添加
This commit is contained in:
parent
8d2b21e068
commit
066356ad4b
2 changed files with 60 additions and 33 deletions
|
@ -5,7 +5,33 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ProxySU"
|
||||
mc:Ignorable="d"
|
||||
Title="ProxySU" Height="550" Width="600">
|
||||
Title="ProxySU" Height="550" Width="820">
|
||||
<!--以下样式参考自:https://yq.aliyun.com/articles/331878
|
||||
https://docs.microsoft.com/en-us/dotnet/desktop-wpf/fundamentals/styles-templates-overview-->
|
||||
<Window.Resources>
|
||||
<Style BasedOn="{StaticResource {x:Type TextBox}}"
|
||||
TargetType="TextBox"
|
||||
x:Key="TitleText">
|
||||
<Style.Triggers>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="Text" Value=""/>
|
||||
<Condition Property="TextBox.IsFocused" Value="false"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Border BorderThickness="1" BorderBrush="Gray" Margin="0">
|
||||
<TextBlock x:Name="MainTextBlock" Text="{TemplateBinding TextBox.Tag}" Width="{TemplateBinding TextBox.ActualWidth}" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</MultiTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<TabControl>
|
||||
<TabItem Header="应用布署" Width="150" Height="30">
|
||||
|
@ -32,16 +58,16 @@
|
|||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="主机名" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="0" Grid.Row="0"></TextBlock>
|
||||
<TextBlock Text="端口" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="2" Grid.Row="0"></TextBlock>
|
||||
<TextBox x:Name="TextBoxHost" Text="" Margin="5" Grid.Column="1" Grid.Row="0"></TextBox>
|
||||
<TextBox x:Name="TextBoxHost" Text="" Style="{StaticResource TitleText}" Tag="IP或域名(不可为空)" Margin="5" Grid.Column="1" Grid.Row="0"></TextBox>
|
||||
<TextBox x:Name="TextBoxPort" CommandManager.PreviewExecuted="TextBoxPort_PreviewExecuted" Text="22" Margin="5" Grid.Column="3" Grid.Row="0" PreviewTextInput="TextBoxPort_PreviewTextInput"/>
|
||||
<TextBlock Text="用户名:" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="0" Grid.Row="1"></TextBlock>
|
||||
<TextBlock x:Name="TextBlockPassword" Text="密码:" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="2" Grid.Row="1"></TextBlock>
|
||||
<TextBox x:Name="TextBoxUserName" Text="root" Margin="5" Grid.Column="1" Grid.Row="1"></TextBox>
|
||||
<PasswordBox x:Name="PasswordBoxHostPassword" Password="" Margin="5" Grid.Column="3" Grid.Row="1"></PasswordBox>
|
||||
<PasswordBox x:Name="PasswordBoxHostPassword" Password="" Margin="5" Grid.Column="3" Grid.Row="1"></PasswordBox>
|
||||
<RadioButton x:Name="RadioButtonPasswordLogin" GroupName="CertIsYesNo" Content="密码登录" Grid.Column="0" Grid.Row="2" Checked="RadioButtonPasswordLogin_Checked"></RadioButton>
|
||||
<RadioButton x:Name="RadioButtonCertLogin" GroupName="CertIsYesNo" Content="密钥登录" Grid.Column="1" Grid.Row="2" Checked="RadioButtonCertLogin_Checked"></RadioButton>
|
||||
<Button x:Name="ButtonOpenFileDialog" Content="浏览..." Margin="8" Grid.Column="2" Grid.Row="2" Click="ButtonOpenFileDialog_Click"></Button>
|
||||
<TextBox x:Name="TextBoxCertFilePath" Text="" Margin="10" Grid.Column="3" Grid.Row="2"></TextBox>
|
||||
<TextBox x:Name="TextBoxCertFilePath" Text="" Style="{StaticResource TitleText}" Tag="密钥文件存放路径(不可为空)" Margin="10" Grid.Column="3" Grid.Row="2"></TextBox>
|
||||
<!--代理设置-->
|
||||
<Grid Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="4">
|
||||
<Grid.ColumnDefinitions>
|
||||
|
@ -178,8 +204,8 @@
|
|||
<Button x:Name="ButtonWebBrowserHomePage" Content="主页" Grid.Column="0" Grid.Row="0" Margin="5" Click="ButtonWebBrowserHomePage_Click"></Button>
|
||||
<Button x:Name="ButtonWebBrowserForward" Content="前进" Grid.Column="1" Grid.Row="0" Margin="5" Click="ButtonWebBrowserForward_Click"></Button>
|
||||
<Button x:Name="ButtonWebBrowserBack" Content="后退" Grid.Column="2" Grid.Row="0" Margin="5" Click="ButtonWebBrowserBack_Click"/>
|
||||
<TextBox x:Name="TextBoxWebBrowserProxyUrl" Grid.Column="3" Grid.Row="0" Grid.ColumnSpan="5" Margin="5"></TextBox>
|
||||
<Button x:Name="ButtonWebBrowserProxyGo" Content="Go" Grid.Column="8" Grid.Row="0" Margin="5" Click="ButtonWebBrowserProxyGo_Click"></Button>
|
||||
<!--<TextBox x:Name="TextBoxWebBrowserProxyUrl" Style="{StaticResource TitleText}" Tag="粘贴被墙的网址到这里点击 GO(下面被墙网址右击==复制快捷方式)" Grid.Column="3" Grid.Row="0" Grid.ColumnSpan="5" Margin="5"></TextBox>
|
||||
<Button x:Name="ButtonWebBrowserProxyGo" Content="Go" Grid.Column="8" Grid.Row="0" Margin="5" Click="ButtonWebBrowserProxyGo_Click"></Button>-->
|
||||
<WebBrowser x:Name="WebBrowserResourcesAndTools" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="9" Grid.RowSpan="13" Source="https://github.com/proxysu/windows/wiki/ResourcesAndTools" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace ProxySU
|
|||
RadioButtonProxyNoLogin.IsChecked = true;
|
||||
RadioButtonSocks4.Visibility = Visibility.Collapsed;
|
||||
ReceiveConfigurationParameters = new string[6];
|
||||
|
||||
|
||||
}
|
||||
//远程主机连接信息
|
||||
|
@ -557,10 +558,10 @@ namespace ProxySU
|
|||
textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus);
|
||||
Thread.Sleep(1000);
|
||||
//生成服务端配置
|
||||
if (!Directory.Exists("config"))//如果不存在就创建file文件夹
|
||||
{
|
||||
Directory.CreateDirectory("config");//创建该文件夹
|
||||
}
|
||||
//if (!Directory.Exists("config"))//如果不存在就创建file文件夹
|
||||
//{
|
||||
// Directory.CreateDirectory("config");//创建该文件夹
|
||||
//}
|
||||
//string clientConfig = "TemplateConfg\\tcp_client_config.json";
|
||||
using (StreamReader reader = File.OpenText(serverConfig))
|
||||
{
|
||||
|
@ -583,19 +584,19 @@ namespace ProxySU
|
|||
|
||||
}
|
||||
|
||||
using (StreamWriter sw = new StreamWriter(@"config\config.json"))
|
||||
using (StreamWriter sw = new StreamWriter(@"config.json"))
|
||||
{
|
||||
sw.Write(serverJson.ToString());
|
||||
}
|
||||
}
|
||||
UploadConfig(connectionInfo, @"config\config.json",upLoadPath);
|
||||
UploadConfig(connectionInfo, @"config.json",upLoadPath);
|
||||
//client.RunCommand("sed -i 's/##port##/" + ReceiveConfigurationParameters[1] + "/' " + upLoadPath);
|
||||
//client.RunCommand("sed -i 's/##uuid##/" + ReceiveConfigurationParameters[2] + "/' " + upLoadPath);
|
||||
//client.RunCommand("sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath);
|
||||
////client.RunCommand("sed -i 's/##domain##/" + ReceiveConfigurationParameters[4] + "/' " + upLoadPath);
|
||||
//client.RunCommand("sed -i 's/##mkcpHeaderType##/" + ReceiveConfigurationParameters[5] + "/' " + upLoadPath);
|
||||
client.RunCommand("systemctl restart v2ray");
|
||||
File.Delete(@"config\config.json");
|
||||
File.Delete(@"config.json");
|
||||
|
||||
//打开防火墙端口
|
||||
string openFireWallPort = ReceiveConfigurationParameters[1];
|
||||
|
@ -1145,27 +1146,27 @@ namespace ProxySU
|
|||
}
|
||||
}
|
||||
|
||||
private void ButtonWebBrowserProxyGo_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string urlStartchar = TextBoxWebBrowserProxyUrl.Text.Substring(0, 4);
|
||||
MessageBox.Show(urlStartchar);
|
||||
if (String.Equals(urlStartchar,"http")==true)
|
||||
{
|
||||
WebBrowserResourcesAndTools.Source = new Uri(TextBoxWebBrowserProxyUrl.Text);
|
||||
}
|
||||
else
|
||||
{
|
||||
WebBrowserResourcesAndTools.Source = new Uri("http://"+TextBoxWebBrowserProxyUrl.Text);
|
||||
}
|
||||
//private void ButtonWebBrowserProxyGo_Click(object sender, RoutedEventArgs e)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// string urlStartchar = TextBoxWebBrowserProxyUrl.Text.Substring(0, 4);
|
||||
// //MessageBox.Show(urlStartchar);
|
||||
// if (String.Equals(urlStartchar,"http")==true)
|
||||
// {
|
||||
// WebBrowserResourcesAndTools.Source = new Uri(TextBoxWebBrowserProxyUrl.Text);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// WebBrowserResourcesAndTools.Source = new Uri("http://" + TextBoxWebBrowserProxyUrl.Text);//如果没有前置代理,此处应为:"http://" + TextBoxWebBrowserProxyUrl.Text
|
||||
// }
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// MessageBox.Show(ex.Message);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue