mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-29 11:32:53 +00:00
Compare commits
7 commits
c81bc2f536
...
06500e0218
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06500e0218 | ||
|
|
9ddf0b42e7 | ||
|
|
2056377f55 | ||
|
|
7065dabc94 | ||
|
|
9e2336a71e | ||
|
|
d239c627f3 | ||
|
|
984b36d34e |
8 changed files with 77 additions and 21 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>7.12.5</Version>
|
||||
<Version>7.12.6</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -5,21 +5,21 @@
|
|||
<CentralPackageVersionOverrideEnabled>false</CentralPackageVersionOverrideEnabled>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.3.0" />
|
||||
<PackageVersion Include="Avalonia.Desktop" Version="11.3.0" />
|
||||
<PackageVersion Include="Avalonia.Diagnostics" Version="11.3.0" />
|
||||
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.3.0" />
|
||||
<PackageVersion Include="CliWrap" Version="3.8.2" />
|
||||
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.3.1" />
|
||||
<PackageVersion Include="Avalonia.Desktop" Version="11.3.1" />
|
||||
<PackageVersion Include="Avalonia.Diagnostics" Version="11.3.1" />
|
||||
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.3.1" />
|
||||
<PackageVersion Include="CliWrap" Version="3.9.0" />
|
||||
<PackageVersion Include="Downloader" Version="3.3.4" />
|
||||
<PackageVersion Include="H.NotifyIcon.Wpf" Version="2.3.0" />
|
||||
<PackageVersion Include="MaterialDesignThemes" Version="5.2.1" />
|
||||
<PackageVersion Include="MessageBox.Avalonia" Version="3.2.0" />
|
||||
<PackageVersion Include="QRCoder" Version="1.6.0" />
|
||||
<PackageVersion Include="ReactiveUI" Version="20.2.45" />
|
||||
<PackageVersion Include="ReactiveUI" Version="20.3.1" />
|
||||
<PackageVersion Include="ReactiveUI.Fody" Version="19.5.41" />
|
||||
<PackageVersion Include="ReactiveUI.WPF" Version="20.2.45" />
|
||||
<PackageVersion Include="Semi.Avalonia" Version="11.2.1.7" />
|
||||
<PackageVersion Include="Semi.Avalonia.DataGrid" Version="11.2.1.7" />
|
||||
<PackageVersion Include="ReactiveUI.WPF" Version="20.3.1" />
|
||||
<PackageVersion Include="Semi.Avalonia" Version="11.2.1.8" />
|
||||
<PackageVersion Include="Semi.Avalonia.DataGrid" Version="11.2.1.8" />
|
||||
<PackageVersion Include="Splat.NLog" Version="15.3.1" />
|
||||
<PackageVersion Include="sqlite-net-pcl" Version="1.9.172" />
|
||||
<PackageVersion Include="TaskScheduler" Version="2.12.1" />
|
||||
|
|
|
|||
|
|
@ -582,7 +582,7 @@ public class Utils
|
|||
var result = await cmd.ExecuteBufferedAsync();
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
return result.StandardOutput.ToString();
|
||||
return result.StandardOutput ?? "";
|
||||
}
|
||||
|
||||
Logging.SaveLog(result.ToString() ?? "");
|
||||
|
|
@ -839,14 +839,46 @@ public class Utils
|
|||
public static async Task<string?> SetLinuxChmod(string? fileName)
|
||||
{
|
||||
if (fileName.IsNullOrEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (SetUnixFileMode(fileName))
|
||||
{
|
||||
Logging.SaveLog($"Successfully set the file execution permission, {fileName}");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (fileName.Contains(' '))
|
||||
{
|
||||
fileName = fileName.AppendQuotes();
|
||||
//File.SetUnixFileMode(fileName, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
|
||||
}
|
||||
var arg = new List<string>() { "-c", $"chmod +x {fileName}" };
|
||||
return await GetCliWrapOutput(Global.LinuxBash, arg);
|
||||
}
|
||||
|
||||
public static bool SetUnixFileMode(string? fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (fileName.IsNullOrEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
var currentMode = File.GetUnixFileMode(fileName);
|
||||
File.SetUnixFileMode(fileName, currentMode | UnixFileMode.UserExecute | UnixFileMode.GroupExecute | UnixFileMode.OtherExecute);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.SaveLog("SetUnixFileMode", ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static async Task<string?> GetLinuxFontFamily(string lang)
|
||||
{
|
||||
// var arg = new List<string>() { "-c", $"fc-list :lang={lang} family" };
|
||||
|
|
|
|||
|
|
@ -1366,16 +1366,32 @@ public class CoreConfigV2rayService
|
|||
|
||||
private async Task<int> GenBalancer(V2rayConfig v2rayConfig, EMultipleLoad multipleLoad)
|
||||
{
|
||||
if (multipleLoad is EMultipleLoad.LeastLoad or EMultipleLoad.LeastPing)
|
||||
if (multipleLoad == EMultipleLoad.LeastPing)
|
||||
{
|
||||
var observatory = new Observatory4Ray
|
||||
{
|
||||
subjectSelector = [Global.ProxyTag],
|
||||
probeUrl = AppHandler.Instance.Config.SpeedTestItem.SpeedPingTestUrl,
|
||||
probeInterval = "3m"
|
||||
probeInterval = "3m",
|
||||
enableConcurrency = true,
|
||||
};
|
||||
v2rayConfig.observatory = observatory;
|
||||
}
|
||||
else if (multipleLoad == EMultipleLoad.LeastLoad)
|
||||
{
|
||||
var burstObservatory = new BurstObservatory4Ray
|
||||
{
|
||||
subjectSelector = [Global.ProxyTag],
|
||||
pingConfig = new()
|
||||
{
|
||||
destination = AppHandler.Instance.Config.SpeedTestItem.SpeedPingTestUrl,
|
||||
interval = "5m",
|
||||
timeout = "30s",
|
||||
sampling = 2,
|
||||
}
|
||||
};
|
||||
v2rayConfig.burstObservatory = burstObservatory;
|
||||
}
|
||||
var strategyType = multipleLoad switch
|
||||
{
|
||||
EMultipleLoad.Random => "random",
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ public class SpeedtestService
|
|||
{
|
||||
return false;
|
||||
}
|
||||
await Task.Delay(1000);
|
||||
|
||||
var downloadHandle = new DownloadService();
|
||||
|
||||
|
|
@ -255,9 +256,13 @@ public class SpeedtestService
|
|||
try
|
||||
{
|
||||
pid = await CoreHandler.Instance.LoadCoreConfigSpeedtest(it);
|
||||
if (pid > 0)
|
||||
if (pid < 0)
|
||||
{
|
||||
await Task.Delay(500);
|
||||
UpdateFunc(it.IndexId, "", ResUI.FailedToRunCore);
|
||||
}
|
||||
else
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
var delay = await DoRealPing(downloadHandle, it);
|
||||
if (blSpeedTest)
|
||||
{
|
||||
|
|
@ -271,10 +276,6 @@ public class SpeedtestService
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateFunc(it.IndexId, "", ResUI.FailedToRunCore);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -485,6 +485,12 @@ public class UpdateService
|
|||
|
||||
private async Task UpdateOtherFiles(Config config, Action<bool, string> updateFunc)
|
||||
{
|
||||
//If it is not in China area, no update is required
|
||||
if (config.ConstItem.GeoSourceUrl.IsNotEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_updateFunc = updateFunc;
|
||||
|
||||
foreach (var url in Global.OtherGeoUrls)
|
||||
|
|
|
|||
|
|
@ -552,6 +552,7 @@ public class MainWindowViewModel : MyReactiveObject
|
|||
{
|
||||
await LoadCore();
|
||||
await SysProxyHandler.UpdateSysProxy(_config, false);
|
||||
await Task.Delay(1000);
|
||||
});
|
||||
Locator.Current.GetService<StatusBarViewModel>()?.TestServerAvailability();
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public partial class MainWindow : ReactiveWindow<MainWindowViewModel>
|
|||
InitializeComponent();
|
||||
|
||||
_config = AppHandler.Instance.Config;
|
||||
_manager = new WindowNotificationManager(TopLevel.GetTopLevel(this)) { MaxItems = 3, Position = NotificationPosition.BottomRight };
|
||||
_manager = new WindowNotificationManager(TopLevel.GetTopLevel(this)) { MaxItems = 3, Position = NotificationPosition.TopRight };
|
||||
|
||||
this.KeyDown += MainWindow_KeyDown;
|
||||
menuSettingsSetUWP.Click += menuSettingsSetUWP_Click;
|
||||
|
|
|
|||
Loading…
Reference in a new issue