mirror of https://github.com/2dust/v2rayN
Fix ?!
parent
073eaa9a26
commit
243dbab06a
|
@ -15,11 +15,19 @@
|
||||||
this.version = $"{major}.{minor}.{patch}";
|
this.version = $"{major}.{minor}.{patch}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public SemanticVersion(string version)
|
public SemanticVersion(string? version)
|
||||||
{
|
{
|
||||||
this.version = version.RemovePrefix('v');
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (version.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
this.major = 0;
|
||||||
|
this.minor = 0;
|
||||||
|
this.patch = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.version = version.RemovePrefix('v');
|
||||||
|
|
||||||
string[] parts = this.version.Split('.');
|
string[] parts = this.version.Split('.');
|
||||||
if (parts.Length == 2)
|
if (parts.Length == 2)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +51,6 @@
|
||||||
this.major = 0;
|
this.major = 0;
|
||||||
this.minor = 0;
|
this.minor = 0;
|
||||||
this.patch = 0;
|
this.patch = 0;
|
||||||
//this.version = "0.0.0";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,10 +158,11 @@ namespace ServiceLib.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="plainText"></param>
|
/// <param name="plainText"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string Base64Decode(string plainText)
|
public static string Base64Decode(string? plainText)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (plainText.IsNullOrEmpty()) return "";
|
||||||
plainText = plainText.Trim()
|
plainText = plainText.Trim()
|
||||||
.Replace(Environment.NewLine, "")
|
.Replace(Environment.NewLine, "")
|
||||||
.Replace("\n", "")
|
.Replace("\n", "")
|
||||||
|
@ -365,7 +366,7 @@ namespace ServiceLib.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsBase64String(string plainText)
|
public static bool IsBase64String(string? plainText)
|
||||||
{
|
{
|
||||||
if (plainText.IsNullOrEmpty()) return false;
|
if (plainText.IsNullOrEmpty()) return false;
|
||||||
var buffer = new Span<byte>(new byte[plainText.Length]);
|
var buffer = new Span<byte>(new byte[plainText.Length]);
|
||||||
|
@ -812,7 +813,7 @@ namespace ServiceLib.Common
|
||||||
}
|
}
|
||||||
if (coreType != null)
|
if (coreType != null)
|
||||||
{
|
{
|
||||||
_tempPath = Path.Combine(_tempPath, coreType.ToString()!);
|
_tempPath = Path.Combine(_tempPath, coreType.ToString());
|
||||||
if (!Directory.Exists(_tempPath))
|
if (!Directory.Exists(_tempPath))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(_tempPath);
|
Directory.CreateDirectory(_tempPath);
|
||||||
|
|
|
@ -865,7 +865,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
var txtOutbound = Utils.GetEmbedText(Global.SingboxSampleOutbound);
|
var txtOutbound = Utils.GetEmbedText(Global.SingboxSampleOutbound);
|
||||||
|
|
||||||
//Previous proxy
|
//Previous proxy
|
||||||
var prevNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.prevProfile!);
|
var prevNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.prevProfile);
|
||||||
if (prevNode is not null
|
if (prevNode is not null
|
||||||
&& prevNode.configType != EConfigType.Custom)
|
&& prevNode.configType != EConfigType.Custom)
|
||||||
{
|
{
|
||||||
|
@ -878,7 +878,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
//Next proxy
|
//Next proxy
|
||||||
var nextNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.nextProfile!);
|
var nextNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.nextProfile);
|
||||||
if (nextNode is not null
|
if (nextNode is not null
|
||||||
&& nextNode.configType != EConfigType.Custom)
|
&& nextNode.configType != EConfigType.Custom)
|
||||||
{
|
{
|
||||||
|
@ -956,7 +956,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
if (routing != null)
|
if (routing != null)
|
||||||
{
|
{
|
||||||
var rules = JsonUtils.Deserialize<List<RulesItem>>(routing.ruleSet);
|
var rules = JsonUtils.Deserialize<List<RulesItem>>(routing.ruleSet);
|
||||||
foreach (var item in rules!)
|
foreach (var item in rules ?? [])
|
||||||
{
|
{
|
||||||
if (item.enabled)
|
if (item.enabled)
|
||||||
{
|
{
|
||||||
|
@ -971,7 +971,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
if (lockedItem != null)
|
if (lockedItem != null)
|
||||||
{
|
{
|
||||||
var rules = JsonUtils.Deserialize<List<RulesItem>>(lockedItem.ruleSet);
|
var rules = JsonUtils.Deserialize<List<RulesItem>>(lockedItem.ruleSet);
|
||||||
foreach (var item in rules!)
|
foreach (var item in rules ?? [])
|
||||||
{
|
{
|
||||||
GenRoutingUserRule(item, singboxConfig.route.rules);
|
GenRoutingUserRule(item, singboxConfig.route.rules);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1204,7 +1204,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
var txtOutbound = Utils.GetEmbedText(Global.V2raySampleOutbound);
|
var txtOutbound = Utils.GetEmbedText(Global.V2raySampleOutbound);
|
||||||
|
|
||||||
//Previous proxy
|
//Previous proxy
|
||||||
var prevNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.prevProfile!);
|
var prevNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.prevProfile);
|
||||||
if (prevNode is not null
|
if (prevNode is not null
|
||||||
&& prevNode.configType != EConfigType.Custom
|
&& prevNode.configType != EConfigType.Custom
|
||||||
&& prevNode.configType != EConfigType.Hysteria2
|
&& prevNode.configType != EConfigType.Hysteria2
|
||||||
|
@ -1223,7 +1223,7 @@ namespace ServiceLib.Handler.CoreConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
//Next proxy
|
//Next proxy
|
||||||
var nextNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.nextProfile!);
|
var nextNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.nextProfile);
|
||||||
if (nextNode is not null
|
if (nextNode is not null
|
||||||
&& nextNode.configType != EConfigType.Custom
|
&& nextNode.configType != EConfigType.Custom
|
||||||
&& nextNode.configType != EConfigType.Hysteria2
|
&& nextNode.configType != EConfigType.Hysteria2
|
||||||
|
|
|
@ -168,7 +168,7 @@
|
||||||
return SQLiteHelper.Instance.Table<ProfileItem>().FirstOrDefault(it => it.indexId == indexId);
|
return SQLiteHelper.Instance.Table<ProfileItem>().FirstOrDefault(it => it.indexId == indexId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProfileItem? GetProfileItemViaRemarks(string remarks)
|
public ProfileItem? GetProfileItemViaRemarks(string? remarks)
|
||||||
{
|
{
|
||||||
if (Utils.IsNullOrEmpty(remarks))
|
if (Utils.IsNullOrEmpty(remarks))
|
||||||
{
|
{
|
||||||
|
|
|
@ -191,7 +191,7 @@ namespace ServiceLib.Handler
|
||||||
//more url
|
//more url
|
||||||
if (Utils.IsNullOrEmpty(item.convertTarget) && Utils.IsNotEmpty(item.moreUrl.TrimEx()))
|
if (Utils.IsNullOrEmpty(item.convertTarget) && Utils.IsNotEmpty(item.moreUrl.TrimEx()))
|
||||||
{
|
{
|
||||||
if (Utils.IsNotEmpty(result) && Utils.IsBase64String(result!))
|
if (Utils.IsNotEmpty(result) && Utils.IsBase64String(result))
|
||||||
{
|
{
|
||||||
result = Utils.Base64Decode(result);
|
result = Utils.Base64Decode(result);
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ namespace ServiceLib.Handler
|
||||||
}
|
}
|
||||||
if (Utils.IsNotEmpty(result2))
|
if (Utils.IsNotEmpty(result2))
|
||||||
{
|
{
|
||||||
if (Utils.IsBase64String(result2!))
|
if (Utils.IsBase64String(result2))
|
||||||
{
|
{
|
||||||
result += Utils.Base64Decode(result2);
|
result += Utils.Base64Decode(result2);
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ namespace ServiceLib.Handler
|
||||||
{
|
{
|
||||||
var gitHubReleases = JsonUtils.Deserialize<List<GitHubRelease>>(gitHubReleaseApi);
|
var gitHubReleases = JsonUtils.Deserialize<List<GitHubRelease>>(gitHubReleaseApi);
|
||||||
var gitHubRelease = preRelease ? gitHubReleases?.First() : gitHubReleases?.First(r => r.Prerelease == false);
|
var gitHubRelease = preRelease ? gitHubReleases?.First() : gitHubReleases?.First(r => r.Prerelease == false);
|
||||||
var version = new SemanticVersion(gitHubRelease?.TagName!);
|
var version = new SemanticVersion(gitHubRelease?.TagName);
|
||||||
var body = gitHubRelease?.Body;
|
var body = gitHubRelease?.Body;
|
||||||
|
|
||||||
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(type);
|
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(type);
|
||||||
|
|
Loading…
Reference in New Issue