mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-11 06:54:58 +03:00
Compare commits
6 Commits
165e0bf9e9
...
09ea4890a7
| Author | SHA1 | Date | |
|---|---|---|---|
| 09ea4890a7 | |||
| 5cc2aaba13 | |||
| b8889bad86 | |||
| 5dd5b25869 | |||
| fafdb4a0b6 | |||
| 223642dd67 |
@@ -1,7 +1,7 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>7.23.4</Version>
|
||||
<Version>7.24.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<PackageVersion Include="Semi.Avalonia.DataGrid" Version="12.1.0" />
|
||||
<PackageVersion Include="NLog" Version="6.1.4" />
|
||||
<PackageVersion Include="sqlite-net-e" Version="1.11.285" />
|
||||
<PackageVersion Include="Repobot.SQLite.Unofficial" Version="3.53.3.8" />
|
||||
<PackageVersion Include="Repobot.SQLite.Unofficial" Version="3.53.3" />
|
||||
<PackageVersion Include="TaskScheduler" Version="2.12.2" />
|
||||
<PackageVersion Include="WebDav.Client" Version="2.9.0" />
|
||||
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
|
||||
@@ -36,4 +36,4 @@
|
||||
<PackageVersion Include="ZXing.Net.Bindings.SkiaSharp" Version="0.16.22" />
|
||||
<PackageVersion Include="SkiaSharp.NativeAssets.Linux" Version="3.119.4" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -34,7 +34,18 @@ public class CoreAdminManager
|
||||
StringBuilder sb = new();
|
||||
sb.AppendLine("#!/bin/bash");
|
||||
var cmdLine = $"{fileName.AppendQuotes()} {string.Format(coreInfo.Arguments, Utils.GetBinConfigPath(configPath).AppendQuotes())}";
|
||||
sb.AppendLine($"exec sudo -S -- {cmdLine}");
|
||||
|
||||
// Passing environment variables to the sudo command, here it only xray or sing-box.
|
||||
if (coreInfo.Environment.Count > 0)
|
||||
{
|
||||
var envArgs = string.Join(" ", coreInfo.Environment.Where(kv => kv.Value.IsNotEmpty()).Select(kv => $"{kv.Key}={kv.Value.AppendQuotes()}"));
|
||||
sb.AppendLine($"exec sudo -S -- env {envArgs} {cmdLine}");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine($"exec sudo -S -- {cmdLine}");
|
||||
}
|
||||
|
||||
var shFilePath = await FileUtils.CreateLinuxShellFile("run_as_sudo.sh", sb.ToString(), true);
|
||||
|
||||
var procService = new ProcessService(
|
||||
|
||||
@@ -35,18 +35,21 @@ public partial class CoreConfigSingboxService
|
||||
}
|
||||
|
||||
var lstDirectExe = BuildRoutingDirectExe();
|
||||
_coreConfig.route.rules.Add(new()
|
||||
if (lstDirectExe.Count > 0)
|
||||
{
|
||||
port = [53],
|
||||
action = "hijack-dns",
|
||||
process_path = lstDirectExe
|
||||
});
|
||||
_coreConfig.route.rules.Add(new()
|
||||
{
|
||||
port = [53],
|
||||
action = "hijack-dns",
|
||||
process_path = lstDirectExe,
|
||||
});
|
||||
|
||||
_coreConfig.route.rules.Add(new()
|
||||
{
|
||||
outbound = Global.DirectTag,
|
||||
process_path = lstDirectExe
|
||||
});
|
||||
_coreConfig.route.rules.Add(new()
|
||||
{
|
||||
outbound = Global.DirectTag,
|
||||
process_path = lstDirectExe,
|
||||
});
|
||||
}
|
||||
|
||||
// ICMP Routing
|
||||
var icmpRouting = _config.TunModeItem.IcmpRouting ?? "";
|
||||
|
||||
@@ -14,17 +14,20 @@ public partial class CoreConfigV2rayService
|
||||
_coreConfig.routing.rules.AddRange(tunRules);
|
||||
}
|
||||
var lstDirectExe = BuildRoutingDirectExe();
|
||||
_coreConfig.routing.rules.Add(new()
|
||||
if (lstDirectExe.Count > 0)
|
||||
{
|
||||
port = "53",
|
||||
process = lstDirectExe,
|
||||
outboundTag = Global.DnsOutboundTag,
|
||||
});
|
||||
_coreConfig.routing.rules.Add(new()
|
||||
{
|
||||
process = lstDirectExe,
|
||||
outboundTag = Global.DirectTag,
|
||||
});
|
||||
_coreConfig.routing.rules.Add(new()
|
||||
{
|
||||
port = "53",
|
||||
process = lstDirectExe,
|
||||
outboundTag = Global.DnsOutboundTag,
|
||||
});
|
||||
_coreConfig.routing.rules.Add(new()
|
||||
{
|
||||
process = lstDirectExe,
|
||||
outboundTag = Global.DirectTag,
|
||||
});
|
||||
}
|
||||
_coreConfig.routing.rules.Add(new()
|
||||
{
|
||||
inboundTag = ["tun"],
|
||||
|
||||
@@ -263,6 +263,11 @@ public class MainWindowViewModel : MyReactiveObject
|
||||
|
||||
#endregion AppEvents
|
||||
|
||||
ProfilesViewModel.RefreshServersRequested
|
||||
.AsObservable()
|
||||
.ObserveOn(RxSchedulers.MainThreadScheduler)
|
||||
.Subscribe(async _ => await RefreshServers());
|
||||
|
||||
var vmReloadRequestedList = new List<IObservable<Unit>>
|
||||
{
|
||||
ProfilesViewModel.ReloadRequested.AsObservable(),
|
||||
@@ -394,8 +399,8 @@ public class MainWindowViewModel : MyReactiveObject
|
||||
|
||||
private async Task RefreshServers()
|
||||
{
|
||||
await ProfilesViewModel.RefreshServers();
|
||||
await StatusBarViewModel.RefreshServers();
|
||||
await ProfilesViewModel.RefreshServersBiz();
|
||||
await StatusBarViewModel.RefreshServersBiz();
|
||||
|
||||
// await Task.Delay(200);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ public class ProfilesViewModel : MyReactiveObject
|
||||
public Interaction<Unit, Unit> AdjustMainLvColWidthInteraction { get; } = new();
|
||||
|
||||
public EventChannel<Unit> ReloadRequested { get; } = new();
|
||||
public EventChannel<Unit> RefreshServersRequested { get; } = new();
|
||||
|
||||
#region private prop
|
||||
|
||||
@@ -368,12 +369,14 @@ public class ProfilesViewModel : MyReactiveObject
|
||||
|
||||
public async Task RefreshServers()
|
||||
{
|
||||
await RefreshServersBiz();
|
||||
RefreshServersRequested.Publish();
|
||||
|
||||
// await Task.Delay(200);
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task RefreshServersBiz()
|
||||
public async Task RefreshServersBiz()
|
||||
{
|
||||
var lstModel = await GetProfileItemsEx(_config.SubIndexId, _serverFilter);
|
||||
_lstProfile = JsonUtils.Deserialize<List<ProfileItem>>(JsonUtils.Serialize(lstModel)) ?? [];
|
||||
|
||||
@@ -264,12 +264,7 @@ public class StatusBarViewModel : MyReactiveObject
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
|
||||
public async Task RefreshServers()
|
||||
{
|
||||
await RefreshServersBiz();
|
||||
}
|
||||
|
||||
private async Task RefreshServersBiz()
|
||||
public async Task RefreshServersBiz()
|
||||
{
|
||||
await RefreshServersMenu();
|
||||
|
||||
|
||||
@@ -75,6 +75,8 @@ public partial class StatusBarView
|
||||
interaction.SetOutput(Unit.Default);
|
||||
}).DisposeWith(disposables);
|
||||
});
|
||||
|
||||
_ = RefreshIcon();
|
||||
}
|
||||
|
||||
private async Task RefreshIcon()
|
||||
|
||||
Reference in New Issue
Block a user