Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a4dcd1

Browse files
authored
Merge pull request netchx#274 from tindy2013/master
Enhancements
2 parents 4d4bc0f + 48e3d6e commit 4a4dcd1

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Netch/Utils/ShareLink.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ private static IEnumerable<Server> ParseLine(string text)
395395
}
396396

397397
data.FakeType = vmess.type;
398-
if (!Global.FakeTypes.Contains(data.FakeType))
398+
if (data.FakeType.Length != 0 && !Global.FakeTypes.Contains(data.FakeType))
399399
{
400400
Logging.Info(string.Format("不支持的 VMess 伪装类型:{0}", data.FakeType));
401401
return null;
@@ -516,7 +516,7 @@ private static IEnumerable<Server> ParseLine(string text)
516516
}
517517
list.Add(NetchLink);
518518
}
519-
else if(text.StartsWith("trojan://"))
519+
else if (text.StartsWith("trojan://"))
520520
{
521521
var data = new Server();
522522
data.Type = "Trojan";
@@ -552,7 +552,7 @@ private static IEnumerable<Server> ParseLine(string text)
552552
var match = finder.Match(text);
553553
if (!match.Success)
554554
{
555-
throw new FormatException();
555+
throw new FormatException();
556556
}
557557

558558
data.Password = match.Groups["psk"].Value;
@@ -573,6 +573,16 @@ private static IEnumerable<Server> ParseLine(string text)
573573
return null;
574574
}
575575

576+
byte[] emoji_bytes = { 240, 159 };
577+
foreach (Server node in list)
578+
{
579+
var remark = Encoding.UTF8.GetBytes(node.Remark);
580+
int start_index = 0;
581+
while (remark.Length > start_index + 1 && remark[start_index] == emoji_bytes[0] && remark[start_index + 1] == emoji_bytes[1])
582+
start_index += 4;
583+
node.Remark = Encoding.UTF8.GetString(remark.Skip(start_index).ToArray()).Trim();
584+
}
585+
576586
return list;
577587
}
578588
public static string UnBase64String(string value)

0 commit comments

Comments
 (0)