Compare commits

..

No commits in common. "0c758a7fdc47ed035e86224fc96d213f32956640" and "2b5cbb5e74d2fc629332fa8eb984a807e8042a1a" have entirely different histories.

20 changed files with 34 additions and 45 deletions

View file

@ -710,7 +710,7 @@ namespace ServiceLib.Common
public static string StartupPath()
{
if (Utils.IsNonWindows() && Environment.GetEnvironmentVariable("V2RAYN_LOCAL_APPLICATION_DATA") == "1")
if (Utils.IsLinux() && Environment.GetEnvironmentVariable("V2RAYN_LOCAL_APPLICATION_DATA") == "1")
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "v2rayN");
}
@ -838,8 +838,6 @@ namespace ServiceLib.Common
public static bool IsOSX() => RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
public static bool IsNonWindows() => !RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
public static string GetExeName(string name)
{
return IsWindows() ? $"{name}.exe" : name;

View file

@ -46,7 +46,7 @@
public bool InitApp()
{
if (Utils.IsNonWindows() && Utils.HasWritePermission() == false)
if (Utils.IsLinux() && Utils.HasWritePermission() == false)
{
Environment.SetEnvironmentVariable("V2RAYN_LOCAL_APPLICATION_DATA", "1", EnvironmentVariableTarget.Process);
}

View file

@ -24,7 +24,7 @@ namespace ServiceLib.Handler
Environment.SetEnvironmentVariable("V2RAY_LOCATION_ASSET", Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
Environment.SetEnvironmentVariable("XRAY_LOCATION_ASSET", Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
if (Utils.IsNonWindows())
if (Utils.IsLinux() || Utils.IsOSX())
{
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
foreach (var it in coreInfo)
@ -221,7 +221,7 @@ namespace ServiceLib.Handler
{
return _config.TunModeItem.EnableTun
&& eCoreType == ECoreType.sing_box
&& (Utils.IsNonWindows())
&& (Utils.IsLinux() || Utils.IsOSX())
//&& _config.TunModeItem.LinuxSudoPwd.IsNotEmpty()
;
}

View file

@ -16,9 +16,9 @@
/// </summary>
private static readonly List<string> LstTypes = ["setwebproxy", "setsecurewebproxy", "setsocksfirewallproxy"];
public static async Task SetProxy(string host, int port, string exceptions)
public static async Task SetProxy(string host, int port)
{
var lstCmd = GetSetCmds(host, port, exceptions);
var lstCmd = GetSetCmds(host, port);
await ExecCmd(lstCmd);
}
@ -42,7 +42,7 @@
}
}
private static List<CmdItem> GetSetCmds(string host, int port, string exceptions)
private static List<CmdItem> GetSetCmds(string host, int port)
{
List<CmdItem> lstCmd = [];
foreach (var interf in LstInterface)
@ -52,17 +52,7 @@
lstCmd.Add(new CmdItem()
{
Cmd = "networksetup",
Arguments = [$"-{type}", interf, host, port.ToString()]
});
}
if (exceptions.IsNotEmpty())
{
List<string> args = [$"-setproxybypassdomains", interf];
args.AddRange(exceptions.Split(','));
lstCmd.Add(new CmdItem()
{
Cmd = "networksetup",
Arguments = args
Arguments = [$"-{type}", interf, host, (type.Contains("socks") ? (port - 1) : port).ToString()]
});
}
}

View file

@ -32,7 +32,7 @@
break;
case ESysProxyType.ForcedChange when Utils.IsOSX():
await ProxySettingOSX.SetProxy(Global.Loopback, port, exceptions);
await ProxySettingOSX.SetProxy(Global.Loopback, port);
break;
case ESysProxyType.ForcedClear when Utils.IsWindows():

View file

@ -262,7 +262,7 @@ namespace ServiceLib.ViewModels
FileManager.ZipExtractToFile(fileName, toPath, _config.GuiItem.IgnoreGeoUpdateCore ? "geo" : "");
}
if (Utils.IsNonWindows())
if (Utils.IsLinux() || Utils.IsOSX())
{
var filesList = (new DirectoryInfo(toPath)).GetFiles().Select(u => u.FullName).ToList();
foreach (var file in filesList)

View file

@ -6,18 +6,18 @@
</Design.PreviewWith>
<Style Selector="TextBlock.Margin8">
<Setter Property="Margin" Value="8" />
<Setter Property="Margin" Value="10" />
</Style>
<Style Selector="StackPanel.Margin8">
<Setter Property="Margin" Value="8" />
<Setter Property="Margin" Value="10" />
</Style>
<Style Selector="DockPanel.Margin8">
<Setter Property="Margin" Value="8" />
<Setter Property="Margin" Value="10" />
</Style>
<Style Selector="WrapPanel.Margin8">
<Setter Property="Margin" Value="8" />
<Setter Property="Margin" Value="10" />
</Style>
<Style Selector="Grid.Margin8">
<Setter Property="Margin" Value="8" />
<Setter Property="Margin" Value="10" />
</Style>
</Styles>

View file

@ -8,7 +8,7 @@
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
Title="{x:Static resx:ResUI.menuServers}"
Width="900"
Height="600"
Height="700"
x:DataType="vms:AddServerViewModel"
ShowInTaskbar="False"
WindowStartupLocation="CenterScreen"

View file

@ -50,7 +50,7 @@
<Border
Width="500"
Height="80"
Margin="-8"
Margin="-2"
VerticalAlignment="Center"
Theme="{StaticResource CardBorder}">
<Grid>

View file

@ -7,8 +7,8 @@
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
Title="{x:Static resx:ResUI.menuDNSSetting}"
Width="900"
Height="600"
Width="1000"
Height="700"
x:DataType="vms:DNSSettingViewModel"
ShowInTaskbar="False"
WindowStartupLocation="CenterScreen"

View file

@ -10,7 +10,7 @@
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
Title="v2rayN"
Width="900"
Height="600"
Height="700"
MinWidth="900"
x:DataType="vms:MainWindowViewModel"
Icon="/Assets/NotifyIcon1.ico"

View file

@ -8,7 +8,7 @@
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
Title="{x:Static resx:ResUI.menuSetting}"
Width="1000"
Height="600"
Height="700"
x:DataType="vms:OptionSettingViewModel"
ShowInTaskbar="False"
WindowStartupLocation="CenterScreen"

View file

@ -215,7 +215,7 @@ namespace v2rayN.Desktop.Views
{
return lstFonts;
}
else if (Utils.IsNonWindows())
else if (Utils.IsLinux() || Utils.IsOSX())
{
var result = await Utils.GetLinuxFontFamily("zh");
if (result.IsNullOrEmpty())

View file

@ -8,7 +8,7 @@
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
Title="{x:Static resx:ResUI.menuRoutingRuleDetailsSetting}"
Width="900"
Height="600"
Height="700"
x:DataType="vms:RoutingRuleDetailsViewModel"
ShowInTaskbar="False"
WindowStartupLocation="CenterScreen"

View file

@ -7,8 +7,8 @@
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
Title="{x:Static resx:ResUI.menuRoutingRuleSetting}"
Width="900"
Height="600"
Width="1000"
Height="700"
x:DataType="vms:RoutingRuleSettingViewModel"
ShowInTaskbar="False"
WindowStartupLocation="CenterScreen"

View file

@ -7,8 +7,8 @@
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
Title="{x:Static resx:ResUI.menuRoutingSetting}"
Width="900"
Height="600"
Width="1000"
Height="700"
x:DataType="vms:RoutingSettingViewModel"
ShowInTaskbar="False"
WindowStartupLocation="CenterScreen"

View file

@ -23,6 +23,7 @@
</StackPanel>
<StackPanel
Width="120"
Margin="8,0"
VerticalAlignment="Center"
DockPanel.Dock="Left">
@ -33,6 +34,7 @@
<StackPanel
x:Name="spEnableTun"
Width="100"
Margin="8,0"
VerticalAlignment="Center"
DockPanel.Dock="Left"

View file

@ -8,7 +8,7 @@
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
Title="{x:Static resx:ResUI.menuSubSetting}"
Width="700"
Height="600"
Height="650"
ShowInTaskbar="False"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">

View file

@ -8,8 +8,8 @@
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
Title="{x:Static resx:ResUI.menuSubSetting}"
Width="900"
Height="600"
Width="1000"
Height="700"
x:DataType="vms:SubSettingViewModel"
ShowInTaskbar="False"
WindowStartupLocation="CenterScreen"

View file

@ -27,7 +27,7 @@
</StackPanel>
<StackPanel
Width="Auto"
Width="120"
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
DockPanel.Dock="Left">
@ -38,7 +38,7 @@
<StackPanel
x:Name="spEnableTun"
Width="Auto"
Width="auto"
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
DockPanel.Dock="Left"
@ -46,7 +46,6 @@
<TextBlock
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
Style="{StaticResource StatusbarItem}"
Text="{x:Static resx:ResUI.TbEnableTunAs}" />
<ToggleButton
x:Name="togEnableTun"