Support for setting subs-group remarks (group's name) from the (optional) "remark" query parameter in the pasted subs url (#5264)

pull/5377/head
OnceUponATimeInAmerica 5 months ago committed by GitHub
parent 620422350f
commit a28c63168a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,6 +1,7 @@
using System.Data; using System.Data;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Web;
using v2rayN.Enums; using v2rayN.Enums;
using v2rayN.Handler.Fmt; using v2rayN.Handler.Fmt;
using v2rayN.Models; using v2rayN.Models;
@ -1355,15 +1356,19 @@ namespace v2rayN.Handler
public static int AddSubItem(Config config, string url) public static int AddSubItem(Config config, string url)
{ {
//already exists //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; return 0;
} }
var uri = new Uri(url);
var queryVars = HttpUtility.ParseQueryString(uri.Query);
string remarks = queryVars["remarks"] ?? "import_sub";
SubItem subItem = new() SubItem subItem = new()
{ {
id = string.Empty, id = string.Empty,
remarks = "import_sub", remarks = remarks,
url = url url = url
}; };

Loading…
Cancel
Save