Compare commits

...

3 Commits

Author SHA1 Message Date
DHR60 09ea4890a7 Fix (#9771) 2026-07-16 17:37:17 +08:00
DHR60 5cc2aaba13 Fix (#9769) 2026-07-16 17:37:04 +08:00
DHR60 b8889bad86 Fix (#9768) 2026-07-16 17:36:51 +08:00
6 changed files with 41 additions and 30 deletions
@@ -35,18 +35,21 @@ public partial class CoreConfigSingboxService
} }
var lstDirectExe = BuildRoutingDirectExe(); var lstDirectExe = BuildRoutingDirectExe();
_coreConfig.route.rules.Add(new() if (lstDirectExe.Count > 0)
{ {
port = [53], _coreConfig.route.rules.Add(new()
action = "hijack-dns", {
process_path = lstDirectExe port = [53],
}); action = "hijack-dns",
process_path = lstDirectExe,
});
_coreConfig.route.rules.Add(new() _coreConfig.route.rules.Add(new()
{ {
outbound = Global.DirectTag, outbound = Global.DirectTag,
process_path = lstDirectExe process_path = lstDirectExe,
}); });
}
// ICMP Routing // ICMP Routing
var icmpRouting = _config.TunModeItem.IcmpRouting ?? ""; var icmpRouting = _config.TunModeItem.IcmpRouting ?? "";
@@ -14,17 +14,20 @@ public partial class CoreConfigV2rayService
_coreConfig.routing.rules.AddRange(tunRules); _coreConfig.routing.rules.AddRange(tunRules);
} }
var lstDirectExe = BuildRoutingDirectExe(); var lstDirectExe = BuildRoutingDirectExe();
_coreConfig.routing.rules.Add(new() if (lstDirectExe.Count > 0)
{ {
port = "53", _coreConfig.routing.rules.Add(new()
process = lstDirectExe, {
outboundTag = Global.DnsOutboundTag, port = "53",
}); process = lstDirectExe,
_coreConfig.routing.rules.Add(new() outboundTag = Global.DnsOutboundTag,
{ });
process = lstDirectExe, _coreConfig.routing.rules.Add(new()
outboundTag = Global.DirectTag, {
}); process = lstDirectExe,
outboundTag = Global.DirectTag,
});
}
_coreConfig.routing.rules.Add(new() _coreConfig.routing.rules.Add(new()
{ {
inboundTag = ["tun"], inboundTag = ["tun"],
@@ -263,6 +263,11 @@ public class MainWindowViewModel : MyReactiveObject
#endregion AppEvents #endregion AppEvents
ProfilesViewModel.RefreshServersRequested
.AsObservable()
.ObserveOn(RxSchedulers.MainThreadScheduler)
.Subscribe(async _ => await RefreshServers());
var vmReloadRequestedList = new List<IObservable<Unit>> var vmReloadRequestedList = new List<IObservable<Unit>>
{ {
ProfilesViewModel.ReloadRequested.AsObservable(), ProfilesViewModel.ReloadRequested.AsObservable(),
@@ -394,8 +399,8 @@ public class MainWindowViewModel : MyReactiveObject
private async Task RefreshServers() private async Task RefreshServers()
{ {
await ProfilesViewModel.RefreshServers(); await ProfilesViewModel.RefreshServersBiz();
await StatusBarViewModel.RefreshServers(); await StatusBarViewModel.RefreshServersBiz();
// await Task.Delay(200); // await Task.Delay(200);
} }
@@ -11,6 +11,7 @@ public class ProfilesViewModel : MyReactiveObject
public Interaction<Unit, Unit> AdjustMainLvColWidthInteraction { get; } = new(); public Interaction<Unit, Unit> AdjustMainLvColWidthInteraction { get; } = new();
public EventChannel<Unit> ReloadRequested { get; } = new(); public EventChannel<Unit> ReloadRequested { get; } = new();
public EventChannel<Unit> RefreshServersRequested { get; } = new();
#region private prop #region private prop
@@ -368,12 +369,14 @@ public class ProfilesViewModel : MyReactiveObject
public async Task RefreshServers() public async Task RefreshServers()
{ {
await RefreshServersBiz(); RefreshServersRequested.Publish();
// await Task.Delay(200); // await Task.Delay(200);
await Task.CompletedTask;
} }
private async Task RefreshServersBiz() public async Task RefreshServersBiz()
{ {
var lstModel = await GetProfileItemsEx(_config.SubIndexId, _serverFilter); var lstModel = await GetProfileItemsEx(_config.SubIndexId, _serverFilter);
_lstProfile = JsonUtils.Deserialize<List<ProfileItem>>(JsonUtils.Serialize(lstModel)) ?? []; _lstProfile = JsonUtils.Deserialize<List<ProfileItem>>(JsonUtils.Serialize(lstModel)) ?? [];
@@ -264,12 +264,7 @@ public class StatusBarViewModel : MyReactiveObject
await Task.Delay(1000); await Task.Delay(1000);
} }
public async Task RefreshServers() public async Task RefreshServersBiz()
{
await RefreshServersBiz();
}
private async Task RefreshServersBiz()
{ {
await RefreshServersMenu(); await RefreshServersMenu();
@@ -75,6 +75,8 @@ public partial class StatusBarView
interaction.SetOutput(Unit.Default); interaction.SetOutput(Unit.Default);
}).DisposeWith(disposables); }).DisposeWith(disposables);
}); });
_ = RefreshIcon();
} }
private async Task RefreshIcon() private async Task RefreshIcon()