mirror of
https://github.com/netchx/netch.git
synced 2026-04-23 21:29:49 +08:00
Enhancements
Fix import error if VMess links have an empty type field. Add removing Emojis at the beginning of node remarks.
This commit is contained in:
@@ -395,7 +395,7 @@ namespace Netch.Utils
|
||||
}
|
||||
|
||||
data.FakeType = vmess.type;
|
||||
if (!Global.FakeTypes.Contains(data.FakeType))
|
||||
if (data.FakeType.Length != 0 && !Global.FakeTypes.Contains(data.FakeType))
|
||||
{
|
||||
Logging.Info(string.Format("不支持的 VMess 伪装类型:{0}", data.FakeType));
|
||||
return null;
|
||||
@@ -516,7 +516,7 @@ namespace Netch.Utils
|
||||
}
|
||||
list.Add(NetchLink);
|
||||
}
|
||||
else if(text.StartsWith("trojan://"))
|
||||
else if (text.StartsWith("trojan://"))
|
||||
{
|
||||
var data = new Server();
|
||||
data.Type = "Trojan";
|
||||
@@ -552,7 +552,7 @@ namespace Netch.Utils
|
||||
var match = finder.Match(text);
|
||||
if (!match.Success)
|
||||
{
|
||||
throw new FormatException();
|
||||
throw new FormatException();
|
||||
}
|
||||
|
||||
data.Password = match.Groups["psk"].Value;
|
||||
@@ -573,6 +573,16 @@ namespace Netch.Utils
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] emoji_bytes = { 240, 159 };
|
||||
foreach (Server node in list)
|
||||
{
|
||||
var remark = Encoding.UTF8.GetBytes(node.Remark);
|
||||
int start_index = 0;
|
||||
while (remark.Length > start_index + 1 && remark[start_index] == emoji_bytes[0] && remark[start_index + 1] == emoji_bytes[1])
|
||||
start_index += 4;
|
||||
node.Remark = Encoding.UTF8.GetString(remark.Skip(start_index).ToArray()).Trim();
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
public static string UnBase64String(string value)
|
||||
|
||||
Reference in New Issue
Block a user