Skip to content

Commit

Permalink
Support for setting subs-group remarks (group's name) from the (optio…
Browse files Browse the repository at this point in the history
…nal) "remark" query parameter in the pasted subs url (#5264)
  • Loading branch information
OnceUponATimeInAmerica authored Jun 24, 2024
1 parent 6204223 commit a28c631
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions v2rayN/v2rayN/Handler/ConfigHandler.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Data;
using System.IO;
using System.Text.RegularExpressions;
using System.Web;
using v2rayN.Enums;
using v2rayN.Handler.Fmt;
using v2rayN.Models;
Expand Down Expand Up @@ -1355,15 +1356,19 @@ public static int AddBatchServers(Config config, string strData, string subid, b
public static int AddSubItem(Config config, string url)
{
//already exists
if (SQLiteHelper.Instance.Table<SubItem>().Where(e => e.url == url).Count() > 0)
if (SQLiteHelper.Instance.Table<SubItem>().Any(e => e.url == url))
{
return 0;
}

var uri = new Uri(url);
var queryVars = HttpUtility.ParseQueryString(uri.Query);
string remarks = queryVars["remarks"] ?? "import_sub";

SubItem subItem = new()
{
id = string.Empty,
remarks = "import_sub",
remarks = remarks,
url = url
};

Expand Down

0 comments on commit a28c631

Please sign in to comment.