From 19f9bff6feb8d475e047d41204e10940d5dbc437 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Wed, 27 Apr 2022 09:31:38 +0800 Subject: [PATCH] Support hysteria and naiveproxy subscription --- v2rayN/v2rayN/Handler/ConfigHandler.cs | 33 ++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs index 13053fe5..2445e384 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs @@ -950,14 +950,39 @@ namespace v2rayN.Handler vmessItem.address = fileName; vmessItem.remarks = "clash_custom"; } + //Is hysteria configuration + else if (clipboardData.IndexOf("server") >= 0 + && clipboardData.IndexOf("up") >= 0 + && clipboardData.IndexOf("down") >= 0 + && clipboardData.IndexOf("listen") >= 0) + { + var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.json"); + File.WriteAllText(fileName, clipboardData); + + vmessItem.coreType = ECoreType.hysteria; + vmessItem.address = fileName; + vmessItem.remarks = "hysteria_custom"; + } + //Is naiveproxy configuration + else if (clipboardData.IndexOf("listen") >= 0 + && clipboardData.IndexOf("proxy") >= 0) + { + var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.json"); + File.WriteAllText(fileName, clipboardData); + + vmessItem.coreType = ECoreType.naiveproxy; + vmessItem.address = fileName; + vmessItem.remarks = "naiveproxy_custom"; + } //Is Other configuration else { - var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.txt"); - File.WriteAllText(fileName, clipboardData); + return -1; + //var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.txt"); + //File.WriteAllText(fileName, clipboardData); - vmessItem.address = fileName; - vmessItem.remarks = "other_custom"; + //vmessItem.address = fileName; + //vmessItem.remarks = "other_custom"; } if (!Utils.IsNullOrEmpty(subid))