Skip to content

Commit

Permalink
throw right exception when Deserialize v2rayN ShareLink
Browse files Browse the repository at this point in the history
  • Loading branch information
chsbuffer committed Mar 4, 2021
1 parent c1644ec commit b6e4e5e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Netch/Servers/VMess/VMessUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,18 @@ public IEnumerable<Server> ParseUri(string text)
{
var data = new VMess();

V2rayNSharing vmess;
string s;
try
{
vmess = JsonSerializer.Deserialize<V2rayNSharing>(ShareLink.URLSafeBase64Decode(text.Substring(8)));
s = ShareLink.URLSafeBase64Decode(text.Substring(8));
}
catch
{
return V2rayUtils.ParseVUri(text);
}

V2rayNSharing vmess = JsonSerializer.Deserialize<V2rayNSharing>(s)!;

data.Remark = vmess.ps;
data.Hostname = vmess.add;
data.Port = ushort.Parse(vmess.port);
Expand Down
2 changes: 2 additions & 0 deletions Netch/Utils/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public static class Utils
{
public static bool Open(string path)
{
if (Global.Testing)
return true;
try
{
Process.Start(new ProcessStartInfo
Expand Down

0 comments on commit b6e4e5e

Please sign in to comment.