Improve core running arguments

This commit is contained in:
2dust 2025-02-03 14:48:53 +08:00
parent 6914831d30
commit 9d92be99ee

View file

@ -1,4 +1,4 @@
namespace ServiceLib.Handler namespace ServiceLib.Handler
{ {
public sealed class CoreInfoHandler public sealed class CoreInfoHandler
{ {
@ -44,7 +44,7 @@
} }
if (fileName.IsNullOrEmpty()) if (fileName.IsNullOrEmpty())
{ {
msg = string.Format(ResUI.NotFoundCore, Utils.GetBinPath("", coreInfo.CoreType.ToString()), string.Join(", ", coreInfo.CoreExes.ToArray()), coreInfo.Url); msg = string.Format(ResUI.NotFoundCore, Utils.GetBinPath("", coreInfo?.CoreType.ToString()), coreInfo?.CoreExes?.LastOrDefault(), coreInfo?.Url);
Logging.SaveLog(msg); Logging.SaveLog(msg);
} }
return fileName; return fileName;
@ -71,7 +71,7 @@
{ {
CoreType = ECoreType.v2fly, CoreType = ECoreType.v2fly,
CoreExes = ["wv2ray", "v2ray"], CoreExes = ["wv2ray", "v2ray"],
Arguments = "", Arguments = "{0}",
Url = Global.V2flyCoreUrl, Url = Global.V2flyCoreUrl,
ReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl), ReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
Match = "V2Ray", Match = "V2Ray",
@ -83,7 +83,7 @@
{ {
CoreType = ECoreType.v2fly_v5, CoreType = ECoreType.v2fly_v5,
CoreExes = ["v2ray"], CoreExes = ["v2ray"],
Arguments = "run -c config.json -format jsonv5", Arguments = "run -c {0} -format jsonv5",
Url = Global.V2flyCoreUrl, Url = Global.V2flyCoreUrl,
ReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl), ReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
Match = "V2Ray", Match = "V2Ray",
@ -94,7 +94,7 @@
new CoreInfo new CoreInfo
{ {
CoreType = ECoreType.Xray, CoreType = ECoreType.Xray,
CoreExes = ["xray", "wxray"], CoreExes = ["wxray","xray"],
Arguments = "run -c {0}", Arguments = "run -c {0}",
Url = Global.XrayCoreUrl, Url = Global.XrayCoreUrl,
ReleaseApiUrl = Global.XrayCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl), ReleaseApiUrl = Global.XrayCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
@ -112,8 +112,8 @@
new CoreInfo new CoreInfo
{ {
CoreType = ECoreType.mihomo, CoreType = ECoreType.mihomo,
CoreExes = ["mihomo-windows-amd64-compatible", "mihomo-windows-amd64", "mihomo-linux-amd64", "mihomo", "clash"], CoreExes = ["mihomo-windows-amd64-compatible", "mihomo-windows-amd64", "mihomo-linux-amd64", "clash", "mihomo"],
Arguments = "-f config.json" + PortableMode(), Arguments = "-f {0}" + PortableMode(),
Url = Global.MihomoCoreUrl, Url = Global.MihomoCoreUrl,
ReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl), ReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
DownloadUrlWin64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-amd64-compatible-{0}.zip", DownloadUrlWin64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-amd64-compatible-{0}.zip",
@ -131,17 +131,16 @@
{ {
CoreType = ECoreType.hysteria, CoreType = ECoreType.hysteria,
CoreExes = ["hysteria-windows-amd64", "hysteria"], CoreExes = ["hysteria-windows-amd64", "hysteria"],
Arguments = "", Arguments = "-c {0}",
Url = Global.HysteriaCoreUrl, Url = Global.HysteriaCoreUrl,
ReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
RedirectInfo = true, RedirectInfo = true,
}, },
new CoreInfo new CoreInfo
{ {
CoreType = ECoreType.naiveproxy, CoreType = ECoreType.naiveproxy,
CoreExes = ["naiveproxy", "naive"], CoreExes = [ "naive", "naiveproxy"],
Arguments = "config.json", Arguments = "{0}",
Url = Global.NaiveproxyCoreUrl, Url = Global.NaiveproxyCoreUrl,
RedirectInfo = false, RedirectInfo = false,
}, },
@ -150,7 +149,7 @@
{ {
CoreType = ECoreType.tuic, CoreType = ECoreType.tuic,
CoreExes = ["tuic-client", "tuic"], CoreExes = ["tuic-client", "tuic"],
Arguments = "-c config.json", Arguments = "-c {0}",
Url = Global.TuicCoreUrl, Url = Global.TuicCoreUrl,
RedirectInfo = true, RedirectInfo = true,
}, },
@ -177,7 +176,7 @@
{ {
CoreType = ECoreType.juicity, CoreType = ECoreType.juicity,
CoreExes = ["juicity-client", "juicity"], CoreExes = ["juicity-client", "juicity"],
Arguments = "run -c config.json", Arguments = "run -c {0}",
Url = Global.JuicityCoreUrl Url = Global.JuicityCoreUrl
}, },
@ -185,9 +184,8 @@
{ {
CoreType = ECoreType.hysteria2, CoreType = ECoreType.hysteria2,
CoreExes = ["hysteria-windows-amd64", "hysteria-linux-amd64", "hysteria"], CoreExes = ["hysteria-windows-amd64", "hysteria-linux-amd64", "hysteria"],
Arguments = "", Arguments = "-c {0}",
Url = Global.HysteriaCoreUrl, Url = Global.HysteriaCoreUrl,
ReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
RedirectInfo = true, RedirectInfo = true,
} }