Compare commits

..

5 Commits
7.0.3 ... 7.0.4

Author SHA1 Message Date
2dust
072f773245 up 7.0.4 2024-10-31 09:59:59 +08:00
2dust
0086f65a96 Bug fix
b7f4fd7469
2024-10-30 08:57:10 +08:00
2dust
281f14f47e Adjustment of preset rule sets 2024-10-28 13:45:39 +08:00
2dust
9fd20ff001 De-duplication after subscription update 2024-10-28 09:38:20 +08:00
2dust
7df90a6034 Bug fix
https://github.com/2dust/v2rayN/issues/5928
2024-10-28 09:16:24 +08:00
9 changed files with 62 additions and 53 deletions

View File

@@ -37,40 +37,41 @@ namespace ServiceLib.Common
foreach (var filePath in files)
{
var file = new FileInfo(filePath);
if (file.CreationTime < now)
if (file.CreationTime >= now) continue;
try
{
try
{
file.Delete();
}
catch { }
file.Delete();
}
catch
{
// ignored
}
}
}
catch { }
catch
{
// ignored
}
});
}
public static void SaveLog(string strContent)
{
if (LogManager.IsLoggingEnabled())
{
var logger = LogManager.GetLogger("Log1");
logger.Info(strContent);
}
if (!LogManager.IsLoggingEnabled()) return;
LogManager.GetLogger("Log1").Info(strContent);
}
public static void SaveLog(string strTitle, Exception ex)
{
if (LogManager.IsLoggingEnabled())
if (!LogManager.IsLoggingEnabled()) return;
var logger = LogManager.GetLogger("Log2");
logger.Debug($"{strTitle},{ex.Message}");
logger.Debug(ex.StackTrace);
if (ex?.InnerException != null)
{
var logger = LogManager.GetLogger("Log2");
logger.Debug($"{strTitle},{ex.Message}");
logger.Debug(ex.StackTrace);
if (ex?.InnerException != null)
{
logger.Error(ex.InnerException);
}
logger.Error(ex.InnerException);
}
}
}

View File

@@ -71,7 +71,7 @@
public bool InitComponents()
{
Logging.Setup();
Logging.LoggingEnabled(true);
Logging.LoggingEnabled(_config.GuiItem.EnableLog);
Logging.SaveLog($"v2rayN start up | {Utils.GetVersion()} | {Utils.GetExePath()}");
Logging.SaveLog($"{Environment.OSVersion} - {(Environment.Is64BitOperatingSystem ? 64 : 32)}");
Logging.ClearLogs();

View File

@@ -88,6 +88,8 @@
public int TrayMenuServersLimit { get; set; } = 20;
public bool EnableHWA { get; set; } = false;
public bool EnableLog { get; set; } = true;
}
[Serializable]

View File

@@ -42,15 +42,7 @@
]
},
{
"remarks": "代理GFW",
"outboundTag": "proxy",
"domain": [
"geosite:gfw",
"geosite:greatfire"
]
},
{
"remarks": "代理Google等",
"remarks": "代理IP",
"outboundTag": "proxy",
"ip": [
"1.0.0.1",
@@ -65,6 +57,14 @@
"geoip:twitter"
]
},
{
"remarks": "代理GFW",
"outboundTag": "proxy",
"domain": [
"geosite:gfw",
"geosite:greatfire"
]
},
{
"remarks": "最终直连",
"port": "0-65535",

View File

@@ -34,19 +34,6 @@
"geosite:private"
]
},
{
"remarks": "绕过中国域名",
"outboundTag": "direct",
"domain": [
"domain:dns.alidns.com",
"domain:doh.pub",
"domain:dot.pub",
"domain:doh.360.cn",
"domain:dot.360.cn",
"geosite:cn",
"geosite:geolocation-cn"
]
},
{
"remarks": "绕过中国IP",
"outboundTag": "direct",
@@ -73,6 +60,19 @@
"geoip:cn"
]
},
{
"remarks": "绕过中国域名",
"outboundTag": "direct",
"domain": [
"domain:dns.alidns.com",
"domain:doh.pub",
"domain:dot.pub",
"domain:doh.360.cn",
"domain:dot.360.cn",
"geosite:cn",
"geosite:geolocation-cn"
]
},
{
"remarks": "最终代理",
"port": "0-65535",

View File

@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>7.0.3</Version>
<Version>7.0.4</Version>
</PropertyGroup>
<ItemGroup>
@@ -16,7 +16,7 @@
<PackageReference Include="WebDav.Client" Version="2.8.0" />
<PackageReference Include="YamlDotNet" Version="16.1.3" />
<PackageReference Include="QRCoder" Version="1.6.0" />
<PackageReference Include="CliWrap" Version="3.6.6" />
<PackageReference Include="CliWrap" Version="3.6.7" />
<PackageReference Include="SkiaSharp.QrCode" Version="0.7.0" />
<PackageReference Include="ZXing.Net.Bindings.SkiaSharp" Version="0.16.14" />
</ItemGroup>

View File

@@ -114,7 +114,7 @@ namespace ServiceLib.Services
_updateFunc?.Invoke(false, ResUI.MsgUpdateSubscriptionStart);
var subItem = await AppHandler.Instance.SubItems();
if (subItem == null || subItem.Count <= 0)
if (subItem is not { Count: > 0 })
{
_updateFunc?.Invoke(false, ResUI.MsgNoValidSubscription);
return;
@@ -122,10 +122,10 @@ namespace ServiceLib.Services
foreach (var item in subItem)
{
string id = item.Id.TrimEx();
string url = item.Url.TrimEx();
string userAgent = item.UserAgent.TrimEx();
string hashCode = $"{item.Remarks}->";
var id = item.Id.TrimEx();
var url = item.Url.TrimEx();
var userAgent = item.UserAgent.TrimEx();
var hashCode = $"{item.Remarks}->";
if (Utils.IsNullOrEmpty(id) || Utils.IsNullOrEmpty(url) || Utils.IsNotEmpty(subId) && item.Id != subId)
{
//_updateFunc?.Invoke(false, $"{hashCode}{ResUI.MsgNoValidSubscription}");
@@ -219,7 +219,7 @@ namespace ServiceLib.Services
_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)
{
Logging.SaveLog("FailedImportSubscription");
@@ -231,6 +231,8 @@ namespace ServiceLib.Services
: $"{hashCode}{ResUI.MsgFailedImportSubscription}");
}
_updateFunc?.Invoke(false, "-------------------------------------------------------");
await ConfigHandler.DedupServerList(config, id);
}
_updateFunc?.Invoke(true, $"{ResUI.MsgUpdateSubscriptionEnd}");

View File

@@ -1,5 +1,6 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Notifications;
using Avalonia.Controls.Primitives;
using Avalonia.Media;
using Avalonia.Styling;
@@ -94,6 +95,7 @@ namespace v2rayN.Desktop.ViewModels
x.OfType<TextBox>(),
x.OfType<TextBlock>(),
x.OfType<Menu>(),
x.OfType<ContextMenu>(),
x.OfType<DataGridRow>(),
x.OfType<ListBoxItem>()
));
@@ -120,8 +122,10 @@ namespace v2rayN.Desktop.ViewModels
x.OfType<TextBox>(),
x.OfType<TextBlock>(),
x.OfType<Menu>(),
x.OfType<ContextMenu>(),
x.OfType<DataGridRow>(),
x.OfType<ListBoxItem>()
x.OfType<ListBoxItem>(),
x.OfType<WindowNotificationManager>()
));
style.Add(new Setter()
{

View File

@@ -27,7 +27,7 @@
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.1.4" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.1.4" />
<PackageReference Include="DialogHost.Avalonia" Version="0.8.1" />
<PackageReference Include="MessageBox.Avalonia" Version="3.1.6.13" />
<PackageReference Include="MessageBox.Avalonia" Version="3.2.0" />
<PackageReference Include="Semi.Avalonia" Version="11.1.0.4" />
<PackageReference Include="Semi.Avalonia.DataGrid" Version="11.1.0.4" />
<PackageReference Include="ReactiveUI" Version="20.1.63" />