Skip to content

Commit a28c631

Browse files
Support for setting subs-group remarks (group's name) from the (optional) "remark" query parameter in the pasted subs url (#5264)
1 parent 6204223 commit a28c631

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

v2rayN/v2rayN/Handler/ConfigHandler.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Data;
22
using System.IO;
33
using System.Text.RegularExpressions;
4+
using System.Web;
45
using v2rayN.Enums;
56
using v2rayN.Handler.Fmt;
67
using v2rayN.Models;
@@ -1355,15 +1356,19 @@ public static int AddBatchServers(Config config, string strData, string subid, b
13551356
public static int AddSubItem(Config config, string url)
13561357
{
13571358
//already exists
1358-
if (SQLiteHelper.Instance.Table<SubItem>().Where(e => e.url == url).Count() > 0)
1359+
if (SQLiteHelper.Instance.Table<SubItem>().Any(e => e.url == url))
13591360
{
13601361
return 0;
13611362
}
13621363

1364+
var uri = new Uri(url);
1365+
var queryVars = HttpUtility.ParseQueryString(uri.Query);
1366+
string remarks = queryVars["remarks"] ?? "import_sub";
1367+
13631368
SubItem subItem = new()
13641369
{
13651370
id = string.Empty,
1366-
remarks = "import_sub",
1371+
remarks = remarks,
13671372
url = url
13681373
};
13691374

0 commit comments

Comments
 (0)