Compare commits

...

15 Commits
6.59 ... 6.60

56 changed files with 253 additions and 227 deletions

View File

@@ -9,8 +9,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.28.1" />
<PackageReference Include="Grpc.Net.Client" Version="2.65.0" />
<PackageReference Include="Google.Protobuf" Version="3.28.2" />
<PackageReference Include="Grpc.Net.Client" Version="2.66.0" />
<PackageReference Include="Grpc.Tools" Version="2.66.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@@ -15,11 +15,19 @@
this.version = $"{major}.{minor}.{patch}";
}
public SemanticVersion(string version)
public SemanticVersion(string? version)
{
this.version = version.RemovePrefix('v');
try
{
if (version.IsNullOrEmpty())
{
this.major = 0;
this.minor = 0;
this.patch = 0;
return;
}
this.version = version.RemovePrefix('v');
string[] parts = this.version.Split('.');
if (parts.Length == 2)
{
@@ -43,7 +51,6 @@
this.major = 0;
this.minor = 0;
this.patch = 0;
//this.version = "0.0.0";
}
}

View File

@@ -158,10 +158,11 @@ namespace ServiceLib.Common
/// </summary>
/// <param name="plainText"></param>
/// <returns></returns>
public static string Base64Decode(string plainText)
public static string Base64Decode(string? plainText)
{
try
{
if (plainText.IsNullOrEmpty()) return "";
plainText = plainText.Trim()
.Replace(Environment.NewLine, "")
.Replace("\n", "")
@@ -365,7 +366,7 @@ namespace ServiceLib.Common
}
}
public static bool IsBase64String(string plainText)
public static bool IsBase64String(string? plainText)
{
if (plainText.IsNullOrEmpty()) return false;
var buffer = new Span<byte>(new byte[plainText.Length]);
@@ -812,7 +813,7 @@ namespace ServiceLib.Common
}
if (coreType != null)
{
_tempPath = Path.Combine(_tempPath, coreType.ToString()!);
_tempPath = Path.Combine(_tempPath, coreType.ToString());
if (!Directory.Exists(_tempPath))
{
Directory.CreateDirectory(_tempPath);

View File

@@ -5,12 +5,12 @@
VMess = 1,
Custom = 2,
Shadowsocks = 3,
Socks = 4,
SOCKS = 4,
VLESS = 5,
Trojan = 6,
Hysteria2 = 7,
Tuic = 8,
Wireguard = 9,
Http = 10
TUIC = 8,
WireGuard = 9,
HTTP = 10
}
}

View File

@@ -137,25 +137,25 @@
{
{EConfigType.VMess,"vmess://"},
{EConfigType.Shadowsocks,"ss://"},
{EConfigType.Socks,"socks://"},
{EConfigType.SOCKS,"socks://"},
{EConfigType.VLESS,"vless://"},
{EConfigType.Trojan,"trojan://"},
{EConfigType.Hysteria2,"hysteria2://"},
{EConfigType.Tuic,"tuic://"},
{EConfigType.Wireguard,"wireguard://"}
{EConfigType.TUIC,"tuic://"},
{EConfigType.WireGuard,"wireguard://"}
};
public static readonly Dictionary<EConfigType, string> ProtocolTypes = new()
{
{EConfigType.VMess,"vmess"},
{EConfigType.Shadowsocks,"shadowsocks"},
{EConfigType.Socks,"socks"},
{EConfigType.Http,"http"},
{EConfigType.SOCKS,"socks"},
{EConfigType.HTTP,"http"},
{EConfigType.VLESS,"vless"},
{EConfigType.Trojan,"trojan"},
{EConfigType.Hysteria2,"hysteria2"},
{EConfigType.Tuic,"tuic"},
{EConfigType.Wireguard,"wireguard"}
{EConfigType.TUIC,"tuic"},
{EConfigType.WireGuard,"wireguard"}
};
public static readonly List<string> VmessSecurities = new() { "aes-128-gcm", "chacha20-poly1305", "auto", "none", "zero" };
@@ -166,7 +166,7 @@
public static readonly List<string> Flows = new() { "", "xtls-rprx-vision", "xtls-rprx-vision-udp443" };
public static readonly List<string> Networks = new() { "tcp", "kcp", "ws", "httpupgrade", "splithttp", "h2", "quic", "grpc" };
public static readonly List<string> KcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" };
public static readonly List<string> CoreTypes = new() { "v2fly", "SagerNet", "Xray", "sing_box" };
public static readonly List<string> CoreTypes = new() { "v2fly", "Xray", "sing_box" };//TODO
public static readonly List<string> CoreTypes4VLESS = new() { "Xray", "sing_box" };
public static readonly List<string> DomainStrategies = new() { "AsIs", "IPIfNonMatch", "IPOnDemand" };
public static readonly List<string> DomainStrategies4Singbox = new() { "ipv4_only", "ipv6_only", "prefer_ipv4", "prefer_ipv6", "" };

View File

@@ -140,7 +140,14 @@ namespace ServiceLib.Handler
}
if (Utils.IsNullOrEmpty(config.uiItem.currentLanguage))
{
config.uiItem.currentLanguage = Global.Languages[0];
if (Thread.CurrentThread.CurrentCulture.Name.Equals("zh-cn", StringComparison.CurrentCultureIgnoreCase))
{
config.uiItem.currentLanguage = Global.Languages[0];
}
else
{
config.uiItem.currentLanguage = Global.Languages[2];
}
}
if (config.constItem == null)
@@ -394,13 +401,13 @@ namespace ServiceLib.Handler
{
EConfigType.VMess => AddVMessServer(config, item),
EConfigType.Shadowsocks => AddShadowsocksServer(config, item),
EConfigType.Socks => AddSocksServer(config, item),
EConfigType.Http => AddHttpServer(config, item),
EConfigType.SOCKS => AddSocksServer(config, item),
EConfigType.HTTP => AddHttpServer(config, item),
EConfigType.Trojan => AddTrojanServer(config, item),
EConfigType.VLESS => AddVlessServer(config, item),
EConfigType.Hysteria2 => AddHysteria2Server(config, item),
EConfigType.Tuic => AddTuicServer(config, item),
EConfigType.Wireguard => AddWireguardServer(config, item),
EConfigType.TUIC => AddTuicServer(config, item),
EConfigType.WireGuard => AddWireguardServer(config, item),
_ => -1,
};
return ret;
@@ -732,7 +739,7 @@ namespace ServiceLib.Handler
/// <returns></returns>
public static int AddSocksServer(Config config, ProfileItem profileItem, bool toFile = true)
{
profileItem.configType = EConfigType.Socks;
profileItem.configType = EConfigType.SOCKS;
profileItem.address = profileItem.address.TrimEx();
@@ -749,7 +756,7 @@ namespace ServiceLib.Handler
/// <returns></returns>
public static int AddHttpServer(Config config, ProfileItem profileItem, bool toFile = true)
{
profileItem.configType = EConfigType.Http;
profileItem.configType = EConfigType.HTTP;
profileItem.address = profileItem.address.TrimEx();
@@ -822,7 +829,7 @@ namespace ServiceLib.Handler
/// <returns></returns>
public static int AddTuicServer(Config config, ProfileItem profileItem, bool toFile = true)
{
profileItem.configType = EConfigType.Tuic;
profileItem.configType = EConfigType.TUIC;
profileItem.coreType = ECoreType.sing_box;
profileItem.address = profileItem.address.TrimEx();
@@ -861,7 +868,7 @@ namespace ServiceLib.Handler
/// <returns></returns>
public static int AddWireguardServer(Config config, ProfileItem profileItem, bool toFile = true)
{
profileItem.configType = EConfigType.Wireguard;
profileItem.configType = EConfigType.WireGuard;
profileItem.coreType = ECoreType.sing_box;
profileItem.address = profileItem.address.TrimEx();
@@ -1256,12 +1263,12 @@ namespace ServiceLib.Handler
{
EConfigType.VMess => AddVMessServer(config, profileItem, false),
EConfigType.Shadowsocks => AddShadowsocksServer(config, profileItem, false),
EConfigType.Socks => AddSocksServer(config, profileItem, false),
EConfigType.SOCKS => AddSocksServer(config, profileItem, false),
EConfigType.Trojan => AddTrojanServer(config, profileItem, false),
EConfigType.VLESS => AddVlessServer(config, profileItem, false),
EConfigType.Hysteria2 => AddHysteria2Server(config, profileItem, false),
EConfigType.Tuic => AddTuicServer(config, profileItem, false),
EConfigType.Wireguard => AddWireguardServer(config, profileItem, false),
EConfigType.TUIC => AddTuicServer(config, profileItem, false),
EConfigType.WireGuard => AddWireguardServer(config, profileItem, false),
_ => -1,
};

View File

@@ -132,10 +132,10 @@ namespace ServiceLib.Handler.CoreConfig
{
continue;
}
var item = LazyConfig.Instance.GetProfileItem(it.indexId);
if (it.configType is EConfigType.VMess or EConfigType.VLESS)
{
var item2 = LazyConfig.Instance.GetProfileItem(it.indexId);
if (item2 is null || Utils.IsNullOrEmpty(item2.id) || !Utils.IsGuidByParse(item2.id))
if (item is null || Utils.IsNullOrEmpty(item.id) || !Utils.IsGuidByParse(item.id))
{
continue;
}
@@ -178,7 +178,6 @@ namespace ServiceLib.Handler.CoreConfig
singboxConfig.inbounds.Add(inbound);
//outbound
var item = LazyConfig.Instance.GetProfileItem(it.indexId);
if (item is null)
{
continue;
@@ -193,6 +192,12 @@ namespace ServiceLib.Handler.CoreConfig
{
continue;
}
if ((it.configType is EConfigType.VLESS or EConfigType.Trojan)
&& item.streamSecurity == Global.StreamSecurityReality
&& item.publicKey.IsNullOrEmpty())
{
continue;
}
var outbound = JsonUtils.Deserialize<Outbound4Sbox>(txtOutbound);
GenOutbound(item, outbound);
@@ -601,7 +606,7 @@ namespace ServiceLib.Handler.CoreConfig
GenOutboundMux(node, outbound);
break;
}
case EConfigType.Socks:
case EConfigType.SOCKS:
{
outbound.version = "5";
if (Utils.IsNotEmpty(node.security)
@@ -612,7 +617,7 @@ namespace ServiceLib.Handler.CoreConfig
}
break;
}
case EConfigType.Http:
case EConfigType.HTTP:
{
if (Utils.IsNotEmpty(node.security)
&& Utils.IsNotEmpty(node.id))
@@ -662,14 +667,14 @@ namespace ServiceLib.Handler.CoreConfig
outbound.down_mbps = _config.hysteriaItem.down_mbps > 0 ? _config.hysteriaItem.down_mbps : null;
break;
}
case EConfigType.Tuic:
case EConfigType.TUIC:
{
outbound.uuid = node.id;
outbound.password = node.security;
outbound.congestion_control = node.headerType;
break;
}
case EConfigType.Wireguard:
case EConfigType.WireGuard:
{
outbound.private_key = node.id;
outbound.peer_public_key = node.publicKey;
@@ -860,7 +865,7 @@ namespace ServiceLib.Handler.CoreConfig
var txtOutbound = Utils.GetEmbedText(Global.SingboxSampleOutbound);
//Previous proxy
var prevNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.prevProfile!);
var prevNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.prevProfile);
if (prevNode is not null
&& prevNode.configType != EConfigType.Custom)
{
@@ -873,7 +878,7 @@ namespace ServiceLib.Handler.CoreConfig
}
//Next proxy
var nextNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.nextProfile!);
var nextNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.nextProfile);
if (nextNode is not null
&& nextNode.configType != EConfigType.Custom)
{
@@ -951,7 +956,7 @@ namespace ServiceLib.Handler.CoreConfig
if (routing != null)
{
var rules = JsonUtils.Deserialize<List<RulesItem>>(routing.ruleSet);
foreach (var item in rules!)
foreach (var item in rules ?? [])
{
if (item.enabled)
{
@@ -966,7 +971,7 @@ namespace ServiceLib.Handler.CoreConfig
if (lockedItem != null)
{
var rules = JsonUtils.Deserialize<List<RulesItem>>(lockedItem.ruleSet);
foreach (var item in rules!)
foreach (var item in rules ?? [])
{
GenRoutingUserRule(item, singboxConfig.route.rules);
}
@@ -1235,7 +1240,7 @@ namespace ServiceLib.Handler.CoreConfig
}
//Tun2SocksAddress
if (_config.tunModeItem.enableTun && node?.configType == EConfigType.Socks && Utils.IsDomain(node?.sni))
if (_config.tunModeItem.enableTun && node?.configType == EConfigType.SOCKS && Utils.IsDomain(node?.sni))
{
dns4Sbox.rules.Insert(0, new()
{

View File

@@ -110,7 +110,7 @@ namespace ServiceLib.Handler.CoreConfig
{
continue;
}
if (it.configType is EConfigType.Hysteria2 or EConfigType.Tuic or EConfigType.Wireguard)
if (it.configType is EConfigType.Hysteria2 or EConfigType.TUIC or EConfigType.WireGuard)
{
continue;
}
@@ -248,10 +248,10 @@ namespace ServiceLib.Handler.CoreConfig
{
continue;
}
var item = LazyConfig.Instance.GetProfileItem(it.indexId);
if (it.configType is EConfigType.VMess or EConfigType.VLESS)
{
var item2 = LazyConfig.Instance.GetProfileItem(it.indexId);
if (item2 is null || Utils.IsNullOrEmpty(item2.id) || !Utils.IsGuidByParse(item2.id))
if (item is null || Utils.IsNullOrEmpty(item.id) || !Utils.IsGuidByParse(item.id))
{
continue;
}
@@ -294,7 +294,6 @@ namespace ServiceLib.Handler.CoreConfig
v2rayConfig.inbounds.Add(inbound);
//outbound
var item = LazyConfig.Instance.GetProfileItem(it.indexId);
if (item is null)
{
continue;
@@ -309,6 +308,12 @@ namespace ServiceLib.Handler.CoreConfig
{
continue;
}
if ((it.configType is EConfigType.VLESS or EConfigType.Trojan)
&& item.streamSecurity == Global.StreamSecurityReality
&& item.publicKey.IsNullOrEmpty())
{
continue;
}
var outbound = JsonUtils.Deserialize<Outbounds4Ray>(txtOutbound);
GenOutbound(item, outbound);
@@ -642,8 +647,8 @@ namespace ServiceLib.Handler.CoreConfig
outbound.settings.vnext = null;
break;
}
case EConfigType.Socks:
case EConfigType.Http:
case EConfigType.SOCKS:
case EConfigType.HTTP:
{
ServersItem4Ray serversItem;
if (outbound.settings.servers.Count <= 0)
@@ -1199,12 +1204,12 @@ namespace ServiceLib.Handler.CoreConfig
var txtOutbound = Utils.GetEmbedText(Global.V2raySampleOutbound);
//Previous proxy
var prevNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.prevProfile!);
var prevNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.prevProfile);
if (prevNode is not null
&& prevNode.configType != EConfigType.Custom
&& prevNode.configType != EConfigType.Hysteria2
&& prevNode.configType != EConfigType.Tuic
&& prevNode.configType != EConfigType.Wireguard)
&& prevNode.configType != EConfigType.TUIC
&& prevNode.configType != EConfigType.WireGuard)
{
var prevOutbound = JsonUtils.Deserialize<Outbounds4Ray>(txtOutbound);
GenOutbound(prevNode, prevOutbound);
@@ -1218,12 +1223,12 @@ namespace ServiceLib.Handler.CoreConfig
}
//Next proxy
var nextNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.nextProfile!);
var nextNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.nextProfile);
if (nextNode is not null
&& nextNode.configType != EConfigType.Custom
&& nextNode.configType != EConfigType.Hysteria2
&& nextNode.configType != EConfigType.Tuic
&& nextNode.configType != EConfigType.Wireguard)
&& nextNode.configType != EConfigType.TUIC
&& nextNode.configType != EConfigType.WireGuard)
{
var nextOutbound = JsonUtils.Deserialize<Outbounds4Ray>(txtOutbound);
GenOutbound(nextNode, nextOutbound);

View File

@@ -66,7 +66,7 @@ namespace ServiceLib.Handler
public int LoadCoreConfigSpeedtest(List<ServerTestItem> selecteds)
{
int pid = -1;
var coreType = selecteds.Exists(t => t.configType == EConfigType.Hysteria2 || t.configType == EConfigType.Tuic || t.configType == EConfigType.Wireguard) ? ECoreType.sing_box : ECoreType.Xray;
var coreType = selecteds.Exists(t => t.configType == EConfigType.Hysteria2 || t.configType == EConfigType.TUIC || t.configType == EConfigType.WireGuard) ? ECoreType.sing_box : ECoreType.Xray;
string configPath = Utils.GetConfigPath(Global.CoreSpeedtestConfigFileName);
if (CoreConfigHandler.GenerateClientSpeedtestConfig(_config, configPath, selecteds, coreType, out string msg) != 0)
{
@@ -204,7 +204,7 @@ namespace ServiceLib.Handler
itemSocks = new ProfileItem()
{
coreType = preCoreType,
configType = EConfigType.Socks,
configType = EConfigType.SOCKS,
address = Global.Loopback,
sni = node.address, //Tun2SocksAddress
port = LazyConfig.Instance.GetLocalPort(EInboundProtocol.socks)
@@ -216,7 +216,7 @@ namespace ServiceLib.Handler
itemSocks = new ProfileItem()
{
coreType = preCoreType,
configType = EConfigType.Socks,
configType = EConfigType.SOCKS,
address = Global.Loopback,
port = node.preSocksPort.Value,
};

View File

@@ -10,12 +10,12 @@
{
EConfigType.VMess => VmessFmt.ToUri(item),
EConfigType.Shadowsocks => ShadowsocksFmt.ToUri(item),
EConfigType.Socks => SocksFmt.ToUri(item),
EConfigType.SOCKS => SocksFmt.ToUri(item),
EConfigType.Trojan => TrojanFmt.ToUri(item),
EConfigType.VLESS => VLESSFmt.ToUri(item),
EConfigType.Hysteria2 => Hysteria2Fmt.ToUri(item),
EConfigType.Tuic => TuicFmt.ToUri(item),
EConfigType.Wireguard => WireguardFmt.ToUri(item),
EConfigType.TUIC => TuicFmt.ToUri(item),
EConfigType.WireGuard => WireguardFmt.ToUri(item),
_ => null,
};
@@ -49,7 +49,7 @@
{
return ShadowsocksFmt.Resolve(str, out msg);
}
else if (str.StartsWith(Global.ProtocolShares[EConfigType.Socks]))
else if (str.StartsWith(Global.ProtocolShares[EConfigType.SOCKS]))
{
return SocksFmt.Resolve(str, out msg);
}
@@ -65,11 +65,11 @@
{
return Hysteria2Fmt.Resolve(str, out msg);
}
else if (str.StartsWith(Global.ProtocolShares[EConfigType.Tuic]))
else if (str.StartsWith(Global.ProtocolShares[EConfigType.TUIC]))
{
return TuicFmt.Resolve(str, out msg);
}
else if (str.StartsWith(Global.ProtocolShares[EConfigType.Wireguard]))
else if (str.StartsWith(Global.ProtocolShares[EConfigType.WireGuard]))
{
return WireguardFmt.Resolve(str, out msg);
}

View File

@@ -17,7 +17,7 @@
return null;
}
item.configType = EConfigType.Socks;
item.configType = EConfigType.SOCKS;
return item;
}
@@ -41,7 +41,7 @@
//new
var pw = Utils.Base64Encode($"{item.security}:{item.id}");
url = $"{pw}@{GetIpv6(item.address)}:{item.port}";
url = $"{Global.ProtocolShares[EConfigType.Socks]}{url}{remark}";
url = $"{Global.ProtocolShares[EConfigType.SOCKS]}{url}{remark}";
return url;
}
@@ -49,9 +49,9 @@
{
ProfileItem item = new()
{
configType = EConfigType.Socks
configType = EConfigType.SOCKS
};
result = result[Global.ProtocolShares[EConfigType.Socks].Length..];
result = result[Global.ProtocolShares[EConfigType.SOCKS].Length..];
//remark
int indexRemark = result.IndexOf("#");
if (indexRemark > 0)

View File

@@ -8,7 +8,7 @@
ProfileItem item = new()
{
configType = EConfigType.Tuic
configType = EConfigType.TUIC
};
Uri url = new(str);
@@ -57,7 +57,7 @@
$"{item.id}:{item.security}",
GetIpv6(item.address),
item.port);
url = $"{Global.ProtocolShares[EConfigType.Tuic]}{url}{query}{remark}";
url = $"{Global.ProtocolShares[EConfigType.TUIC]}{url}{query}{remark}";
return url;
}
}

View File

@@ -8,7 +8,7 @@
ProfileItem item = new()
{
configType = EConfigType.Wireguard
configType = EConfigType.WireGuard
};
Uri url = new(str);
@@ -62,7 +62,7 @@
Utils.UrlEncode(item.id),
GetIpv6(item.address),
item.port);
url = $"{Global.ProtocolShares[EConfigType.Wireguard]}{url}/{query}{remark}";
url = $"{Global.ProtocolShares[EConfigType.WireGuard]}{url}/{query}{remark}";
return url;
}
}

View File

@@ -38,6 +38,14 @@
SQLiteHelper.Instance.CreateTable<RoutingItem>();
SQLiteHelper.Instance.CreateTable<ProfileExItem>();
SQLiteHelper.Instance.CreateTable<DNSItem>();
//TODO
//Prepare to remove the clash
SQLiteHelper.Instance.Execute($"update ProfileItem set coreType = 13 where coreType = 11");
SQLiteHelper.Instance.Execute($"update ProfileItem set coreType = 13 where coreType = 12");
//Prepare to remove the SagerNet
SQLiteHelper.Instance.Execute($"update ProfileItem set coreType = 2 where coreType = 3");
}
#region Config
@@ -168,7 +176,7 @@
return SQLiteHelper.Instance.Table<ProfileItem>().FirstOrDefault(it => it.indexId == indexId);
}
public ProfileItem? GetProfileItemViaRemarks(string remarks)
public ProfileItem? GetProfileItemViaRemarks(string? remarks)
{
if (Utils.IsNullOrEmpty(remarks))
{

View File

@@ -12,7 +12,7 @@
public void RegUpdateTask(Config config, Action<bool, string> update)
{
Task.Run(() => UpdateTaskRunSubscription(config, update));
Task.Run(() => UpdateTaskRunGeo(config, update));
//Task.Run(() => UpdateTaskRunGeo(config, update));
}
private async Task UpdateTaskRunSubscription(Config config, Action<bool, string> update)

View File

@@ -191,7 +191,7 @@ namespace ServiceLib.Handler
//more url
if (Utils.IsNullOrEmpty(item.convertTarget) && Utils.IsNotEmpty(item.moreUrl.TrimEx()))
{
if (Utils.IsNotEmpty(result) && Utils.IsBase64String(result!))
if (Utils.IsNotEmpty(result) && Utils.IsBase64String(result))
{
result = Utils.Base64Decode(result);
}
@@ -212,7 +212,7 @@ namespace ServiceLib.Handler
}
if (Utils.IsNotEmpty(result2))
{
if (Utils.IsBase64String(result2!))
if (Utils.IsBase64String(result2))
{
result += Utils.Base64Decode(result2);
}
@@ -276,7 +276,7 @@ namespace ServiceLib.Handler
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(type);
var url = coreInfo?.coreReleaseApiUrl;
var result = await downloadHandle.DownloadStringAsync(url, true, Global.AppName);
var result = await downloadHandle.TryDownloadString(url, true, Global.AppName);
if (Utils.IsNotEmpty(result))
{
return await ParseDownloadUrl(type, result, preRelease);
@@ -368,7 +368,7 @@ namespace ServiceLib.Handler
{
var gitHubReleases = JsonUtils.Deserialize<List<GitHubRelease>>(gitHubReleaseApi);
var gitHubRelease = preRelease ? gitHubReleases?.First() : gitHubReleases?.First(r => r.Prerelease == false);
var version = new SemanticVersion(gitHubRelease?.TagName!);
var version = new SemanticVersion(gitHubRelease?.TagName);
var body = gitHubRelease?.Body;
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(type);

View File

@@ -94,7 +94,7 @@
public bool ignoreGeoUpdateCore { get; set; } = true;
public int autoUpdateInterval { get; set; } = 10;
public int autoUpdateInterval { get; set; }
public bool checkPreReleaseUpdate { get; set; } = false;

View File

@@ -655,7 +655,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Add [Http] server 的本地化字符串。
/// 查找类似 Add [HTTP] server 的本地化字符串。
/// </summary>
public static string menuAddHttpServer {
get {
@@ -700,7 +700,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Add [Socks] server 的本地化字符串。
/// 查找类似 Add [SOCKS] server 的本地化字符串。
/// </summary>
public static string menuAddSocksServer {
get {
@@ -718,7 +718,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Add [Tuic] server 的本地化字符串。
/// 查找类似 Add [TUIC] server 的本地化字符串。
/// </summary>
public static string menuAddTuicServer {
get {
@@ -745,7 +745,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 Add [Wireguard] server 的本地化字符串。
/// 查找类似 Add [WireGuard] server 的本地化字符串。
/// </summary>
public static string menuAddWireguardServer {
get {

View File

@@ -536,7 +536,7 @@
<value>Add [Shadowsocks] server</value>
</data>
<data name="menuAddSocksServer" xml:space="preserve">
<value>Add [Socks] server</value>
<value>Add [SOCKS] server</value>
</data>
<data name="menuAddTrojanServer" xml:space="preserve">
<value>Add [Trojan] server</value>
@@ -1094,7 +1094,7 @@
<value>Use System Hosts</value>
</data>
<data name="menuAddTuicServer" xml:space="preserve">
<value>Add [Tuic] server</value>
<value>Add [TUIC] server</value>
</data>
<data name="TbHeaderType8" xml:space="preserve">
<value>Congestion control</value>
@@ -1115,7 +1115,7 @@
<value>Enable IPv6 Address</value>
</data>
<data name="menuAddWireguardServer" xml:space="preserve">
<value>Add [Wireguard] server</value>
<value>Add [WireGuard] server</value>
</data>
<data name="TbPrivateKey" xml:space="preserve">
<value>PrivateKey</value>
@@ -1148,7 +1148,7 @@
<value>*grpc Authority</value>
</data>
<data name="menuAddHttpServer" xml:space="preserve">
<value>Add [Http] server</value>
<value>Add [HTTP] server</value>
</data>
<data name="TbSettingsEnableFragmentTips" xml:space="preserve">
<value>Use Xray and enable non-Tun mode, which conflicts with the group previous proxy</value>

View File

@@ -536,7 +536,7 @@
<value>Добавить сервер [Shadowsocks]</value>
</data>
<data name="menuAddSocksServer" xml:space="preserve">
<value>Добавить сервер [Socks]</value>
<value>Добавить сервер [SOCKS]</value>
</data>
<data name="menuAddTrojanServer" xml:space="preserve">
<value>Добавить сервер [Trojan]</value>

View File

@@ -536,7 +536,7 @@
<value>添加[Shadowsocks]服务器</value>
</data>
<data name="menuAddSocksServer" xml:space="preserve">
<value>添加[Socks]服务器</value>
<value>添加[SOCKS]服务器</value>
</data>
<data name="menuAddTrojanServer" xml:space="preserve">
<value>添加[Trojan]服务器</value>
@@ -1091,7 +1091,7 @@
<value>使用系统hosts</value>
</data>
<data name="menuAddTuicServer" xml:space="preserve">
<value>添加[Tuic]服务器</value>
<value>添加[TUIC]服务器</value>
</data>
<data name="TbHeaderType8" xml:space="preserve">
<value>拥塞控制算法</value>
@@ -1112,7 +1112,7 @@
<value>启用IPv6</value>
</data>
<data name="menuAddWireguardServer" xml:space="preserve">
<value>添加[Wireguard]服务器</value>
<value>添加[WireGuard]服务器</value>
</data>
<data name="TbPrivateKey" xml:space="preserve">
<value>PrivateKey</value>
@@ -1145,7 +1145,7 @@
<value>*grpc Authority</value>
</data>
<data name="menuAddHttpServer" xml:space="preserve">
<value>添加[Http]服务器</value>
<value>添加[HTTP]服务器</value>
</data>
<data name="TbSettingsEnableFragment" xml:space="preserve">
<value>启用分片Fragment</value>

View File

@@ -535,7 +535,7 @@
<value>新增[Shadowsocks]伺服器</value>
</data>
<data name="menuAddSocksServer" xml:space="preserve">
<value>新增[Socks]伺服器</value>
<value>新增[SOCKS]伺服器</value>
</data>
<data name="menuAddTrojanServer" xml:space="preserve">
<value>新增[Trojan]伺服器</value>
@@ -1082,7 +1082,7 @@
<value>IP 或 IP CIDR</value>
</data>
<data name="menuAddTuicServer" xml:space="preserve">
<value>新增[Tuic]伺服器</value>
<value>新增[TUIC]伺服器</value>
</data>
<data name="LvPrevProfile" xml:space="preserve">
<value>前置代理別名</value>
@@ -1118,7 +1118,7 @@
<value>*grpc Authority</value>
</data>
<data name="menuAddHttpServer" xml:space="preserve">
<value>新增[Http]伺服器</value>
<value>新增[HTTP]伺服器</value>
</data>
<data name="TbSettingsEnableFragment" xml:space="preserve">
<value>啟用分片Fragment</value>

View File

@@ -4,15 +4,15 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>6.59.0</Version>
<Version>6.60.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Downloader" Version="3.1.2" />
<PackageReference Include="ReactiveUI" Version="20.1.1" />
<PackageReference Include="Downloader" Version="3.2.0" />
<PackageReference Include="ReactiveUI" Version="20.1.63" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
<PackageReference Include="Splat.NLog" Version="15.1.1" />
<PackageReference Include="Splat.NLog" Version="15.2.22" />
<PackageReference Include="WebDav.Client" Version="2.8.0" />
<PackageReference Include="YamlDotNet" Version="16.1.2" />
<PackageReference Include="QRCoder" Version="1.6.0" />

View File

@@ -21,7 +21,7 @@ namespace ServiceLib.ViewModels
_noticeHandler = Locator.Current.GetService<NoticeHandler>();
_updateView = updateView;
if (profileItem.id.IsNullOrEmpty())
if (profileItem.indexId.IsNullOrEmpty())
{
profileItem.network = Global.DefaultNetwork;
profileItem.headerType = Global.None;
@@ -74,8 +74,8 @@ namespace ServiceLib.ViewModels
return;
}
}
if (SelectedSource.configType != EConfigType.Socks
&& SelectedSource.configType != EConfigType.Http)
if (SelectedSource.configType != EConfigType.SOCKS
&& SelectedSource.configType != EConfigType.HTTP)
{
if (Utils.IsNullOrEmpty(SelectedSource.id))
{

View File

@@ -14,6 +14,7 @@ namespace ServiceLib.ViewModels
#region private prop
private CoreHandler _coreHandler;
private bool _isAdministrator { get; set; }
#endregion private prop
@@ -139,17 +140,16 @@ namespace ServiceLib.ViewModels
[Reactive]
public int TabMainSelectedIndex { get; set; }
public bool IsAdministrator { get; set; }
#endregion UI
#region Init
public MainWindowViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
public MainWindowViewModel(bool isAdministrator, Func<EViewAction, object?, Task<bool>>? updateView)
{
_config = LazyConfig.Instance.Config;
_noticeHandler = Locator.Current.GetService<NoticeHandler>();
_updateView = updateView;
_isAdministrator = isAdministrator;
MessageBus.Current.Listen<string>(Global.CommandRefreshProfiles).Subscribe(async x => await _updateView?.Invoke(EViewAction.DispatcherRefreshServersBiz, null));
@@ -158,6 +158,16 @@ namespace ServiceLib.ViewModels
Init();
_config.uiItem.showInTaskbar = true;
if (_config.tunModeItem.enableTun && _isAdministrator)
{
EnableTun = true;
}
else
{
_config.tunModeItem.enableTun = EnableTun = false;
}
#region WhenAnyValue && ReactiveCommand
this.WhenAnyValue(
@@ -196,11 +206,11 @@ namespace ServiceLib.ViewModels
});
AddSocksServerCmd = ReactiveCommand.Create(() =>
{
AddServerAsync(true, EConfigType.Socks);
AddServerAsync(true, EConfigType.SOCKS);
});
AddHttpServerCmd = ReactiveCommand.Create(() =>
{
AddServerAsync(true, EConfigType.Http);
AddServerAsync(true, EConfigType.HTTP);
});
AddTrojanServerCmd = ReactiveCommand.Create(() =>
{
@@ -212,11 +222,11 @@ namespace ServiceLib.ViewModels
});
AddTuicServerCmd = ReactiveCommand.Create(() =>
{
AddServerAsync(true, EConfigType.Tuic);
AddServerAsync(true, EConfigType.TUIC);
});
AddWireguardServerCmd = ReactiveCommand.Create(() =>
{
AddServerAsync(true, EConfigType.Wireguard);
AddServerAsync(true, EConfigType.WireGuard);
});
AddCustomServerCmd = ReactiveCommand.Create(() =>
{
@@ -319,8 +329,6 @@ namespace ServiceLib.ViewModels
#endregion WhenAnyValue && ReactiveCommand
AutoHideStartup();
_config.uiItem.showInTaskbar = true;
}
private void Init()
@@ -767,7 +775,8 @@ namespace ServiceLib.ViewModels
private async Task ChangeSystemProxyStatusAsync(ESysProxyType type, bool blChange)
{
await _updateView?.Invoke(EViewAction.UpdateSysProxy, _config.tunModeItem.enableTun ? true : false);
//await _updateView?.Invoke(EViewAction.UpdateSysProxy, _config.tunModeItem.enableTun ? true : false);
await _updateView?.Invoke(EViewAction.UpdateSysProxy, false);
_noticeHandler?.SendMessageEx($"{ResUI.TipChangeSystemProxy} - {_config.systemProxyItem.sysProxyType.ToString()}");
BlSystemProxyClear = (type == ESysProxyType.ForcedClear);
@@ -853,12 +862,13 @@ namespace ServiceLib.ViewModels
{
_config.tunModeItem.enableTun = EnableTun;
// When running as a non-administrator, reboot to administrator mode
if (EnableTun && !IsAdministrator)
if (EnableTun && !_isAdministrator)
{
_config.tunModeItem.enableTun = false;
RebootAsAdmin();
return;
}
ConfigHandler.SaveConfig(_config);
Reload();
}
}

View File

@@ -85,8 +85,8 @@ namespace v2rayN.Desktop.Views
});
break;
case EConfigType.Socks:
case EConfigType.Http:
case EConfigType.SOCKS:
case EConfigType.HTTP:
gridSocks.IsVisible = true;
break;
@@ -121,7 +121,7 @@ namespace v2rayN.Desktop.Views
cmbFingerprint.SelectedValue = string.Empty;
break;
case EConfigType.Tuic:
case EConfigType.TUIC:
gridTuic.IsVisible = true;
sepa2.IsVisible = false;
gridTransport.IsVisible = false;
@@ -135,7 +135,7 @@ namespace v2rayN.Desktop.Views
});
break;
case EConfigType.Wireguard:
case EConfigType.WireGuard:
gridWireguard.IsVisible = true;
sepa2.IsVisible = false;
@@ -168,8 +168,8 @@ namespace v2rayN.Desktop.Views
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.cmbSecurity3.SelectedValue).DisposeWith(disposables);
break;
case EConfigType.Socks:
case EConfigType.Http:
case EConfigType.SOCKS:
case EConfigType.HTTP:
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId4.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.txtSecurity4.Text).DisposeWith(disposables);
break;
@@ -190,13 +190,13 @@ namespace v2rayN.Desktop.Views
this.Bind(ViewModel, vm => vm.SelectedSource.path, v => v.txtPath7.Text).DisposeWith(disposables);
break;
case EConfigType.Tuic:
case EConfigType.TUIC:
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId8.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.txtSecurity8.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.headerType, v => v.cmbHeaderType8.SelectedValue).DisposeWith(disposables);
break;
case EConfigType.Wireguard:
case EConfigType.WireGuard:
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId9.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.publicKey, v => v.txtPublicKey9.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.path, v => v.txtPath9.Text).DisposeWith(disposables);

View File

@@ -95,7 +95,7 @@
BorderThickness="1"
Classes="TextArea Margin8"
TextWrapping="Wrap"
Watermark="Http/Socks" />
Watermark="HTTP/SOCKS" />
</DockPanel>
</TabItem>
@@ -153,7 +153,7 @@
BorderThickness="1"
Classes="TextArea Margin8"
TextWrapping="Wrap"
Watermark="Http/Socks" />
Watermark="HTTP/SOCKS" />
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" />

View File

@@ -34,8 +34,9 @@ namespace v2rayN.Desktop.Views
menuPromotion.Click += menuPromotion_Click;
menuClose.Click += menuClose_Click;
var IsAdministrator = true;//WindowsUtils.IsAdministrator();
MessageBus.Current.Listen<string>(Global.CommandSendSnackMsg).Subscribe(x => DelegateSnackMsg(x));
ViewModel = new MainWindowViewModel(UpdateViewHandler);
ViewModel = new MainWindowViewModel(IsAdministrator, UpdateViewHandler);
Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(MainWindowViewModel));
//WindowsHandler.Instance.RegisterGlobalHotkey(_config, OnHotkeyHandler, null);
@@ -114,24 +115,10 @@ namespace v2rayN.Desktop.Views
if (Utils.IsWindows())
{
var IsAdministrator = false;//WindowsUtils.IsAdministrator();
ViewModel.IsAdministrator = IsAdministrator;
this.Title = $"{Utils.GetVersion()} - {(IsAdministrator ? ResUI.RunAsAdmin : ResUI.NotRunAsAdmin)}";
if (_config.tunModeItem.enableTun)
{
if (IsAdministrator)
{
ViewModel.EnableTun = true;
}
else
{
_config.tunModeItem.enableTun = ViewModel.EnableTun = false;
}
}
}
else
{
ViewModel.IsAdministrator = true;
this.Title = $"{Utils.GetVersion()}";
menuRebootAsAdmin.IsVisible = false;
menuSettingsSetUWP.IsVisible = false;

View File

@@ -150,7 +150,6 @@
Grid.Row="6"
Grid.Column="1"
Width="200"
VerticalAlignment=" "
Classes="Margin8"
ToolTip.Tip="{x:Static resx:ResUI.LvConvertTargetTip}" />

View File

@@ -27,7 +27,7 @@
<PackageReference Include="MessageBox.Avalonia" Version="3.1.6" />
<PackageReference Include="Semi.Avalonia" Version="11.1.0.4" />
<PackageReference Include="Semi.Avalonia.DataGrid" Version="11.1.0.4" />
<PackageReference Include="ReactiveUI" Version="20.1.1" />
<PackageReference Include="ReactiveUI" Version="20.1.63" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
</ItemGroup>

View File

@@ -1,9 +1,9 @@
<Application
x:Class="v2rayN.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:conv="clr-namespace:v2rayN.Converters"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
ShutdownMode="OnExplicitShutdown"
StartupUri="Views/MainWindow.xaml">
<Application.Resources>
@@ -181,6 +181,23 @@
TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="{DynamicResource StdFontSize-1}" />
</Style>
<Style
x:Key="WindowGlobal"
BasedOn="{StaticResource {x:Type Window}}"
TargetType="{x:Type Window}">
<Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
<Setter Property="TextOptions.TextHintingMode" Value="Fixed" />
</Style>
<Style
x:Key="ViewGlobal"
BasedOn="{StaticResource {x:Type UserControl}}"
TargetType="{x:Type UserControl}">
<Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
<Setter Property="TextOptions.TextHintingMode" Value="Fixed" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@@ -17,10 +17,9 @@
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
ResizeMode="NoResize"
ShowInTaskbar="False"
Style="{StaticResource WindowGlobal}"
TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="Auto"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<DockPanel Margin="8">

View File

@@ -17,6 +17,9 @@ namespace v2rayN.Views
foreach (ECoreType it in Enum.GetValues(typeof(ECoreType)))
{
if (it == ECoreType.v2rayN)
continue;
//TODO
if (it is ECoreType.clash or ECoreType.clash_meta or ECoreType.SagerNet)
continue;
cmbCoreType.Items.Add(it.ToString());
}

View File

@@ -17,10 +17,9 @@
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
ResizeMode="CanResize"
ShowInTaskbar="False"
Style="{StaticResource WindowGlobal}"
TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="Auto"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<DockPanel Margin="8">

View File

@@ -79,8 +79,8 @@ namespace v2rayN.Views
});
break;
case EConfigType.Socks:
case EConfigType.Http:
case EConfigType.SOCKS:
case EConfigType.HTTP:
gridSocks.Visibility = Visibility.Visible;
break;
@@ -115,7 +115,7 @@ namespace v2rayN.Views
cmbFingerprint.Text = string.Empty;
break;
case EConfigType.Tuic:
case EConfigType.TUIC:
gridTuic.Visibility = Visibility.Visible;
sepa2.Visibility = Visibility.Collapsed;
gridTransport.Visibility = Visibility.Collapsed;
@@ -129,7 +129,7 @@ namespace v2rayN.Views
});
break;
case EConfigType.Wireguard:
case EConfigType.WireGuard:
gridWireguard.Visibility = Visibility.Visible;
sepa2.Visibility = Visibility.Collapsed;
@@ -162,8 +162,8 @@ namespace v2rayN.Views
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.cmbSecurity3.Text).DisposeWith(disposables);
break;
case EConfigType.Socks:
case EConfigType.Http:
case EConfigType.SOCKS:
case EConfigType.HTTP:
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId4.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.txtSecurity4.Text).DisposeWith(disposables);
break;
@@ -184,13 +184,13 @@ namespace v2rayN.Views
this.Bind(ViewModel, vm => vm.SelectedSource.path, v => v.txtPath7.Text).DisposeWith(disposables);
break;
case EConfigType.Tuic:
case EConfigType.TUIC:
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId8.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.txtSecurity8.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.headerType, v => v.cmbHeaderType8.Text).DisposeWith(disposables);
break;
case EConfigType.Wireguard:
case EConfigType.WireGuard:
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId9.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.publicKey, v => v.txtPublicKey9.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.path, v => v.txtPath9.Text).DisposeWith(disposables);

View File

@@ -12,6 +12,7 @@
d:DesignHeight="600"
d:DesignWidth="800"
x:TypeArguments="vms:BackupAndRestoreViewModel"
Style="{StaticResource ViewGlobal}"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>

View File

@@ -26,7 +26,7 @@ namespace v2rayN.Views
this.Bind(ViewModel, vm => vm.SelectedSource.userName, v => v.txtWebDavUserName.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.password, v => v.txtWebDavPassword.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.dirName, v => v.txtWebDavDirName.Text).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.WebDavCheckCmd, v => v.menuWebDavCheck).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.RemoteBackupCmd, v => v.menuRemoteBackup).DisposeWith(disposables);

View File

@@ -12,6 +12,7 @@
d:DesignHeight="450"
d:DesignWidth="800"
x:TypeArguments="vms:CheckUpdateViewModel"
Style="{StaticResource ViewGlobal}"
mc:Ignorable="d">
<DockPanel Margin="16">

View File

@@ -1,11 +1,11 @@
<reactiveui:ReactiveUserControl
x:Class="v2rayN.Views.ClashConnectionsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveui="http://reactiveui.net"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
d:DesignHeight="450"

View File

@@ -1,18 +1,19 @@
<reactiveui:ReactiveUserControl
x:Class="v2rayN.Views.ClashProxiesView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:reactiveui="http://reactiveui.net"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:v2rayN.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveui="http://reactiveui.net"
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
xmlns:converters="clr-namespace:v2rayN.Converters"
d:DesignHeight="450"
d:DesignWidth="800"
x:TypeArguments="vms:ClashProxiesViewModel"
KeyDown="ProxiesView_KeyDown"
Style="{StaticResource ViewGlobal}"
mc:Ignorable="d">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVisConverter" />

View File

@@ -17,10 +17,9 @@
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
ResizeMode="NoResize"
ShowInTaskbar="False"
Style="{StaticResource WindowGlobal}"
TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="Auto"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<DockPanel Margin="8">
@@ -117,7 +116,7 @@
x:Name="txtnormalDNS"
Margin="{StaticResource SettingItemMargin}"
VerticalAlignment="Stretch"
materialDesign:HintAssist.Hint="Http/Socks"
materialDesign:HintAssist.Hint="HTTP/SOCKS"
AcceptsReturn="True"
BorderThickness="1"
Style="{StaticResource MaterialDesignOutlinedTextBox}"
@@ -186,7 +185,7 @@
x:Name="txtnormalDNS2"
Grid.Column="0"
VerticalAlignment="Stretch"
materialDesign:HintAssist.Hint="Http/Socks"
materialDesign:HintAssist.Hint="HTTP/SOCKS"
AcceptsReturn="True"
BorderThickness="1"
Style="{StaticResource MaterialDesignOutlinedTextBox}"

View File

@@ -18,10 +18,9 @@
KeyDown="GlobalHotkeySettingWindow_KeyDown"
ResizeMode="NoResize"
ShowInTaskbar="False"
Style="{StaticResource WindowGlobal}"
TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="Auto"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<DockPanel Margin="8">

View File

@@ -18,10 +18,9 @@
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
ShowInTaskbar="True"
Style="{StaticResource WindowGlobal}"
TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="Auto"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Window.Resources>

View File

@@ -36,8 +36,9 @@ namespace v2rayN.Views
menuCheckUpdate.Click += MenuCheckUpdate_Click;
menuBackupAndRestore.Click += MenuBackupAndRestore_Click;
var IsAdministrator = WindowsUtils.IsAdministrator();
MessageBus.Current.Listen<string>(Global.CommandSendSnackMsg).Subscribe(x => DelegateSnackMsg(x));
ViewModel = new MainWindowViewModel(UpdateViewHandler);
ViewModel = new MainWindowViewModel(IsAdministrator, UpdateViewHandler);
Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(MainWindowViewModel));
WindowsHandler.Instance.RegisterGlobalHotkey(_config, OnHotkeyHandler, null);
@@ -143,20 +144,7 @@ namespace v2rayN.Views
}
});
var IsAdministrator = WindowsUtils.IsAdministrator();
ViewModel.IsAdministrator = IsAdministrator;
this.Title = $"{Utils.GetVersion()} - {(IsAdministrator ? ResUI.RunAsAdmin : ResUI.NotRunAsAdmin)}";
if (_config.tunModeItem.enableTun)
{
if (IsAdministrator)
{
ViewModel.EnableTun = true;
}
else
{
_config.tunModeItem.enableTun = ViewModel.EnableTun = false;
}
}
if (!_config.guiItem.enableHWA)
{
@@ -505,7 +493,8 @@ namespace v2rayN.Views
{
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
foreach (var it in coreInfo
.Where(t => t.coreType != ECoreType.v2fly
.Where(t => t.coreType != ECoreType.v2fly
&& t.coreType != ECoreType.SagerNet
&& t.coreType != ECoreType.clash
&& t.coreType != ECoreType.clash_meta
&& t.coreType != ECoreType.hysteria))

View File

@@ -11,6 +11,7 @@
d:DesignHeight="450"
d:DesignWidth="800"
x:TypeArguments="vms:MsgViewModel"
Style="{StaticResource ViewGlobal}"
mc:Ignorable="d">
<DockPanel Margin="2">
<WrapPanel

View File

@@ -17,10 +17,9 @@
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
ResizeMode="NoResize"
ShowInTaskbar="False"
Style="{StaticResource WindowGlobal}"
TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="Auto"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<DockPanel Margin="8">

View File

@@ -13,6 +13,7 @@
d:DesignHeight="450"
d:DesignWidth="800"
x:TypeArguments="vms:ProfilesViewModel"
Style="{StaticResource ViewGlobal}"
mc:Ignorable="d">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVisConverter" />

View File

@@ -338,24 +338,16 @@ namespace v2rayN.Views
item2.Width = item.Width;
item2.DisplayIndex = displayIndex++;
}
if (item.Name.StartsWith("to"))
{
if (!_config.guiItem.enableStatistics)
{
item2.Visibility = Visibility.Hidden;
}
}
}
}
}
if (!_config.guiItem.enableStatistics)
{
colTodayUp.Visibility =
colTodayDown.Visibility =
colTotalUp.Visibility =
colTotalDown.Visibility = Visibility.Hidden;
}
else
{
colTodayUp.Visibility =
colTodayDown.Visibility =
colTotalUp.Visibility =
colTotalDown.Visibility = Visibility.Visible;
}
}
private void StorageUI()

View File

@@ -8,6 +8,7 @@
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
d:DesignHeight="300"
d:DesignWidth="300"
Style="{StaticResource ViewGlobal}"
mc:Ignorable="d">
<Grid Margin="30">
<Grid.RowDefinitions>

View File

@@ -1,14 +1,14 @@
<reactiveui:ReactiveWindow
x:Class="v2rayN.Views.RoutingRuleDetailsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:reactiveui="http://reactiveui.net"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:conv="clr-namespace:v2rayN.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveui="http://reactiveui.net"
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
xmlns:conv="clr-namespace:v2rayN.Converters"
Title="{x:Static resx:ResUI.menuRoutingRuleDetailsSetting}"
Width="900"
Height="700"
@@ -17,10 +17,9 @@
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
ResizeMode="NoResize"
ShowInTaskbar="False"
Style="{StaticResource WindowGlobal}"
TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="Auto"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<DockPanel>

View File

@@ -1,14 +1,14 @@
<reactiveui:ReactiveWindow
x:Class="v2rayN.Views.RoutingRuleSettingWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:reactiveui="http://reactiveui.net"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:conv="clr-namespace:v2rayN.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveui="http://reactiveui.net"
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
xmlns:conv="clr-namespace:v2rayN.Converters"
Title="{x:Static resx:ResUI.menuRoutingRuleSetting}"
Width="960"
Height="700"
@@ -17,10 +17,9 @@
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
ResizeMode="NoResize"
ShowInTaskbar="False"
Style="{StaticResource WindowGlobal}"
TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="Auto"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<DockPanel>

View File

@@ -17,10 +17,9 @@
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
ResizeMode="NoResize"
ShowInTaskbar="False"
Style="{StaticResource WindowGlobal}"
TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="Auto"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Window.Resources>

View File

@@ -1,14 +1,14 @@
<reactiveui:ReactiveWindow
x:Class="v2rayN.Views.SubEditWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:reactiveui="http://reactiveui.net"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:conv="clr-namespace:v2rayN.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveui="http://reactiveui.net"
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
xmlns:conv="clr-namespace:v2rayN.Converters"
Title="{x:Static resx:ResUI.menuSubSetting}"
Width="700"
Height="600"
@@ -17,10 +17,9 @@
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
ResizeMode="NoResize"
ShowInTaskbar="False"
Style="{StaticResource WindowGlobal}"
TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="Auto"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Window.Resources>

View File

@@ -17,10 +17,9 @@
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
ResizeMode="NoResize"
ShowInTaskbar="False"
Style="{StaticResource WindowGlobal}"
TextElement.FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="Auto"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<materialDesign:DialogHost

View File

@@ -1,15 +1,16 @@
<reactiveui:ReactiveUserControl
x:Class="v2rayN.Views.ThemeSettingView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:reactiveui="http://reactiveui.net"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveui="http://reactiveui.net"
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
xmlns:vms="clr-namespace:v2rayN.ViewModels"
d:DesignHeight="450"
d:DesignWidth="800"
x:TypeArguments="vms:ThemeSettingViewModel"
Style="{StaticResource ViewGlobal}"
mc:Ignorable="d">
<StackPanel Margin="8">
<Grid>

View File

@@ -19,7 +19,7 @@
<PackageReference Include="TaskScheduler" Version="2.11.0" />
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
<PackageReference Include="ReactiveUI.WPF" Version="20.1.1" />
<PackageReference Include="ReactiveUI.WPF" Version="20.1.63" />
</ItemGroup>
<ItemGroup>