mirror of https://github.com/2dust/v2rayN
Merge branch '2dust:master' into master
commit
3e3a079ba1
|
@ -9,8 +9,9 @@ namespace v2rayN.Base
|
|||
private static readonly Lazy<SqliteHelper> _instance = new(() => new());
|
||||
public static SqliteHelper Instance => _instance.Value;
|
||||
private string _connstr;
|
||||
public SQLiteConnection _db;
|
||||
public SQLiteAsyncConnection _dbAsync;
|
||||
private SQLiteConnection _db;
|
||||
private SQLiteAsyncConnection _dbAsync;
|
||||
private static readonly object objLock = new();
|
||||
|
||||
public SqliteHelper()
|
||||
{
|
||||
|
@ -33,31 +34,43 @@ namespace v2rayN.Base
|
|||
return await _dbAsync.InsertAsync(model);
|
||||
}
|
||||
public int Replace(object model)
|
||||
{
|
||||
lock (objLock)
|
||||
{
|
||||
return _db.InsertOrReplace(model);
|
||||
}
|
||||
}
|
||||
public async Task<int> Replacesync(object model)
|
||||
{
|
||||
return await _dbAsync.InsertOrReplaceAsync(model);
|
||||
}
|
||||
|
||||
public int Update(object model)
|
||||
{
|
||||
lock (objLock)
|
||||
{
|
||||
return _db.Update(model);
|
||||
}
|
||||
}
|
||||
public async Task<int> UpdateAsync(object model)
|
||||
{
|
||||
return await _dbAsync.UpdateAsync(model);
|
||||
}
|
||||
public int UpdateAll(IEnumerable models)
|
||||
{
|
||||
lock (objLock)
|
||||
{
|
||||
return _db.UpdateAll(models);
|
||||
}
|
||||
}
|
||||
|
||||
public int Delete(object model)
|
||||
{
|
||||
lock (objLock)
|
||||
{
|
||||
return _db.Delete(model);
|
||||
}
|
||||
}
|
||||
public async Task<int> DeleteAsync(object model)
|
||||
{
|
||||
return await _dbAsync.DeleteAsync(model);
|
||||
|
|
|
@ -959,7 +959,7 @@ namespace v2rayN.Handler
|
|||
var existItem = lstOriSub?.FirstOrDefault(t => CompareProfileItem(t, profileItem, true));
|
||||
if (existItem != null)
|
||||
{
|
||||
profileItem = existItem;
|
||||
profileItem.indexId = existItem.indexId;
|
||||
}
|
||||
//filter
|
||||
if (!Utils.IsNullOrEmpty(subFilter))
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace v2rayN.Handler
|
|||
|
||||
_lstProfileEx = new(SqliteHelper.Instance.Table<ProfileExItem>());
|
||||
|
||||
Task.Run(async () =>
|
||||
Task.Run(() =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ namespace v2rayN.Handler
|
|||
var item = _lstProfileEx.FirstOrDefault(t => t.indexId == id);
|
||||
if (item is not null)
|
||||
{
|
||||
await SqliteHelper.Instance.Replacesync(item);
|
||||
SqliteHelper.Instance.Replace(item);
|
||||
}
|
||||
}
|
||||
Thread.Sleep(1000 * 60);
|
||||
|
|
|
@ -162,7 +162,7 @@ namespace v2rayN.Handler
|
|||
todayDown = 0,
|
||||
dateNow = ticks
|
||||
};
|
||||
_ = SqliteHelper.Instance.Replacesync(_serverStatItem);
|
||||
SqliteHelper.Instance.Replace(_serverStatItem);
|
||||
_lstServerStat.Add(_serverStatItem);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,14 @@
|
|||
{
|
||||
"outboundTag": "proxy",
|
||||
"ip": [
|
||||
"geoip:telegram"
|
||||
"geoip:cloudflare",
|
||||
"geoip:cloudfront",
|
||||
"geoip:facebook",
|
||||
"geoip:fastly",
|
||||
"geoip:google",
|
||||
"geoip:netflix",
|
||||
"geoip:telegram",
|
||||
"geoip:twitter"
|
||||
],
|
||||
"domain": [
|
||||
"geosite:gfw",
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"servers": [
|
||||
{
|
||||
"tag": "out_dns",
|
||||
"address": "8.8.8.8",
|
||||
"detour": "proxy"
|
||||
},
|
||||
{
|
||||
"tag": "local",
|
||||
"address": "223.5.5.5",
|
||||
|
@ -11,6 +16,11 @@
|
|||
}
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"geosite": "cn",
|
||||
"server": "local",
|
||||
"disable_cache": true
|
||||
},
|
||||
{
|
||||
"geosite": "category-ads-all",
|
||||
"server": "block",
|
||||
|
|
|
@ -299,7 +299,7 @@ namespace v2rayN.ViewModels
|
|||
UI.Show(ResUI.OperationSuccess);
|
||||
}
|
||||
}
|
||||
private void ImportRulesFromUrl()
|
||||
private async Task ImportRulesFromUrl()
|
||||
{
|
||||
var url = SelectedRouting.url;
|
||||
if (Utils.IsNullOrEmpty(url))
|
||||
|
@ -308,10 +308,8 @@ namespace v2rayN.ViewModels
|
|||
return;
|
||||
}
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
DownloadHandle downloadHandle = new DownloadHandle();
|
||||
string result = await downloadHandle.DownloadStringAsync(url, false, "");
|
||||
string result = await downloadHandle.TryDownloadString(url, true, "");
|
||||
if (AddBatchRoutingRules(SelectedRouting, result) == 0)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke((Action)(() =>
|
||||
|
@ -320,7 +318,6 @@ namespace v2rayN.ViewModels
|
|||
}));
|
||||
UI.Show(ResUI.OperationSuccess);
|
||||
}
|
||||
});
|
||||
}
|
||||
private int AddBatchRoutingRules(RoutingItem routingItem, string clipboardData)
|
||||
{
|
||||
|
|
|
@ -53,7 +53,10 @@
|
|||
<MenuItem Padding="8,0">
|
||||
<MenuItem.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="Server" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Server" />
|
||||
<TextBlock Text="{x:Static resx:ResUI.menuServers}" />
|
||||
</StackPanel>
|
||||
</MenuItem.Header>
|
||||
|
@ -99,7 +102,10 @@
|
|||
<MenuItem Padding="8,0">
|
||||
<MenuItem.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="BookClockOutline" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="BookClockOutline" />
|
||||
<TextBlock Text="{x:Static resx:ResUI.menuSubscription}" />
|
||||
</StackPanel>
|
||||
</MenuItem.Header>
|
||||
|
@ -131,7 +137,10 @@
|
|||
<MenuItem Padding="8,0">
|
||||
<MenuItem.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="SettingsOutline" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="SettingsOutline" />
|
||||
<TextBlock Text="{x:Static resx:ResUI.menuSetting}" />
|
||||
</StackPanel>
|
||||
</MenuItem.Header>
|
||||
|
@ -169,7 +178,10 @@
|
|||
<MenuItem x:Name="menuReload" Padding="8,0">
|
||||
<MenuItem.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="Reload" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Reload" />
|
||||
<TextBlock Text="{x:Static resx:ResUI.menuReload}" />
|
||||
</StackPanel>
|
||||
</MenuItem.Header>
|
||||
|
@ -180,7 +192,10 @@
|
|||
<MenuItem Padding="8,0">
|
||||
<MenuItem.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="Update" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Update" />
|
||||
<TextBlock Text="{x:Static resx:ResUI.menuCheckUpdate}" />
|
||||
</StackPanel>
|
||||
</MenuItem.Header>
|
||||
|
@ -221,7 +236,10 @@
|
|||
<MenuItem x:Name="menuHelp" Padding="8,0">
|
||||
<MenuItem.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="HelpCircleOutline" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="HelpCircleOutline" />
|
||||
<TextBlock Text="{x:Static resx:ResUI.menuHelp}" />
|
||||
</StackPanel>
|
||||
</MenuItem.Header>
|
||||
|
@ -235,7 +253,10 @@
|
|||
Click="menuPromotion_Click">
|
||||
<MenuItem.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="VolumeHigh" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="VolumeHigh" />
|
||||
<TextBlock Text="{x:Static resx:ResUI.menuPromotion}" />
|
||||
</StackPanel>
|
||||
</MenuItem.Header>
|
||||
|
@ -249,7 +270,10 @@
|
|||
Click="menuClose_Click">
|
||||
<MenuItem.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="Minimize" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Minimize" />
|
||||
<TextBlock Text="{x:Static resx:ResUI.menuClose}" />
|
||||
</StackPanel>
|
||||
</MenuItem.Header>
|
||||
|
@ -352,7 +376,7 @@
|
|||
Height="30"
|
||||
Margin="4,0"
|
||||
Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}">
|
||||
<materialDesign:PackIcon Kind="Plus" />
|
||||
<materialDesign:PackIcon VerticalAlignment="Center" Kind="Plus" />
|
||||
</Button>
|
||||
<TextBox
|
||||
x:Name="txtServerFilter"
|
||||
|
@ -713,6 +737,7 @@
|
|||
<materialDesign:PackIcon
|
||||
x:Name="menuSystemProxyClear2"
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Check" />
|
||||
<TextBlock Text="{x:Static resx:ResUI.menuSystemProxyClear}" />
|
||||
</StackPanel>
|
||||
|
@ -724,6 +749,7 @@
|
|||
<materialDesign:PackIcon
|
||||
x:Name="menuSystemProxySet2"
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Check" />
|
||||
<TextBlock Text="{x:Static resx:ResUI.menuSystemProxySet}" />
|
||||
</StackPanel>
|
||||
|
@ -735,6 +761,7 @@
|
|||
<materialDesign:PackIcon
|
||||
x:Name="menuSystemProxyNothing2"
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Check" />
|
||||
<TextBlock Text="{x:Static resx:ResUI.menuSystemProxyNothing}" />
|
||||
</StackPanel>
|
||||
|
@ -746,6 +773,7 @@
|
|||
<materialDesign:PackIcon
|
||||
x:Name="menuSystemProxyPac2"
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Check" />
|
||||
<TextBlock Text="{x:Static resx:ResUI.menuSystemProxyPac}" />
|
||||
</StackPanel>
|
||||
|
|
|
@ -191,6 +191,11 @@ namespace v2rayN.Views
|
|||
this.Title = $"{Utils.GetVersion()} - {(IsAdministrator ? ResUI.RunAsAdmin : ResUI.NotRunAsAdmin)}";
|
||||
|
||||
spEnableTun.Visibility = IsAdministrator ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
if (_config.uiItem.autoHideStartup)
|
||||
{
|
||||
WindowState = WindowState.Minimized;
|
||||
}
|
||||
}
|
||||
|
||||
#region Event
|
||||
|
|
|
@ -32,28 +32,40 @@
|
|||
Style="{StaticResource MaterialDesignToolBar}">
|
||||
<Button x:Name="menuRuleAdd">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="Plus" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Plus" />
|
||||
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuRuleAdd}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Separator />
|
||||
<Button x:Name="menuImportRulesFromFile">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="Import" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Import" />
|
||||
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuImportRulesFromFile}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Separator />
|
||||
<Button x:Name="menuImportRulesFromClipboard">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="Import" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Import" />
|
||||
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuImportRulesFromClipboard}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Separator />
|
||||
<Button x:Name="menuImportRulesFromUrl">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="Import" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Import" />
|
||||
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuImportRulesFromUrl}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
|
|
@ -39,7 +39,10 @@
|
|||
<MenuItem x:Name="menuRoutingBasic" Padding="8,0">
|
||||
<MenuItem.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="Server" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Server" />
|
||||
<TextBlock Text="{x:Static resx:ResUI.menuRoutingBasic}" />
|
||||
</StackPanel>
|
||||
</MenuItem.Header>
|
||||
|
@ -54,7 +57,10 @@
|
|||
<MenuItem x:Name="menuRoutingAdvanced" Padding="8,0">
|
||||
<MenuItem.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="Routes" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Routes" />
|
||||
<TextBlock Text="{x:Static resx:ResUI.menuRoutingAdvanced}" />
|
||||
</StackPanel>
|
||||
</MenuItem.Header>
|
||||
|
|
|
@ -33,28 +33,40 @@
|
|||
Style="{StaticResource MaterialDesignToolBar}">
|
||||
<Button x:Name="menuSubAdd">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="Plus" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Plus" />
|
||||
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuSubAdd}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Separator />
|
||||
<Button x:Name="menuSubDelete">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="Delete" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Delete" />
|
||||
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuSubDelete}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Separator />
|
||||
<Button x:Name="menuSubEdit">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="Edit" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Edit" />
|
||||
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuSubEdit}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Separator />
|
||||
<Button x:Name="menuSubShare">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="QrcodePlus" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="QrcodePlus" />
|
||||
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuSubShare}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
@ -63,7 +75,10 @@
|
|||
Click="menuClose_Click"
|
||||
IsCancel="True">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="0,0,8,0" Kind="Close" />
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Close" />
|
||||
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuClose}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
|
||||
<Copyright>Copyright © 2017-2023 (GPLv3)</Copyright>
|
||||
<FileVersion>6.14</FileVersion>
|
||||
<FileVersion>6.15</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue