mirror of https://github.com/2dust/v2rayN
Fix some issues with update core
parent
02fc631e3c
commit
9a8b4593e1
|
@ -35,7 +35,7 @@ namespace v2rayN.Forms
|
|||
//panTran.Visible = false;
|
||||
//this.Height = this.Height - panTran.Height;
|
||||
|
||||
cmbSecurity3.Items.AddRange(LazyConfig.Instance.GetShadowsocksSecuritys().ToArray());
|
||||
cmbSecurity3.Items.AddRange(LazyConfig.Instance.GetShadowsocksSecuritys(vmessItem).ToArray());
|
||||
break;
|
||||
case EConfigType.Socks:
|
||||
panSocks.Dock = DockStyle.Fill;
|
||||
|
|
|
@ -529,7 +529,7 @@ namespace v2rayN.Handler
|
|||
vmessItem.id = vmessItem.id.TrimEx();
|
||||
vmessItem.security = vmessItem.security.TrimEx();
|
||||
|
||||
if (!LazyConfig.Instance.GetShadowsocksSecuritys().Contains(vmessItem.security))
|
||||
if (!LazyConfig.Instance.GetShadowsocksSecuritys(vmessItem).Contains(vmessItem.security))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -22,18 +22,18 @@ namespace v2rayN.Handler
|
|||
return _config;
|
||||
}
|
||||
|
||||
public List<string> GetShadowsocksSecuritys()
|
||||
public List<string> GetShadowsocksSecuritys(VmessItem vmessItem)
|
||||
{
|
||||
if (GetCoreType(null, EConfigType.Shadowsocks) == ECoreType.v2fly)
|
||||
if (GetCoreType(vmessItem, EConfigType.Shadowsocks) == ECoreType.v2fly)
|
||||
{
|
||||
return Global.ssSecuritys;
|
||||
}
|
||||
if (GetCoreType(null, EConfigType.Shadowsocks) == ECoreType.SagerNet)
|
||||
if (GetCoreType(vmessItem, EConfigType.Shadowsocks) == ECoreType.Xray)
|
||||
{
|
||||
return Global.ssSecuritysInSagerNet;
|
||||
}
|
||||
return Global.ssSecuritysInXray;
|
||||
}
|
||||
|
||||
return Global.ssSecuritysInXray;
|
||||
return Global.ssSecuritysInSagerNet;
|
||||
}
|
||||
|
||||
public ECoreType GetCoreType(VmessItem vmessItem, EConfigType eConfigType)
|
||||
|
@ -86,7 +86,8 @@ namespace v2rayN.Handler
|
|||
coreLatestUrl = Global.v2flyCoreUrl + "/latest",
|
||||
coreDownloadUrl32 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
coreDownloadUrl64 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
match = "V2Ray"
|
||||
match = "V2Ray",
|
||||
versionArg = "-version"
|
||||
});
|
||||
|
||||
coreInfos.Add(new CoreInfo
|
||||
|
@ -98,7 +99,8 @@ namespace v2rayN.Handler
|
|||
coreLatestUrl = Global.SagerNetCoreUrl + "/latest",
|
||||
coreDownloadUrl32 = Global.SagerNetCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
coreDownloadUrl64 = Global.SagerNetCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
match = "V2Ray"
|
||||
match = "V2Ray",
|
||||
versionArg = "version"
|
||||
});
|
||||
|
||||
coreInfos.Add(new CoreInfo
|
||||
|
@ -110,7 +112,8 @@ namespace v2rayN.Handler
|
|||
coreLatestUrl = Global.xrayCoreUrl + "/latest",
|
||||
coreDownloadUrl32 = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip",
|
||||
coreDownloadUrl64 = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip",
|
||||
match = "Xray"
|
||||
match = "Xray",
|
||||
versionArg = "-version"
|
||||
});
|
||||
|
||||
coreInfos.Add(new CoreInfo
|
||||
|
@ -122,18 +125,21 @@ namespace v2rayN.Handler
|
|||
coreLatestUrl = Global.clashCoreUrl + "/latest",
|
||||
coreDownloadUrl32 = Global.clashCoreUrl + "/download/{0}/clash-windows-386-{0}.zip",
|
||||
coreDownloadUrl64 = Global.clashCoreUrl + "/download/{0}/clash-windows-amd64-{0}.zip",
|
||||
match = "v"
|
||||
match = "v",
|
||||
versionArg = "-v"
|
||||
});
|
||||
|
||||
coreInfos.Add(new CoreInfo
|
||||
{
|
||||
coreType = ECoreType.clash_meta,
|
||||
coreExes = new List<string> { "Clash.Meta-windows-amd64v1", "Clash.Meta-windows-amd64", "Clash.Meta-windows-amd64-compatible", "Clash.Meta-windows-386", "Clash.Meta", "clash" },
|
||||
coreExes = new List<string> { "Clash.Meta-windows-amd64-compatible", "Clash.Meta-windows-amd64", "Clash.Meta-windows-386", "Clash.Meta", "clash" },
|
||||
arguments = "-f config.json",
|
||||
coreUrl = Global.clashMetaCoreUrl,
|
||||
coreLatestUrl = Global.clashMetaCoreUrl + "/latest",
|
||||
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",
|
||||
versionArg = "-v"
|
||||
});
|
||||
|
||||
coreInfos.Add(new CoreInfo
|
||||
|
|
|
@ -360,7 +360,7 @@ namespace v2rayN.Handler
|
|||
|
||||
Process p = new Process();
|
||||
p.StartInfo.FileName = filePath;
|
||||
p.StartInfo.Arguments = "-version";
|
||||
p.StartInfo.Arguments = coreInfo.versionArg;
|
||||
p.StartInfo.WorkingDirectory = Utils.StartupPath();
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
|
@ -369,7 +369,19 @@ namespace v2rayN.Handler
|
|||
p.Start();
|
||||
p.WaitForExit(5000);
|
||||
string echo = p.StandardOutput.ReadToEnd();
|
||||
string version = Regex.Match(echo, $"{coreInfo.match} ([0-9.]+) \\(").Groups[1].Value;
|
||||
string version = string.Empty;
|
||||
switch (type)
|
||||
{
|
||||
case ECoreType.v2fly:
|
||||
case ECoreType.SagerNet:
|
||||
case ECoreType.Xray:
|
||||
version = Regex.Match(echo, $"{coreInfo.match} ([0-9.]+) \\(").Groups[1].Value;
|
||||
break;
|
||||
case ECoreType.clash:
|
||||
case ECoreType.clash_meta:
|
||||
version = Regex.Match(echo, $"v[0-9.]+").Groups[0].Value;
|
||||
break;
|
||||
}
|
||||
return version;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -404,7 +416,7 @@ namespace v2rayN.Handler
|
|||
case ECoreType.clash:
|
||||
case ECoreType.clash_meta:
|
||||
{
|
||||
curVersion = "";//getCoreVersion(type);
|
||||
curVersion = getCoreVersion(type);
|
||||
message = string.Format(ResUI.IsLatestCore, curVersion);
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
|
|
|
@ -411,7 +411,7 @@ namespace v2rayN.Handler
|
|||
serversItem.address = node.address;
|
||||
serversItem.port = node.port;
|
||||
serversItem.password = node.id;
|
||||
serversItem.method = LazyConfig.Instance.GetShadowsocksSecuritys().Contains(node.security) ? node.security : "none";
|
||||
serversItem.method = LazyConfig.Instance.GetShadowsocksSecuritys(node).Contains(node.security) ? node.security : "none";
|
||||
|
||||
|
||||
serversItem.ota = false;
|
||||
|
|
|
@ -21,5 +21,7 @@ namespace v2rayN.Mode
|
|||
public string coreDownloadUrl64 { get; set; }
|
||||
|
||||
public string match { get; set; }
|
||||
public string versionArg { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue