mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-23 11:26:54 +00:00
Fixes
This commit is contained in:
parent
105701ed9f
commit
3101f2f8b6
2 changed files with 14 additions and 50 deletions
|
@ -81,21 +81,16 @@ public class CoreConfigSingboxService
|
||||||
ret.Success = true;
|
ret.Success = true;
|
||||||
|
|
||||||
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.sing_box);
|
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.sing_box);
|
||||||
if (customConfig.Enabled && (!customConfig.Config.IsNullOrEmpty()))
|
var customConfigItem = customConfig.Config;
|
||||||
|
if (_config.TunModeItem.EnableTun)
|
||||||
{
|
{
|
||||||
//var customConfigObj = JsonUtils.Deserialize<SingboxConfig>(customConfig.Config);
|
customConfigItem = customConfig.TunConfig;
|
||||||
//if (customConfigObj != null)
|
}
|
||||||
//{
|
if (customConfig.Enabled && (!customConfigItem.IsNullOrEmpty()))
|
||||||
// customConfigObj.outbounds = JsonUtils.DeepCopy(singboxConfig.outbounds);
|
{
|
||||||
// singboxConfig = customConfigObj;
|
var customConfigNode = JsonNode.Parse(customConfigItem);
|
||||||
//}
|
|
||||||
|
|
||||||
// skip deserialize
|
|
||||||
var customConfigNode = JsonNode.Parse(customConfig.Config);
|
|
||||||
if (customConfigNode != null)
|
if (customConfigNode != null)
|
||||||
{
|
{
|
||||||
// customConfigNode["outbounds"] = JsonNode.Parse(JsonUtils.Serialize(singboxConfig.outbounds));
|
|
||||||
// append outbounds instead of override
|
|
||||||
if (customConfigNode["outbounds"] is JsonArray customOutboundsNode)
|
if (customConfigNode["outbounds"] is JsonArray customOutboundsNode)
|
||||||
{
|
{
|
||||||
if (JsonNode.Parse(JsonUtils.Serialize(singboxConfig.outbounds)) is JsonArray newOutbounds)
|
if (JsonNode.Parse(JsonUtils.Serialize(singboxConfig.outbounds)) is JsonArray newOutbounds)
|
||||||
|
@ -106,7 +101,6 @@ public class CoreConfigSingboxService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// endpoints
|
|
||||||
if (customConfigNode["endpoints"] is JsonArray customEndpointsNode)
|
if (customConfigNode["endpoints"] is JsonArray customEndpointsNode)
|
||||||
{
|
{
|
||||||
if (singboxConfig.endpoints != null && JsonNode.Parse(JsonUtils.Serialize(singboxConfig.endpoints)) is JsonArray newEndpoints)
|
if (singboxConfig.endpoints != null && JsonNode.Parse(JsonUtils.Serialize(singboxConfig.endpoints)) is JsonArray newEndpoints)
|
||||||
|
@ -477,20 +471,16 @@ public class CoreConfigSingboxService
|
||||||
ret.Success = true;
|
ret.Success = true;
|
||||||
|
|
||||||
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.sing_box);
|
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.sing_box);
|
||||||
if (customConfig.Enabled && (!customConfig.Config.IsNullOrEmpty()))
|
var customConfigItem = customConfig.Config;
|
||||||
|
if (_config.TunModeItem.EnableTun)
|
||||||
{
|
{
|
||||||
//var customConfigObj = JsonUtils.Deserialize<SingboxConfig>(customConfig.Config);
|
customConfigItem = customConfig.TunConfig;
|
||||||
//if (customConfigObj != null)
|
}
|
||||||
//{
|
if (customConfig.Enabled && (!customConfigItem.IsNullOrEmpty()))
|
||||||
// customConfigObj.outbounds = JsonUtils.DeepCopy(singboxConfig.outbounds);
|
{
|
||||||
// singboxConfig = customConfigObj;
|
var customConfigNode = JsonNode.Parse(customConfigItem);
|
||||||
//}
|
|
||||||
// skip deserialize
|
|
||||||
var customConfigNode = JsonNode.Parse(customConfig.Config);
|
|
||||||
if (customConfigNode != null)
|
if (customConfigNode != null)
|
||||||
{
|
{
|
||||||
// customConfigNode["outbounds"] = JsonNode.Parse(JsonUtils.Serialize(singboxConfig.outbounds));
|
|
||||||
// append outbounds instead of override
|
|
||||||
if (customConfigNode["outbounds"] is JsonArray customOutboundsNode)
|
if (customConfigNode["outbounds"] is JsonArray customOutboundsNode)
|
||||||
{
|
{
|
||||||
if (JsonNode.Parse(JsonUtils.Serialize(singboxConfig.outbounds)) is JsonArray newOutbounds)
|
if (JsonNode.Parse(JsonUtils.Serialize(singboxConfig.outbounds)) is JsonArray newOutbounds)
|
||||||
|
@ -501,7 +491,6 @@ public class CoreConfigSingboxService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// endpoints
|
|
||||||
if (customConfigNode["endpoints"] is JsonArray customEndpointsNode)
|
if (customConfigNode["endpoints"] is JsonArray customEndpointsNode)
|
||||||
{
|
{
|
||||||
if (singboxConfig.endpoints != null && JsonNode.Parse(JsonUtils.Serialize(singboxConfig.endpoints)) is JsonArray newEndpoints)
|
if (singboxConfig.endpoints != null && JsonNode.Parse(JsonUtils.Serialize(singboxConfig.endpoints)) is JsonArray newEndpoints)
|
||||||
|
|
|
@ -73,18 +73,9 @@ public class CoreConfigV2rayService
|
||||||
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.Xray);
|
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.Xray);
|
||||||
if (customConfig.Enabled && (!customConfig.Config.IsNullOrEmpty()))
|
if (customConfig.Enabled && (!customConfig.Config.IsNullOrEmpty()))
|
||||||
{
|
{
|
||||||
//var customConfigObj = JsonUtils.Deserialize<V2rayConfig>(customConfig.Config);
|
|
||||||
//if (customConfigObj != null)
|
|
||||||
//{
|
|
||||||
// customConfigObj.outbounds = JsonUtils.DeepCopy(v2rayConfig.outbounds);
|
|
||||||
// v2rayConfig = customConfigObj;
|
|
||||||
//}
|
|
||||||
// spik deserialize
|
|
||||||
var customConfigNode = JsonNode.Parse(customConfig.Config);
|
var customConfigNode = JsonNode.Parse(customConfig.Config);
|
||||||
if (customConfigNode != null)
|
if (customConfigNode != null)
|
||||||
{
|
{
|
||||||
//customConfigNode["outbounds"] = JsonNode.Parse(JsonUtils.Serialize(v2rayConfig.outbounds));
|
|
||||||
// append outbounds instead of override
|
|
||||||
if (customConfigNode["outbounds"] is JsonArray customOutboundsNode)
|
if (customConfigNode["outbounds"] is JsonArray customOutboundsNode)
|
||||||
{
|
{
|
||||||
if (JsonNode.Parse(JsonUtils.Serialize(v2rayConfig.outbounds)) is JsonArray newOutbounds)
|
if (JsonNode.Parse(JsonUtils.Serialize(v2rayConfig.outbounds)) is JsonArray newOutbounds)
|
||||||
|
@ -234,22 +225,6 @@ public class CoreConfigV2rayService
|
||||||
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.Xray);
|
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.Xray);
|
||||||
if (customConfig.Enabled && (!customConfig.Config.IsNullOrEmpty()))
|
if (customConfig.Enabled && (!customConfig.Config.IsNullOrEmpty()))
|
||||||
{
|
{
|
||||||
//var customConfigObj = JsonUtils.Deserialize<V2rayConfig>(customConfig.Config);
|
|
||||||
//if (customConfigObj != null)
|
|
||||||
//{
|
|
||||||
// foreach (var rule in customConfigObj.routing.rules)
|
|
||||||
// {
|
|
||||||
// if (rule.outboundTag == Global.ProxyTag)
|
|
||||||
// {
|
|
||||||
// rule.outboundTag = null;
|
|
||||||
// rule.balancerTag = balancer.tag;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// customConfigObj.routing.balancers = JsonUtils.DeepCopy(v2rayConfig.routing.balancers);
|
|
||||||
// customConfigObj.outbounds = JsonUtils.DeepCopy(v2rayConfig.outbounds);
|
|
||||||
// v2rayConfig = customConfigObj;
|
|
||||||
//}
|
|
||||||
// skip deserialize
|
|
||||||
var customConfigNode = JsonNode.Parse(customConfig.Config);
|
var customConfigNode = JsonNode.Parse(customConfig.Config);
|
||||||
if (customConfigNode != null)
|
if (customConfigNode != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue