mirror of
https://github.com/proxysu/ProxySU.git
synced 2024-11-25 06:36:08 +03:00
fix bugs
This commit is contained in:
parent
69b29fce21
commit
e85a0b93bf
@ -60,9 +60,12 @@ namespace ProxySuper.Core.Services
|
||||
Progress.Step = $"{index++}. 启动BBR";
|
||||
EnableBBR();
|
||||
|
||||
Progress.Desc = "重启Caddy服务";
|
||||
RunCmd("systemctl restart caddy");
|
||||
|
||||
Progress.Percentage = 100;
|
||||
Progress.Step = "NaiveProxy安装成功";
|
||||
Progress.Desc = "NaiveProxy安装成功";
|
||||
Progress.Desc = string.Empty;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -117,10 +120,12 @@ namespace ProxySuper.Core.Services
|
||||
Progress.Percentage = 30;
|
||||
|
||||
UploadCaddySettings();
|
||||
Progress.Desc = "重启Caddy服务";
|
||||
RunCmd("systemctl restart caddy");
|
||||
Progress.Percentage = 100;
|
||||
|
||||
Progress.Step = "更新配置成功";
|
||||
Progress.Desc = "更新配置成功";
|
||||
Progress.Desc = string.Empty;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -233,9 +238,6 @@ namespace ProxySuper.Core.Services
|
||||
|
||||
Progress.Desc = "上传配置文件";
|
||||
WriteToFile(caddyStr, "/etc/caddy/Caddyfile");
|
||||
|
||||
Progress.Desc = "重启Caddy服务";
|
||||
RunCmd("systemctl restart caddy");
|
||||
}
|
||||
|
||||
private string BuildConfig(bool useCustomWeb = false)
|
||||
|
@ -72,13 +72,16 @@ namespace ProxySuper.Core.Services
|
||||
UploadCaddySettings();
|
||||
Progress.Percentage = 90;
|
||||
|
||||
|
||||
Progress.Step = $"{index++}. 启动BBR";
|
||||
EnableBBR();
|
||||
|
||||
Progress.Desc = "启用Trojan-Go开机启动";
|
||||
RunCmd("systemctl enable trojan-go");
|
||||
RunCmd("systemctl restart trojan-go");
|
||||
|
||||
Progress.Percentage = 100;
|
||||
Progress.Step = "安装成功";
|
||||
Progress.Desc = "安装成功";
|
||||
Progress.Desc = string.Empty;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -122,7 +125,7 @@ namespace ProxySuper.Core.Services
|
||||
|
||||
Progress.Percentage = 100;
|
||||
Progress.Step = "卸载Trojan-Go成功";
|
||||
Progress.Desc = "卸载Trojan-Go成功";
|
||||
Progress.Desc = string.Empty;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -144,8 +147,10 @@ namespace ProxySuper.Core.Services
|
||||
Progress.Desc = "更新配置文件";
|
||||
UploadTrojanGoSettings();
|
||||
|
||||
Progress.Desc = "重启Trojan-Go服务器";
|
||||
RunCmd("systemctl restart trojan-go");
|
||||
|
||||
Progress.Percentage = 100;
|
||||
Progress.Step = "更新配置成功";
|
||||
Progress.Desc = "更新配置成功";
|
||||
}
|
||||
|
||||
@ -331,10 +336,6 @@ namespace ProxySuper.Core.Services
|
||||
RunCmd($"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/trojan-go.service");
|
||||
RunCmd($"systemctl daemon-reload");
|
||||
|
||||
Progress.Desc = "启用Trojan-Go开机启动";
|
||||
RunCmd("systemctl enable trojan-go");
|
||||
RunCmd("systemctl start trojan-go");
|
||||
|
||||
Progress.Desc = "Trojan-Go 安装完成";
|
||||
|
||||
Progress.Desc = "安装TLS证书";
|
||||
@ -358,8 +359,6 @@ namespace ProxySuper.Core.Services
|
||||
Progress.Desc = "正在上传配置文件";
|
||||
UploadFile(stream, "/usr/local/etc/trojan-go/config.json");
|
||||
|
||||
Progress.Desc = "重启Trojan-Go服务器";
|
||||
RunCmd("systemctl restart trojan-go");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -78,9 +78,13 @@ namespace ProxySuper.Core.Services
|
||||
Progress.Step = $"{index++}. 启动BBR";
|
||||
EnableBBR();
|
||||
|
||||
Progress.Desc = "重启Xray服务";
|
||||
RunCmd("systemctl restart caddy");
|
||||
RunCmd("systemctl restart xray");
|
||||
|
||||
Progress.Percentage = 100;
|
||||
Progress.Step = "安装成功";
|
||||
Progress.Desc = "安装成功";
|
||||
Progress.Desc = string.Empty;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -388,7 +392,6 @@ namespace ProxySuper.Core.Services
|
||||
Progress.Desc = ("生成Xray服务器配置文件");
|
||||
var configJson = XrayConfigBuilder.BuildXrayConfig(Settings);
|
||||
WriteToFile(configJson, "/usr/local/etc/xray/config.json");
|
||||
RunCmd("systemctl restart xray");
|
||||
}
|
||||
|
||||
private void UploadCaddyFile(bool useCustomWeb = false)
|
||||
@ -400,7 +403,6 @@ namespace ProxySuper.Core.Services
|
||||
RunCmd("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.back");
|
||||
}
|
||||
WriteToFile(configJson, "/etc/caddy/Caddyfile");
|
||||
RunCmd("systemctl restart caddy");
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,6 +6,7 @@ using ProxySuper.Core.Models.Projects;
|
||||
using ProxySuper.Core.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -31,12 +32,14 @@ namespace ProxySuper.Core.ViewModels
|
||||
_service = new BrookService(_host, _settings);
|
||||
_service.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
|
||||
_service.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
|
||||
_service.Connect();
|
||||
return base.Initialize();
|
||||
}
|
||||
|
||||
public override void ViewDestroy(bool viewFinishing = true)
|
||||
{
|
||||
_service.Disconnect();
|
||||
this.SaveInstallLog();
|
||||
base.ViewDestroy(viewFinishing);
|
||||
}
|
||||
|
||||
@ -47,5 +50,16 @@ namespace ProxySuper.Core.ViewModels
|
||||
public IMvxCommand InstallCommand => new MvxCommand(_service.Install);
|
||||
|
||||
public IMvxCommand UninstallCommand => new MvxCommand(_service.Uninstall);
|
||||
|
||||
private void SaveInstallLog()
|
||||
{
|
||||
if (!Directory.Exists("Logs"))
|
||||
{
|
||||
Directory.CreateDirectory("Logs");
|
||||
}
|
||||
|
||||
var fileName = System.IO.Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".brook.txt");
|
||||
File.WriteAllText(fileName, Logs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ using ProxySuper.Core.Models.Projects;
|
||||
using ProxySuper.Core.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -31,12 +32,14 @@ namespace ProxySuper.Core.ViewModels
|
||||
_service = new NaiveProxyService(_host, _settings);
|
||||
_service.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
|
||||
_service.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
|
||||
_service.Connect();
|
||||
return base.Initialize();
|
||||
}
|
||||
|
||||
public override void ViewDestroy(bool viewFinishing = true)
|
||||
{
|
||||
_service.Disconnect();
|
||||
this.SaveInstallLog();
|
||||
base.ViewDestroy(viewFinishing);
|
||||
}
|
||||
|
||||
@ -57,5 +60,16 @@ namespace ProxySuper.Core.ViewModels
|
||||
public IMvxCommand UploadWebCommand => new MvxCommand(_service.UploadWeb);
|
||||
|
||||
#endregion
|
||||
|
||||
private void SaveInstallLog()
|
||||
{
|
||||
if (!Directory.Exists("Logs"))
|
||||
{
|
||||
Directory.CreateDirectory("Logs");
|
||||
}
|
||||
|
||||
var fileName = System.IO.Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".naiveproxy.txt");
|
||||
File.WriteAllText(fileName, Logs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ using ProxySuper.Core.Models.Projects;
|
||||
using ProxySuper.Core.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -38,6 +39,7 @@ namespace ProxySuper.Core.ViewModels
|
||||
public override void ViewDestroy(bool viewFinishing = true)
|
||||
{
|
||||
_trojanGoService.Disconnect();
|
||||
this.SaveInstallLog();
|
||||
base.ViewDestroy(viewFinishing);
|
||||
}
|
||||
|
||||
@ -67,5 +69,17 @@ namespace ProxySuper.Core.ViewModels
|
||||
public IMvxCommand ApplyForCertCommand => new MvxCommand(_trojanGoService.ApplyForCert);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private void SaveInstallLog()
|
||||
{
|
||||
if (!Directory.Exists("Logs"))
|
||||
{
|
||||
Directory.CreateDirectory("Logs");
|
||||
}
|
||||
|
||||
var fileName = System.IO.Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".trojan-go.txt");
|
||||
File.WriteAllText(fileName, Logs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ using ProxySuper.Core.Models.Projects;
|
||||
using ProxySuper.Core.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -23,6 +24,7 @@ namespace ProxySuper.Core.ViewModels
|
||||
public override void ViewDestroy(bool viewFinishing = true)
|
||||
{
|
||||
_xrayService.Disconnect();
|
||||
this.SaveInstallLog();
|
||||
base.ViewDestroy(viewFinishing);
|
||||
}
|
||||
|
||||
@ -71,5 +73,16 @@ namespace ProxySuper.Core.ViewModels
|
||||
public IMvxCommand ApplyForCertCommand => new MvxCommand(_xrayService.ApplyForCert);
|
||||
|
||||
#endregion
|
||||
|
||||
private void SaveInstallLog()
|
||||
{
|
||||
if (!Directory.Exists("Logs"))
|
||||
{
|
||||
Directory.CreateDirectory("Logs");
|
||||
}
|
||||
|
||||
var fileName = Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".xary.txt");
|
||||
File.WriteAllText(fileName, Logs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
Text="{Binding Path=Logs,Mode=OneWay}"
|
||||
VerticalContentAlignment="Top"
|
||||
Padding="10"
|
||||
Padding="10,0"
|
||||
FontSize="13"
|
||||
IsReadOnly="True"
|
||||
FontFamily="微软雅黑"
|
||||
|
@ -30,7 +30,7 @@
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Settings.Port}" IsReadOnly="True" />
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="用户名(UserName)" />
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Settings.Domain}" IsReadOnly="True" />
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Settings.UserName}" IsReadOnly="True" />
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0" Content="密码(Password)" />
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Settings.Password}" IsReadOnly="True" />
|
||||
|
Loading…
Reference in New Issue
Block a user