mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-07-14 05:12:09 +08:00
1.1.1 -> 1.1.2 第27次更新
This commit is contained in:
parent
f9c6da4bb8
commit
b3416c9bbf
@ -161,12 +161,15 @@ public partial class MainWin : Window
|
||||
{
|
||||
HoldButtonTimer?.Stop();
|
||||
|
||||
if (!MainPres!.IsNginxRunning)
|
||||
{
|
||||
if (MessageBox.Show(MainConst._LaunchProxyPrompt, string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
|
||||
return;
|
||||
|
||||
string configPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "nginx.conf");
|
||||
string logsPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "logs");
|
||||
string tempPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "temp");
|
||||
|
||||
if (!MainPres!.IsNginxRunning)
|
||||
{
|
||||
if (!File.Exists(configPath))
|
||||
File.Create(configPath).Dispose();
|
||||
if (!Directory.Exists(logsPath))
|
||||
@ -174,9 +177,6 @@ public partial class MainWin : Window
|
||||
if (!Directory.Exists(tempPath))
|
||||
Directory.CreateDirectory(tempPath);
|
||||
|
||||
if (MessageBox.Show(MainConst._LaunchProxyPrompt, string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
|
||||
return;
|
||||
|
||||
ConfWatcher.EnableRaisingEvents = false;
|
||||
NginxConfs!.Save("nginx.conf");
|
||||
|
||||
@ -215,17 +215,21 @@ public partial class MainWin : Window
|
||||
HoldButtonTimer?.Stop();
|
||||
|
||||
RegistryKey proxyKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true)!;
|
||||
string configPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "config.yaml");
|
||||
|
||||
if (!MainPres!.IsMihomoRunning)
|
||||
{
|
||||
YamlStream configStream = [];
|
||||
YamlMappingNode configMapNode;
|
||||
YamlNode mihomoPortNode;
|
||||
if (MessageBox.Show(MainConst._LaunchProxyPrompt, string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
|
||||
return;
|
||||
|
||||
string configPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "config.yaml");
|
||||
|
||||
if (!File.Exists(configPath))
|
||||
File.Create(configPath).Dispose();
|
||||
|
||||
YamlStream configStream = [];
|
||||
YamlMappingNode configMapNode;
|
||||
YamlNode mihomoPortNode;
|
||||
|
||||
configStream.Load(File.OpenText(configPath));
|
||||
|
||||
try { configMapNode = (YamlMappingNode)configStream.Documents[0].RootNode; }
|
||||
@ -234,9 +238,6 @@ public partial class MainWin : Window
|
||||
if (!configMapNode.Children.TryGetValue("mixed-port", out mihomoPortNode!) && !configMapNode.Children.TryGetValue("port", out mihomoPortNode!))
|
||||
mihomoPortNode = "7890";
|
||||
|
||||
if (MessageBox.Show(MainConst._LaunchProxyPrompt, string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
|
||||
return;
|
||||
|
||||
proxyKey.SetValue("ProxyEnable", 1);
|
||||
proxyKey.SetValue("ProxyServer", "127.0.0.1:" + mihomoPortNode);
|
||||
|
||||
@ -450,7 +451,7 @@ public partial class MainWin : Window
|
||||
|
||||
NginxConfs = NginxConfig.Load(ExtraConfs)
|
||||
.AddOrUpdate("worker_processes", "auto")
|
||||
.AddOrUpdate("events:worker_connections", "10000")
|
||||
.AddOrUpdate("events:worker_connections", "65536")
|
||||
.AddOrUpdate("http:proxy_set_header", "Host $http_host")
|
||||
.AddOrUpdate("http:server:return", "https://$host$request_uri");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user