mirror of
https://github.com/2dust/v2rayN.git
synced 2025-05-01 20:58:50 +00:00
De-duplication after subscription update
This commit is contained in:
parent
7df90a6034
commit
9fd20ff001
1 changed files with 8 additions and 6 deletions
|
@ -114,7 +114,7 @@ namespace ServiceLib.Services
|
||||||
_updateFunc?.Invoke(false, ResUI.MsgUpdateSubscriptionStart);
|
_updateFunc?.Invoke(false, ResUI.MsgUpdateSubscriptionStart);
|
||||||
var subItem = await AppHandler.Instance.SubItems();
|
var subItem = await AppHandler.Instance.SubItems();
|
||||||
|
|
||||||
if (subItem == null || subItem.Count <= 0)
|
if (subItem is not { Count: > 0 })
|
||||||
{
|
{
|
||||||
_updateFunc?.Invoke(false, ResUI.MsgNoValidSubscription);
|
_updateFunc?.Invoke(false, ResUI.MsgNoValidSubscription);
|
||||||
return;
|
return;
|
||||||
|
@ -122,10 +122,10 @@ namespace ServiceLib.Services
|
||||||
|
|
||||||
foreach (var item in subItem)
|
foreach (var item in subItem)
|
||||||
{
|
{
|
||||||
string id = item.Id.TrimEx();
|
var id = item.Id.TrimEx();
|
||||||
string url = item.Url.TrimEx();
|
var url = item.Url.TrimEx();
|
||||||
string userAgent = item.UserAgent.TrimEx();
|
var userAgent = item.UserAgent.TrimEx();
|
||||||
string hashCode = $"{item.Remarks}->";
|
var hashCode = $"{item.Remarks}->";
|
||||||
if (Utils.IsNullOrEmpty(id) || Utils.IsNullOrEmpty(url) || Utils.IsNotEmpty(subId) && item.Id != subId)
|
if (Utils.IsNullOrEmpty(id) || Utils.IsNullOrEmpty(url) || Utils.IsNotEmpty(subId) && item.Id != subId)
|
||||||
{
|
{
|
||||||
//_updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgNoValidSubscription}");
|
//_updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgNoValidSubscription}");
|
||||||
|
@ -219,7 +219,7 @@ namespace ServiceLib.Services
|
||||||
_updateFunc?.Invoke(false, $"{hashCode}{result}");
|
_updateFunc?.Invoke(false, $"{hashCode}{result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = await ConfigHandler.AddBatchServers(config, result, id, true);
|
var ret = await ConfigHandler.AddBatchServers(config, result, id, true);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
Logging.SaveLog("FailedImportSubscription");
|
Logging.SaveLog("FailedImportSubscription");
|
||||||
|
@ -231,6 +231,8 @@ namespace ServiceLib.Services
|
||||||
: $"{hashCode}{ResUI.MsgFailedImportSubscription}");
|
: $"{hashCode}{ResUI.MsgFailedImportSubscription}");
|
||||||
}
|
}
|
||||||
_updateFunc?.Invoke(false, "-------------------------------------------------------");
|
_updateFunc?.Invoke(false, "-------------------------------------------------------");
|
||||||
|
|
||||||
|
await ConfigHandler.DedupServerList(config, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateFunc?.Invoke(true, $"{ResUI.MsgUpdateSubscriptionEnd}");
|
_updateFunc?.Invoke(true, $"{ResUI.MsgUpdateSubscriptionEnd}");
|
||||||
|
|
Loading…
Reference in a new issue