mirror of
https://github.com/2dust/v2rayN.git
synced 2026-05-30 09:44:09 +00:00
Fix
This commit is contained in:
parent
a1f5693180
commit
3becb5b9d1
14 changed files with 72 additions and 34 deletions
|
|
@ -1792,6 +1792,7 @@ public static class ConfigHandler
|
||||||
{
|
{
|
||||||
EConfigType.VMess => await AddVMessServer(config, profileItem),
|
EConfigType.VMess => await AddVMessServer(config, profileItem),
|
||||||
EConfigType.Shadowsocks => await AddShadowsocksServer(config, profileItem),
|
EConfigType.Shadowsocks => await AddShadowsocksServer(config, profileItem),
|
||||||
|
EConfigType.HTTP => await AddHttpServer(config, profileItem),
|
||||||
EConfigType.SOCKS => await AddSocksServer(config, profileItem),
|
EConfigType.SOCKS => await AddSocksServer(config, profileItem),
|
||||||
EConfigType.Trojan => await AddTrojanServer(config, profileItem),
|
EConfigType.Trojan => await AddTrojanServer(config, profileItem),
|
||||||
EConfigType.VLESS => await AddVlessServer(config, profileItem),
|
EConfigType.VLESS => await AddVlessServer(config, profileItem),
|
||||||
|
|
@ -1800,6 +1801,7 @@ public static class ConfigHandler
|
||||||
EConfigType.WireGuard => await AddWireguardServer(config, profileItem),
|
EConfigType.WireGuard => await AddWireguardServer(config, profileItem),
|
||||||
EConfigType.Anytls => await AddAnytlsServer(config, profileItem),
|
EConfigType.Anytls => await AddAnytlsServer(config, profileItem),
|
||||||
EConfigType.Naive => await AddNaiveServer(config, profileItem),
|
EConfigType.Naive => await AddNaiveServer(config, profileItem),
|
||||||
|
EConfigType.PolicyGroup or EConfigType.ProxyChain => await AddServerCommon(config, profileItem),
|
||||||
_ => -1,
|
_ => -1,
|
||||||
};
|
};
|
||||||
if (addStatus == 0)
|
if (addStatus == 0)
|
||||||
|
|
@ -1862,9 +1864,18 @@ public static class ConfigHandler
|
||||||
counter = await AddBatchServers4Wireguard(config, strData, subid, isSub);
|
counter = await AddBatchServers4Wireguard(config, strData, subid, isSub);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (counter < 1)
|
//May be standard uri mixed with internal uri
|
||||||
|
var innerUriCount = await AddBatchServers4InnerUri(config, strData, subid, isSub);
|
||||||
|
if (innerUriCount > 0)
|
||||||
{
|
{
|
||||||
counter = await AddBatchServers4InnerUri(config, strData, subid, isSub);
|
if (counter > 0)
|
||||||
|
{
|
||||||
|
counter += innerUriCount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
counter = innerUriCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//maybe other sub
|
//maybe other sub
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,6 @@ public class InnerFmt
|
||||||
// Unsupported, also to avoid possible sources of attacks, skip it
|
// Unsupported, also to avoid possible sources of attacks, skip it
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (profileItem.ConfigVersion != 4)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// overwrite indexId
|
// overwrite indexId
|
||||||
var newIndexId = Utils.GetGuid(false);
|
var newIndexId = Utils.GetGuid(false);
|
||||||
if (!profileItem.IndexId.IsNullOrEmpty())
|
if (!profileItem.IndexId.IsNullOrEmpty())
|
||||||
|
|
@ -48,6 +44,7 @@ public class InnerFmt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// For group-type profile items, also overwrite the ChildItems and ChildSubId
|
// For group-type profile items, also overwrite the ChildItems and ChildSubId
|
||||||
|
var emptyGroupProfileList = new List<ProfileItem>();
|
||||||
foreach (var item in list.Where(i => i.ConfigType.IsGroupType()))
|
foreach (var item in list.Where(i => i.ConfigType.IsGroupType()))
|
||||||
{
|
{
|
||||||
var protocolExtra = item.GetProtocolExtra();
|
var protocolExtra = item.GetProtocolExtra();
|
||||||
|
|
@ -87,7 +84,14 @@ public class InnerFmt
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
item.SetProtocolExtra(protocolExtra);
|
item.SetProtocolExtra(protocolExtra);
|
||||||
|
if (protocolExtra.SubChildItems.IsNullOrEmpty()
|
||||||
|
&& protocolExtra.ChildItems.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
emptyGroupProfileList.Add(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// Remove empty group profile items
|
||||||
|
list.RemoveAll(emptyGroupProfileList.Contains);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,6 +176,29 @@ public class InnerFmt
|
||||||
jsonObj.Remove("TransportExtraObj");
|
jsonObj.Remove("TransportExtraObj");
|
||||||
}
|
}
|
||||||
var profileItem = JsonUtils.Deserialize<ProfileItem>(JsonUtils.Serialize(jsonObj, false));
|
var profileItem = JsonUtils.Deserialize<ProfileItem>(JsonUtils.Serialize(jsonObj, false));
|
||||||
|
if (profileItem is null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (profileItem.ConfigVersion != 4)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// Check Enum.IsDefined
|
||||||
|
if (!Enum.IsDefined(typeof(EConfigType), profileItem.ConfigType))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (profileItem.CoreType is not (null or ECoreType.Xray or ECoreType.sing_box))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var protocolExtra = profileItem.GetProtocolExtra();
|
||||||
|
var multipleLoad = protocolExtra.MultipleLoad;
|
||||||
|
if (multipleLoad is not null && !Enum.IsDefined(typeof(EMultipleLoad), multipleLoad))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return profileItem;
|
return profileItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
18
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
18
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
|
|
@ -1023,6 +1023,15 @@ namespace ServiceLib.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Export v2rayN Internal Share Link to Clipboard 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string menuExport2InnerUri {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("menuExport2InnerUri", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Export Share Link to Clipboard 的本地化字符串。
|
/// 查找类似 Export Share Link to Clipboard 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -1041,15 +1050,6 @@ namespace ServiceLib.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查找类似 Backup to Clipboard 的本地化字符串。
|
|
||||||
/// </summary>
|
|
||||||
public static string menuExport4Backup {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("menuExport4Backup", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Export 的本地化字符串。
|
/// 查找类似 Export 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1728,7 +1728,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
||||||
<data name="TbPreSharedKey" xml:space="preserve">
|
<data name="TbPreSharedKey" xml:space="preserve">
|
||||||
<value>PreSharedKey</value>
|
<value>PreSharedKey</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="menuExport4Backup" xml:space="preserve">
|
<data name="menuExport2InnerUri" xml:space="preserve">
|
||||||
<value>Backup to Clipboard</value>
|
<value>Export v2rayN Internal Share Link to Clipboard</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1725,7 +1725,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
||||||
<data name="TbPreSharedKey" xml:space="preserve">
|
<data name="TbPreSharedKey" xml:space="preserve">
|
||||||
<value>PreSharedKey</value>
|
<value>PreSharedKey</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="menuExport4Backup" xml:space="preserve">
|
<data name="menuExport2InnerUri" xml:space="preserve">
|
||||||
<value>Backup to Clipboard</value>
|
<value>Export v2rayN Internal Share Link to Clipboard</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1728,7 +1728,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
||||||
<data name="TbPreSharedKey" xml:space="preserve">
|
<data name="TbPreSharedKey" xml:space="preserve">
|
||||||
<value>PreSharedKey</value>
|
<value>PreSharedKey</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="menuExport4Backup" xml:space="preserve">
|
<data name="menuExport2InnerUri" xml:space="preserve">
|
||||||
<value>Backup to Clipboard</value>
|
<value>Export v2rayN Internal Share Link to Clipboard</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1728,7 +1728,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
||||||
<data name="TbPreSharedKey" xml:space="preserve">
|
<data name="TbPreSharedKey" xml:space="preserve">
|
||||||
<value>PreSharedKey</value>
|
<value>PreSharedKey</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="menuExport4Backup" xml:space="preserve">
|
<data name="menuExport2InnerUri" xml:space="preserve">
|
||||||
<value>Backup to Clipboard</value>
|
<value>Export v2rayN Internal Share Link to Clipboard</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1728,7 +1728,7 @@
|
||||||
<data name="TbPreSharedKey" xml:space="preserve">
|
<data name="TbPreSharedKey" xml:space="preserve">
|
||||||
<value>PreSharedKey</value>
|
<value>PreSharedKey</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="menuExport4Backup" xml:space="preserve">
|
<data name="menuExport2InnerUri" xml:space="preserve">
|
||||||
<value>Backup to Clipboard</value>
|
<value>Export v2rayN Internal Share Link to Clipboard</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1725,7 +1725,7 @@
|
||||||
<data name="TbPreSharedKey" xml:space="preserve">
|
<data name="TbPreSharedKey" xml:space="preserve">
|
||||||
<value>PreSharedKey</value>
|
<value>PreSharedKey</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="menuExport4Backup" xml:space="preserve">
|
<data name="menuExport2InnerUri" xml:space="preserve">
|
||||||
<value>备份至剪贴板 (多选)</value>
|
<value>导出 v2rayN 内部分享链接至剪贴板 (多选)</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1725,7 +1725,7 @@
|
||||||
<data name="TbPreSharedKey" xml:space="preserve">
|
<data name="TbPreSharedKey" xml:space="preserve">
|
||||||
<value>PreSharedKey</value>
|
<value>PreSharedKey</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="menuExport4Backup" xml:space="preserve">
|
<data name="menuExport2InnerUri" xml:space="preserve">
|
||||||
<value>Backup to Clipboard</value>
|
<value>Export v2rayN Internal Share Link to Clipboard</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -192,7 +192,7 @@
|
||||||
Header="{x:Static resx:ResUI.menuExport2ShareUrl}"
|
Header="{x:Static resx:ResUI.menuExport2ShareUrl}"
|
||||||
InputGesture="Ctrl+C" />
|
InputGesture="Ctrl+C" />
|
||||||
<MenuItem x:Name="menuExport2ShareUrlBase64" Header="{x:Static resx:ResUI.menuExport2ShareUrlBase64}" />
|
<MenuItem x:Name="menuExport2ShareUrlBase64" Header="{x:Static resx:ResUI.menuExport2ShareUrlBase64}" />
|
||||||
<MenuItem x:Name="menuExport4Backup" Header="{x:Static resx:ResUI.menuExport4Backup}" />
|
<MenuItem x:Name="menuExport2InnerUri" Header="{x:Static resx:ResUI.menuExport2InnerUri}" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<Separator />
|
<Separator />
|
||||||
<MenuItem Header="{x:Static resx:ResUI.menuGenGroupServer}">
|
<MenuItem Header="{x:Static resx:ResUI.menuGenGroupServer}">
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ public partial class ProfilesView : ReactiveUserControl<ProfilesViewModel>
|
||||||
this.BindCommand(ViewModel, vm => vm.Export2ClientConfigClipboardCmd, v => v.menuExport2ClientConfigClipboard).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.Export2ClientConfigClipboardCmd, v => v.menuExport2ClientConfigClipboard).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.Export2ShareUrlCmd, v => v.menuExport2ShareUrl).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.Export2ShareUrlCmd, v => v.menuExport2ShareUrl).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.Export2ShareUrlBase64Cmd, v => v.menuExport2ShareUrlBase64).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.Export2ShareUrlBase64Cmd, v => v.menuExport2ShareUrlBase64).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.Export2InnerUriCmd, v => v.menuExport4Backup).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.Export2InnerUriCmd, v => v.menuExport2InnerUri).DisposeWith(disposables);
|
||||||
|
|
||||||
AppEvents.AppExitRequested
|
AppEvents.AppExitRequested
|
||||||
.AsObservable()
|
.AsObservable()
|
||||||
|
|
|
||||||
|
|
@ -243,9 +243,9 @@
|
||||||
Height="{StaticResource MenuItemHeight}"
|
Height="{StaticResource MenuItemHeight}"
|
||||||
Header="{x:Static resx:ResUI.menuExport2ShareUrlBase64}" />
|
Header="{x:Static resx:ResUI.menuExport2ShareUrlBase64}" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
x:Name="menuExport4Backup"
|
x:Name="menuExport2InnerUri"
|
||||||
Height="{StaticResource MenuItemHeight}"
|
Height="{StaticResource MenuItemHeight}"
|
||||||
Header="{x:Static resx:ResUI.menuExport4Backup}" />
|
Header="{x:Static resx:ResUI.menuExport2InnerUri}" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<Separator />
|
<Separator />
|
||||||
<MenuItem Header="{x:Static resx:ResUI.menuGenGroupServer}">
|
<MenuItem Header="{x:Static resx:ResUI.menuGenGroupServer}">
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ public partial class ProfilesView
|
||||||
this.BindCommand(ViewModel, vm => vm.Export2ClientConfigClipboardCmd, v => v.menuExport2ClientConfigClipboard).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.Export2ClientConfigClipboardCmd, v => v.menuExport2ClientConfigClipboard).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.Export2ShareUrlCmd, v => v.menuExport2ShareUrl).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.Export2ShareUrlCmd, v => v.menuExport2ShareUrl).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.Export2ShareUrlBase64Cmd, v => v.menuExport2ShareUrlBase64).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.Export2ShareUrlBase64Cmd, v => v.menuExport2ShareUrlBase64).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.Export2InnerUriCmd, v => v.menuExport4Backup).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.Export2InnerUriCmd, v => v.menuExport2InnerUri).DisposeWith(disposables);
|
||||||
|
|
||||||
AppEvents.AppExitRequested
|
AppEvents.AppExitRequested
|
||||||
.AsObservable()
|
.AsObservable()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue