fix something

pull/1582/head
2dust 2021-05-11 20:11:59 +08:00
parent 545e1c5402
commit 4408d67c49
5 changed files with 36 additions and 6 deletions

View File

@ -1164,8 +1164,18 @@ namespace v2rayN.Handler
{
config.routings = new List<RoutingItem>();
}
if (config.routings.Count <= 0)
if (config.routings.Count(it => it.locked != true) <= 0)
{
//Global
var item1 = new RoutingItem();
item1.remarks = "全局(Global)";
item1.url = string.Empty;
item1.rules = new List<RulesItem>();
string result1 = Utils.GetEmbedText(Global.CustomRoutingFileName + "global");
AddBatchRoutingRules(ref item1, result1);
config.routings.Add(item1);
//Bypass the mainland
var item2 = new RoutingItem();
item2.remarks = "绕过大陆(Whitelist)";

View File

@ -210,6 +210,12 @@ namespace v2rayN.Handler
dicQuery.Add("quicSecurity", Utils.UrlEncode(item.requestHost));
dicQuery.Add("key", Utils.UrlEncode(item.path));
break;
case "grpc":
if (!Utils.IsNullOrEmpty(item.path))
{
dicQuery.Add("serviceName", Utils.UrlEncode(item.path));
}
break;
}
string query = "?" + string.Join("&", dicQuery.Select(x => x.Key + "=" + x.Value).ToArray());
@ -280,7 +286,7 @@ namespace v2rayN.Handler
msg = UIRes.I18N("FailedConversionConfiguration");
return null;
}
vmessItem.network = Global.DefaultNetwork;
vmessItem.headerType = Global.None;
@ -690,7 +696,9 @@ namespace v2rayN.Handler
item.requestHost = query["quicSecurity"] ?? "none";
item.path = Utils.UrlDecode(query["key"] ?? "");
break;
case "grpc":
item.path = Utils.UrlDecode(query["serviceName"] ?? "");
break;
default:
return null;
}

View File

@ -97,6 +97,11 @@ namespace v2rayN.Handler
string msg = string.Empty;
pid = _v2rayHandler.LoadV2rayConfigString(_config, _selecteds);
if (pid < 0)
{
_updateFunc(_selecteds[0], UIRes.I18N("OperationFailed"));
return;
}
//Thread.Sleep(5000);
int httpPort = _config.GetLocalPort("speedtest");
@ -178,6 +183,11 @@ namespace v2rayN.Handler
}
pid = _v2rayHandler.LoadV2rayConfigString(_config, _selecteds);
if (pid < 0)
{
_updateFunc(_selecteds[0], UIRes.I18N("OperationFailed"));
return;
}
string url = _config.speedTestUrl;
DownloadHandle downloadHandle2 = new DownloadHandle();

View File

@ -151,7 +151,7 @@ namespace v2rayN.HttpProxyHandler
{
var type = config.sysProxyType;
if (forceDisable)
if (forceDisable && type == ESysProxyType.ForcedChange)
{
type = ESysProxyType.ForcedClear;
}
@ -170,6 +170,8 @@ namespace v2rayN.HttpProxyHandler
}
else if (type == ESysProxyType.ForcedClear)
{
//TODO To be verified
Utils.RegWriteValue(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", 0);
SysProxyHandle.ResetIEProxy();
}
else if (type == ESysProxyType.Unchanged)

View File

@ -618,13 +618,13 @@ namespace v2rayN
return def;
}
public static void RegWriteValue(string path, string name, string value)
public static void RegWriteValue(string path, string name, object value)
{
RegistryKey regKey = null;
try
{
regKey = Registry.CurrentUser.CreateSubKey(path);
if (IsNullOrEmpty(value))
if (IsNullOrEmpty(value.ToString()))
{
regKey?.DeleteValue(name, false);
}