diff --git a/v2rayN/ServiceLib/Handler/CoreHandler.cs b/v2rayN/ServiceLib/Handler/CoreHandler.cs index 6ebb80e8..e181eb30 100644 --- a/v2rayN/ServiceLib/Handler/CoreHandler.cs +++ b/v2rayN/ServiceLib/Handler/CoreHandler.cs @@ -59,14 +59,16 @@ namespace ServiceLib.Handler var fileName = Utils.GetConfigPath(Global.CoreConfigFileName); var result = await CoreConfigHandler.GenerateClientConfig(node, fileName); - ShowMsg(true, result.Msg); if (result.Success != true) { + ShowMsg(true, result.Msg); return; } else { ShowMsg(true, $"{node.GetSummary()}"); + ShowMsg(false, $"{Environment.OSVersion} - {(Environment.Is64BitOperatingSystem ? 64 : 32)}"); + ShowMsg(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"))); await CoreStop(); await Task.Delay(100); await CoreStart(node); @@ -100,6 +102,8 @@ namespace ServiceLib.Handler ShowMsg(false, result.Msg); if (result.Success) { + ShowMsg(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"))); + ShowMsg(false, configPath); pid = await CoreStartSpeedtest(configPath, coreType); } return pid; @@ -167,9 +171,6 @@ namespace ServiceLib.Handler private async Task CoreStart(ProfileItem node) { - ShowMsg(false, $"{Environment.OSVersion} - {(Environment.Is64BitOperatingSystem ? 64 : 32)}"); - ShowMsg(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"))); - var coreType = AppHandler.Instance.GetCoreType(node, node.ConfigType); _config.RunningCoreType = coreType; var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(coreType); @@ -229,9 +230,6 @@ namespace ServiceLib.Handler private async Task CoreStartSpeedtest(string configPath, ECoreType coreType) { - ShowMsg(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"))); - - ShowMsg(false, configPath); try { var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(coreType); @@ -299,10 +297,11 @@ namespace ServiceLib.Handler if (isNeedSudo) { proc.StartInfo.FileName = $"/bin/sudo"; - proc.StartInfo.Arguments = $"-S {fileName} {string.Format(coreInfo.Arguments, Utils.GetConfigPath(configPath))}"; + proc.StartInfo.Arguments = $"-S {fileName.AppendQuotes()} {string.Format(coreInfo.Arguments, Utils.GetConfigPath(configPath).AppendQuotes())}"; proc.StartInfo.WorkingDirectory = null; proc.StartInfo.StandardInputEncoding = Encoding.UTF8; proc.StartInfo.RedirectStandardInput = true; + Logging.SaveLog(proc.StartInfo.Arguments); } var startUpErrorMessage = new StringBuilder(); diff --git a/v2rayN/ServiceLib/Handler/CoreInfoHandler.cs b/v2rayN/ServiceLib/Handler/CoreInfoHandler.cs index aeb5e57d..5b8fa606 100644 --- a/v2rayN/ServiceLib/Handler/CoreInfoHandler.cs +++ b/v2rayN/ServiceLib/Handler/CoreInfoHandler.cs @@ -165,7 +165,7 @@ private string PortableMode() { - return $" -d \"{Utils.GetBinPath("")}\""; + return $" -d {Utils.GetBinPath("").AppendQuotes()}"; } } } \ No newline at end of file diff --git a/v2rayN/ServiceLib/ServiceLib.csproj b/v2rayN/ServiceLib/ServiceLib.csproj index ecd130e6..d2f0c939 100644 --- a/v2rayN/ServiceLib/ServiceLib.csproj +++ b/v2rayN/ServiceLib/ServiceLib.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 7.1.1 + 7.1.2 diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs index d8f787e8..885986da 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs @@ -1024,18 +1024,17 @@ namespace ServiceLib.Services.CoreConfig //request Host string request = Utils.GetEmbedText(Global.V2raySampleHttpRequestFileName); string[] arrHost = host.Split(','); - string host2 = string.Join("\",\"", arrHost); - request = request.Replace("$requestHost$", $"\"{host2}\""); - //request = request.Replace("$requestHost$", string.Format("\"{0}\"", config.requestHost())); - request = request.Replace("$requestUserAgent$", $"\"{useragent}\""); + string host2 = string.Join(",".AppendQuotes(), arrHost); + request = request.Replace("$requestHost$", $"{host2.AppendQuotes()}"); + request = request.Replace("$requestUserAgent$", $"{useragent.AppendQuotes()}"); //Path string pathHttp = @"/"; if (Utils.IsNotEmpty(node.Path)) { string[] arrPath = node.Path.Split(','); - pathHttp = string.Join("\",\"", arrPath); + pathHttp = string.Join(",".AppendQuotes(), arrPath); } - request = request.Replace("$requestPath$", $"\"{pathHttp}\""); + request = request.Replace("$requestPath$", $"{pathHttp.AppendQuotes()}"); tcpSettings.header.request = JsonUtils.Deserialize(request); streamSettings.tcpSettings = tcpSettings; diff --git a/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml b/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml index 8ccd0f07..0138fe7a 100644 --- a/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml @@ -50,7 +50,7 @@ diff --git a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml index 73265c92..de532782 100644 --- a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml @@ -61,6 +61,7 @@ Width="54" Height="30" Margin="20,0" + Padding="2" Classes="Tertiary" Theme="{DynamicResource BorderlessSplitButton}" ToolTip.Tip="{x:Static resx:ResUI.menuProfileAutofitColumnWidth}"> diff --git a/v2rayN/v2rayN.Desktop/v2rayN.Desktop.csproj b/v2rayN/v2rayN.Desktop/v2rayN.Desktop.csproj index 8ab9c55f..fc743189 100644 --- a/v2rayN/v2rayN.Desktop/v2rayN.Desktop.csproj +++ b/v2rayN/v2rayN.Desktop/v2rayN.Desktop.csproj @@ -20,16 +20,16 @@ - - - - - - + + + + + + - - + +