diff --git a/ProxySuper.Core/Services/NaiveProxyService.cs b/ProxySuper.Core/Services/NaiveProxyService.cs
index af201e1..69724c9 100644
--- a/ProxySuper.Core/Services/NaiveProxyService.cs
+++ b/ProxySuper.Core/Services/NaiveProxyService.cs
@@ -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)
diff --git a/ProxySuper.Core/Services/TrojanGoService.cs b/ProxySuper.Core/Services/TrojanGoService.cs
index 8026057..9262565 100644
--- a/ProxySuper.Core/Services/TrojanGoService.cs
+++ b/ProxySuper.Core/Services/TrojanGoService.cs
@@ -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
diff --git a/ProxySuper.Core/Services/XrayService.cs b/ProxySuper.Core/Services/XrayService.cs
index 85b06b5..6a14ed1 100644
--- a/ProxySuper.Core/Services/XrayService.cs
+++ b/ProxySuper.Core/Services/XrayService.cs
@@ -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");
}
diff --git a/ProxySuper.Core/ViewModels/BrookInstallViewModel.cs b/ProxySuper.Core/ViewModels/BrookInstallViewModel.cs
index 3db6f21..c3bc429 100644
--- a/ProxySuper.Core/ViewModels/BrookInstallViewModel.cs
+++ b/ProxySuper.Core/ViewModels/BrookInstallViewModel.cs
@@ -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);
+ }
}
}
diff --git a/ProxySuper.Core/ViewModels/NaiveProxyInstallViewModel.cs b/ProxySuper.Core/ViewModels/NaiveProxyInstallViewModel.cs
index ec0777a..2987076 100644
--- a/ProxySuper.Core/ViewModels/NaiveProxyInstallViewModel.cs
+++ b/ProxySuper.Core/ViewModels/NaiveProxyInstallViewModel.cs
@@ -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);
+ }
}
}
diff --git a/ProxySuper.Core/ViewModels/TrojanGoInstallViewModel.cs b/ProxySuper.Core/ViewModels/TrojanGoInstallViewModel.cs
index 3841aee..e458295 100644
--- a/ProxySuper.Core/ViewModels/TrojanGoInstallViewModel.cs
+++ b/ProxySuper.Core/ViewModels/TrojanGoInstallViewModel.cs
@@ -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);
+ }
}
}
diff --git a/ProxySuper.Core/ViewModels/XrayInstallViewModel.cs b/ProxySuper.Core/ViewModels/XrayInstallViewModel.cs
index 458667b..f7d483e 100644
--- a/ProxySuper.Core/ViewModels/XrayInstallViewModel.cs
+++ b/ProxySuper.Core/ViewModels/XrayInstallViewModel.cs
@@ -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);
+ }
}
}
diff --git a/ProxySuper.WPF/Controls/ProgressControl.xaml b/ProxySuper.WPF/Controls/ProgressControl.xaml
index a00c760..b45c461 100644
--- a/ProxySuper.WPF/Controls/ProgressControl.xaml
+++ b/ProxySuper.WPF/Controls/ProgressControl.xaml
@@ -19,7 +19,7 @@
VerticalScrollBarVisibility="Auto"
Text="{Binding Path=Logs,Mode=OneWay}"
VerticalContentAlignment="Top"
- Padding="10"
+ Padding="10,0"
FontSize="13"
IsReadOnly="True"
FontFamily="微软雅黑"
diff --git a/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyConfigView.xaml b/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyConfigView.xaml
index ed4d12f..c5b29ac 100644
--- a/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyConfigView.xaml
+++ b/ProxySuper.WPF/Views/NaiveProxy/NaiveProxyConfigView.xaml
@@ -30,7 +30,7 @@
-
+