throw right exception when Deserialize v2rayN ShareLink

This commit is contained in:
ChsBuffer
2021-03-04 15:37:12 +08:00
parent c1644ec52f
commit b6e4e5effa
2 changed files with 6 additions and 2 deletions

View File

@@ -75,16 +75,18 @@ namespace Netch.Servers.VMess
{
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);

View File

@@ -21,6 +21,8 @@ namespace Netch.Utils
{
public static bool Open(string path)
{
if (Global.Testing)
return true;
try
{
Process.Start(new ProcessStartInfo