1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-21 20:56:08 +03:00

add update xray settings

This commit is contained in:
next-autumn 2021-03-11 14:31:18 +08:00
parent 14401058dc
commit f6d28efac9
3 changed files with 30 additions and 7 deletions

View File

@ -35,9 +35,7 @@ namespace ProxySU_Core.ViewModels.Developers
EnsureSystemEnv();
this.InstallCertToXray();
RunCmd("systemctl restart xray");
WriteOutput("************");
WriteOutput("安装证书完成");
WriteOutput("************");
WriteOutput("************ 安装证书完成 ************");
}
public void UploadWeb(Stream stream)
@ -54,7 +52,19 @@ namespace ProxySU_Core.ViewModels.Developers
RunCmd("chmod -R 777 /usr/share/caddy");
UploadCaddyFile(useCustomWeb: true);
RunCmd("systemctl restart caddy");
WriteOutput("************\n上传网站模板完成\n************");
WriteOutput("************ 上传网站模板完成 ************");
}
public void UpdateXraySettings()
{
EnsureRootAuth();
EnsureSystemEnv();
var configJson = ConfigBuilder.BuildXrayConfig(Parameters);
var stream = new MemoryStream(Encoding.UTF8.GetBytes(configJson));
RunCmd("rm -rf /usr/local/etc/xray/config.json");
UploadFile(stream, "/usr/local/etc/xray/config.json");
RunCmd("systemctl restart xray");
WriteOutput("************ 更新Xray配置成功更新配置不包含域名如果域名更换请重新安装。 ************");
}
public void ReinstallCaddy()
@ -63,9 +73,7 @@ namespace ProxySU_Core.ViewModels.Developers
EnsureSystemEnv();
InstallCaddy();
UploadCaddyFile();
WriteOutput("************");
WriteOutput("重装Caddy完成");
WriteOutput("************");
WriteOutput("************ 重装Caddy完成 ************");
}

View File

@ -29,6 +29,13 @@
IsEnabled="{Binding HasConnected}"
Width="100"/>
<Button Content="更新Xray配置"
Margin="10,0,0,0"
Click="UpdateXraySettings"
Height="32"
IsEnabled="{Binding HasConnected}"
Width="120"/>
<Button Content="申请TLS证书"
Margin="10,0,0,0"
Height="32"

View File

@ -158,6 +158,14 @@ namespace ProxySU_Core
});
}
private void UpdateXraySettings(object sender, RoutedEventArgs e)
{
Task.Factory.StartNew(() =>
{
project.UpdateXraySettings();
});
}
private void OnFileOk(object sender, CancelEventArgs e)
{
Task.Factory.StartNew(() =>