diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs index 12b478e0..ed6d0673 100644 --- a/v2rayN/v2rayN/Global.cs +++ b/v2rayN/v2rayN/Global.cs @@ -3,6 +3,8 @@ class Global { #region const + public const string githubUrl = "https://github.com"; + public const string githubApiUrl = "https://api.github.com/repos"; public const string v2rayWebsiteUrl = @"https://www.v2fly.org/"; public const string AboutUrl = @"https://github.com/2dust/v2rayN"; public const string UpdateUrl = AboutUrl + @"/releases"; diff --git a/v2rayN/v2rayN/Handler/LazyConfig.cs b/v2rayN/v2rayN/Handler/LazyConfig.cs index f53e72b2..20bc299d 100644 --- a/v2rayN/v2rayN/Handler/LazyConfig.cs +++ b/v2rayN/v2rayN/Handler/LazyConfig.cs @@ -209,7 +209,7 @@ namespace v2rayN.Handler { coreType = ECoreType.v2rayN, coreUrl = Global.NUrl, - coreReleaseApiUrl = Global.NUrl.Replace(@"https://github.com", @"https://api.github.com/repos"), + coreReleaseApiUrl = Global.NUrl.Replace(Global.githubUrl, Global.githubApiUrl), coreDownloadUrl32 = Global.NUrl + "/download/{0}/v2rayN.zip", coreDownloadUrl64 = Global.NUrl + "/download/{0}/v2rayN.zip", }); @@ -220,7 +220,7 @@ namespace v2rayN.Handler coreExes = new List { "wv2ray", "v2ray" }, arguments = "", coreUrl = Global.v2flyCoreUrl, - coreReleaseApiUrl = Global.v2flyCoreUrl.Replace(@"https://github.com", @"https://api.github.com/repos"), + coreReleaseApiUrl = Global.v2flyCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl), coreDownloadUrl32 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip", coreDownloadUrl64 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip", match = "V2Ray", @@ -234,7 +234,7 @@ namespace v2rayN.Handler coreExes = new List { "SagerNet", "v2ray" }, arguments = "run", coreUrl = Global.SagerNetCoreUrl, - coreReleaseApiUrl = Global.SagerNetCoreUrl.Replace(@"https://github.com", @"https://api.github.com/repos"), + coreReleaseApiUrl = Global.SagerNetCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl), coreDownloadUrl32 = Global.SagerNetCoreUrl + "/download/{0}/v2ray-windows-{1}.zip", coreDownloadUrl64 = Global.SagerNetCoreUrl + "/download/{0}/v2ray-windows-{1}.zip", match = "V2Ray", @@ -248,7 +248,7 @@ namespace v2rayN.Handler coreExes = new List { "v2ray" }, arguments = "run", coreUrl = Global.v2flyCoreUrl, - coreReleaseApiUrl = Global.v2flyCoreUrl.Replace(@"https://github.com", @"https://api.github.com/repos"), + coreReleaseApiUrl = Global.v2flyCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl), coreDownloadUrl32 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip", coreDownloadUrl64 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip", match = "V2Ray", @@ -262,7 +262,7 @@ namespace v2rayN.Handler coreExes = new List { "xray", "wxray" }, arguments = "", coreUrl = Global.xrayCoreUrl, - coreReleaseApiUrl = Global.xrayCoreUrl.Replace(@"https://github.com", @"https://api.github.com/repos"), + coreReleaseApiUrl = Global.xrayCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl), coreDownloadUrl32 = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip", coreDownloadUrl64 = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip", match = "Xray", @@ -276,7 +276,7 @@ namespace v2rayN.Handler coreExes = new List { "clash-windows-amd64-v3", "clash-windows-amd64", "clash-windows-386", "clash" }, arguments = "-f config.json", coreUrl = Global.clashCoreUrl, - coreReleaseApiUrl = Global.clashCoreUrl.Replace(@"https://github.com", @"https://api.github.com/repos"), + coreReleaseApiUrl = Global.clashCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl), coreDownloadUrl32 = Global.clashCoreUrl + "/download/{0}/clash-windows-386-{0}.zip", coreDownloadUrl64 = Global.clashCoreUrl + "/download/{0}/clash-windows-amd64-{0}.zip", match = "v", @@ -290,7 +290,7 @@ namespace v2rayN.Handler coreExes = new List { "Clash.Meta-windows-amd64-compatible", "Clash.Meta-windows-amd64", "Clash.Meta-windows-386", "Clash.Meta", "clash" }, arguments = "-f config.json", coreUrl = Global.clashMetaCoreUrl, - coreReleaseApiUrl = Global.clashMetaCoreUrl.Replace(@"https://github.com", @"https://api.github.com/repos"), + coreReleaseApiUrl = Global.clashMetaCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl), coreDownloadUrl32 = Global.clashMetaCoreUrl + "/download/{0}/Clash.Meta-windows-386-{0}.zip", coreDownloadUrl64 = Global.clashMetaCoreUrl + "/download/{0}/Clash.Meta-windows-amd64-compatible-{0}.zip", match = "v", @@ -304,7 +304,7 @@ namespace v2rayN.Handler coreExes = new List { "hysteria-windows-amd64", "hysteria-windows-386", "hysteria" }, arguments = "", coreUrl = Global.hysteriaCoreUrl, - coreReleaseApiUrl = Global.hysteriaCoreUrl.Replace(@"https://github.com", @"https://api.github.com/repos"), + coreReleaseApiUrl = Global.hysteriaCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl), coreDownloadUrl32 = Global.hysteriaCoreUrl + "/download/{0}/hysteria-windows-386.exe", coreDownloadUrl64 = Global.hysteriaCoreUrl + "/download/{0}/hysteria-windows-amd64.exe", redirectInfo = true,