mirror of
https://github.com/2dust/v2rayN.git
synced 2026-05-19 08:04:40 +03:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 26abe7e7d7 | |||
| b9c86ed3a1 | |||
| b7cff66a80 | |||
| 61a40d2860 | |||
| 80eb569366 | |||
| 54fe669d89 | |||
| 0953237e9e | |||
| cf1a8599eb | |||
| 171132be12 | |||
| 43c95422b7 | |||
| 2662243641 | |||
| 060a35e091 | |||
| de1132c2df | |||
| f19edc9370 | |||
| f1601c463b | |||
| 77b15cd530 | |||
| a6479fe0d0 | |||
| 4ad4e27dc1 | |||
| 7370684985 | |||
| 5ae58e6a98 | |||
| 780ccb1932 | |||
| 6b4076be10 | |||
| d7a04a15ae | |||
| 2ae43f8bdb | |||
| d3ebc17a10 | |||
| 7a8680711e | |||
| 649e89e7af | |||
| cb94d64395 | |||
| 2440dc2440 | |||
| 364a24c580 |
@@ -29,6 +29,11 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: '8.0.x'
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
cd v2rayN
|
cd v2rayN
|
||||||
@@ -53,10 +58,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
chmod 755 package-release-zip.sh
|
chmod 755 package-release-zip.sh
|
||||||
./package-release-zip.sh $OutputArch $OutputPath64
|
./package-release-zip.sh $OutputArch $OutputPath64
|
||||||
./package-release-zip.sh "windows-64-With-Core" $OutputPath64
|
|
||||||
./package-release-zip.sh $OutputArchArm $OutputPathArm64
|
./package-release-zip.sh $OutputArchArm $OutputPathArm64
|
||||||
./package-release-zip.sh "windows-64-SelfContained" $OutputPath64Sc
|
./package-release-zip.sh "windows-64-SelfContained" $OutputPath64Sc
|
||||||
./package-release-zip.sh "windows-64-SelfContained-With-Core" $OutputPath64Sc
|
|
||||||
|
|
||||||
- name: Upload zip archive to release
|
- name: Upload zip archive to release
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ jobs:
|
|||||||
$github = Invoke-RestMethod -uri "https://api.github.com/repos/2dust/v2rayN/releases"
|
$github = Invoke-RestMethod -uri "https://api.github.com/repos/2dust/v2rayN/releases"
|
||||||
|
|
||||||
$targetRelease = $github | Where-Object -Property prerelease -match 'False' | Select -First 1
|
$targetRelease = $github | Where-Object -Property prerelease -match 'False' | Select -First 1
|
||||||
$installerUrl = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'v2rayN-windows-64-With-Core\.zip*' | Select -ExpandProperty browser_download_url
|
$installerUrl = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'v2rayN-windows-64\.zip*' | Select -ExpandProperty browser_download_url
|
||||||
|
|
||||||
$ver = $targetRelease.tag_name
|
$ver = $targetRelease.tag_name
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ Arch="$1"
|
|||||||
OutputPath="$2"
|
OutputPath="$2"
|
||||||
Version="$3"
|
Version="$3"
|
||||||
|
|
||||||
|
FileName="v2rayN-${Arch}.zip"
|
||||||
|
wget -nv -O $FileName "https://github.com/2dust/v2rayN-core-bin/raw/refs/heads/master/$FileName"
|
||||||
|
7z x $FileName
|
||||||
|
cp -rf v2rayN-${Arch}/* $OutputPath
|
||||||
|
|
||||||
PackagePath="v2rayN-Package-${Arch}"
|
PackagePath="v2rayN-Package-${Arch}"
|
||||||
mkdir -p "${PackagePath}/DEBIAN"
|
mkdir -p "${PackagePath}/DEBIAN"
|
||||||
mkdir -p "${PackagePath}/opt"
|
mkdir -p "${PackagePath}/opt"
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ Arch="$1"
|
|||||||
OutputPath="$2"
|
OutputPath="$2"
|
||||||
Version="$3"
|
Version="$3"
|
||||||
|
|
||||||
|
FileName="v2rayN-${Arch}.zip"
|
||||||
|
wget -nv -O $FileName "https://github.com/2dust/v2rayN-core-bin/raw/refs/heads/master/$FileName"
|
||||||
|
7z x $FileName
|
||||||
|
cp -rf v2rayN-${Arch}/* $OutputPath
|
||||||
|
|
||||||
PackagePath="v2rayN-Package-${Arch}"
|
PackagePath="v2rayN-Package-${Arch}"
|
||||||
mkdir -p "$PackagePath/v2rayN.app/Contents/Resources"
|
mkdir -p "$PackagePath/v2rayN.app/Contents/Resources"
|
||||||
cp -rf "$OutputPath" "$PackagePath/v2rayN.app/Contents/MacOS"
|
cp -rf "$OutputPath" "$PackagePath/v2rayN.app/Contents/MacOS"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace AmazTool
|
|||||||
{
|
{
|
||||||
Console.WriteLine($"{Resx.Resource.StartUnzipping}\n{fileName}");
|
Console.WriteLine($"{Resx.Resource.StartUnzipping}\n{fileName}");
|
||||||
|
|
||||||
Waiting(5);
|
Utils.Waiting(5);
|
||||||
|
|
||||||
if (!File.Exists(fileName))
|
if (!File.Exists(fileName))
|
||||||
{
|
{
|
||||||
@@ -42,12 +42,12 @@ namespace AmazTool
|
|||||||
StringBuilder sb = new();
|
StringBuilder sb = new();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string thisAppOldFile = $"{Utils.GetExePath()}.tmp";
|
var thisAppOldFile = $"{Utils.GetExePath()}.tmp";
|
||||||
File.Delete(thisAppOldFile);
|
File.Delete(thisAppOldFile);
|
||||||
string splitKey = "/";
|
var splitKey = "/";
|
||||||
|
|
||||||
using ZipArchive archive = ZipFile.OpenRead(fileName);
|
using var archive = ZipFile.OpenRead(fileName);
|
||||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
foreach (var entry in archive.Entries)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -60,15 +60,20 @@ namespace AmazTool
|
|||||||
|
|
||||||
var lst = entry.FullName.Split(splitKey);
|
var lst = entry.FullName.Split(splitKey);
|
||||||
if (lst.Length == 1) continue;
|
if (lst.Length == 1) continue;
|
||||||
string fullName = string.Join(splitKey, lst[1..lst.Length]);
|
var fullName = string.Join(splitKey, lst[1..lst.Length]);
|
||||||
|
|
||||||
if (string.Equals(Utils.GetExePath(), Utils.GetPath(fullName), StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(Utils.GetExePath(), Utils.GetPath(fullName), StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
File.Move(Utils.GetExePath(), thisAppOldFile);
|
File.Move(Utils.GetExePath(), thisAppOldFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
string entryOutputPath = Utils.GetPath(fullName);
|
var entryOutputPath = Utils.GetPath(fullName);
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(entryOutputPath)!);
|
Directory.CreateDirectory(Path.GetDirectoryName(entryOutputPath)!);
|
||||||
|
//In the bin folder, if the file already exists, it will be skipped
|
||||||
|
if (fullName.StartsWith("bin") && File.Exists(entryOutputPath))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
entry.ExtractToFile(entryOutputPath, true);
|
entry.ExtractToFile(entryOutputPath, true);
|
||||||
|
|
||||||
Console.WriteLine(entryOutputPath);
|
Console.WriteLine(entryOutputPath);
|
||||||
@@ -91,18 +96,9 @@ namespace AmazTool
|
|||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine(Resx.Resource.Restartv2rayN);
|
Console.WriteLine(Resx.Resource.Restartv2rayN);
|
||||||
Waiting(2);
|
Utils.Waiting(2);
|
||||||
|
|
||||||
Utils.StartV2RayN();
|
Utils.StartV2RayN();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Waiting(int second)
|
|
||||||
{
|
|
||||||
for (var i = second; i > 0; i--)
|
|
||||||
{
|
|
||||||
Console.WriteLine(i);
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,5 +39,14 @@ namespace AmazTool
|
|||||||
};
|
};
|
||||||
process.Start();
|
process.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Waiting(int second)
|
||||||
|
{
|
||||||
|
for (var i = second; i > 0; i--)
|
||||||
|
{
|
||||||
|
Console.WriteLine(i);
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ namespace ServiceLib.Common
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CopyDirectory(string sourceDir, string destinationDir, bool recursive, string? ignoredName)
|
public static void CopyDirectory(string sourceDir, string destinationDir, bool recursive, bool overwrite, string? ignoredName = null)
|
||||||
{
|
{
|
||||||
// Get information about the source directory
|
// Get information about the source directory
|
||||||
var dir = new DirectoryInfo(sourceDir);
|
var dir = new DirectoryInfo(sourceDir);
|
||||||
@@ -183,7 +183,11 @@ namespace ServiceLib.Common
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var targetFilePath = Path.Combine(destinationDir, file.Name);
|
var targetFilePath = Path.Combine(destinationDir, file.Name);
|
||||||
file.CopyTo(targetFilePath, true);
|
if (!overwrite && File.Exists(targetFilePath))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
file.CopyTo(targetFilePath, overwrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If recursive and copying subdirectories, recursively call this method
|
// If recursive and copying subdirectories, recursively call this method
|
||||||
@@ -192,9 +196,30 @@ namespace ServiceLib.Common
|
|||||||
foreach (var subDir in dirs)
|
foreach (var subDir in dirs)
|
||||||
{
|
{
|
||||||
var newDestinationDir = Path.Combine(destinationDir, subDir.Name);
|
var newDestinationDir = Path.Combine(destinationDir, subDir.Name);
|
||||||
CopyDirectory(subDir.FullName, newDestinationDir, true, ignoredName);
|
CopyDirectory(subDir.FullName, newDestinationDir, true, overwrite, ignoredName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void DeleteExpiredFiles(string sourceDir, DateTime dtLine)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var files = Directory.GetFiles(sourceDir, "*.*");
|
||||||
|
foreach (var filePath in files)
|
||||||
|
{
|
||||||
|
var file = new FileInfo(filePath);
|
||||||
|
if (file.CreationTime >= dtLine)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
file.Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,36 +25,6 @@ namespace ServiceLib.Common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ClearLogs()
|
|
||||||
{
|
|
||||||
Task.Run(() =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var now = DateTime.Now.AddMonths(-1);
|
|
||||||
var dir = Utils.GetLogPath();
|
|
||||||
var files = Directory.GetFiles(dir, "*.txt");
|
|
||||||
foreach (var filePath in files)
|
|
||||||
{
|
|
||||||
var file = new FileInfo(filePath);
|
|
||||||
if (file.CreationTime >= now) continue;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
file.Delete();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SaveLog(string strContent)
|
public static void SaveLog(string strContent)
|
||||||
{
|
{
|
||||||
if (!LogManager.IsLoggingEnabled()) return;
|
if (!LogManager.IsLoggingEnabled()) return;
|
||||||
|
|||||||
@@ -519,7 +519,7 @@ namespace ServiceLib.Common
|
|||||||
|
|
||||||
public static bool UpgradeAppExists(out string upgradeFileName)
|
public static bool UpgradeAppExists(out string upgradeFileName)
|
||||||
{
|
{
|
||||||
upgradeFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, GetExeName("AmazTool"));
|
upgradeFileName = Path.Combine(GetBaseDirectory(), GetExeName("AmazTool"));
|
||||||
return File.Exists(upgradeFileName);
|
return File.Exists(upgradeFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -666,12 +666,12 @@ namespace ServiceLib.Common
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
//When this file exists, it is equivalent to having no permission to read and write
|
//When this file exists, it is equivalent to having no permission to read and write
|
||||||
if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "NotStoreConfigHere.txt")))
|
if (File.Exists(Path.Combine(GetBaseDirectory(), "NotStoreConfigHere.txt")))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tempPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "guiTemps");
|
var tempPath = Path.Combine(GetBaseDirectory(), "guiTemps");
|
||||||
if (!Directory.Exists(tempPath))
|
if (!Directory.Exists(tempPath))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(tempPath);
|
Directory.CreateDirectory(tempPath);
|
||||||
@@ -699,6 +699,11 @@ namespace ServiceLib.Common
|
|||||||
return Path.Combine(startupPath, fileName);
|
return Path.Combine(startupPath, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetBaseDirectory(string fileName = "")
|
||||||
|
{
|
||||||
|
return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
public static string GetExePath()
|
public static string GetExePath()
|
||||||
{
|
{
|
||||||
return Environment.ProcessPath ?? Process.GetCurrentProcess().MainModule?.FileName ?? string.Empty;
|
return Environment.ProcessPath ?? Process.GetCurrentProcess().MainModule?.FileName ?? string.Empty;
|
||||||
@@ -706,12 +711,12 @@ namespace ServiceLib.Common
|
|||||||
|
|
||||||
public static string StartupPath()
|
public static string StartupPath()
|
||||||
{
|
{
|
||||||
if (Utils.IsNonWindows() && Environment.GetEnvironmentVariable("V2RAYN_LOCAL_APPLICATION_DATA") == "1")
|
if (Environment.GetEnvironmentVariable(Global.LocalAppData) == "1")
|
||||||
{
|
{
|
||||||
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "v2rayN");
|
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "v2rayN");
|
||||||
}
|
}
|
||||||
|
|
||||||
return AppDomain.CurrentDomain.BaseDirectory;
|
return GetBaseDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetTempPath(string filename = "")
|
public static string GetTempPath(string filename = "")
|
||||||
|
|||||||
+360
-78
@@ -18,7 +18,6 @@
|
|||||||
public const string GeoUrl = "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/{0}.dat";
|
public const string GeoUrl = "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/{0}.dat";
|
||||||
public const string SpeedPingTestUrl = @"https://www.google.com/generate_204";
|
public const string SpeedPingTestUrl = @"https://www.google.com/generate_204";
|
||||||
public const string JuicityCoreUrl = "https://github.com/juicity/juicity/releases";
|
public const string JuicityCoreUrl = "https://github.com/juicity/juicity/releases";
|
||||||
public const string CustomRoutingListUrl = @"https://raw.githubusercontent.com/2dust/v2rayCustomRoutingList/master/";
|
|
||||||
public const string SingboxRulesetUrl = @"https://raw.githubusercontent.com/2dust/sing-box-rules/rule-set-{0}/{1}.srs";
|
public const string SingboxRulesetUrl = @"https://raw.githubusercontent.com/2dust/sing-box-rules/rule-set-{0}/{1}.srs";
|
||||||
public const string IPAPIUrl = "https://api.ip.sb/geoip";
|
public const string IPAPIUrl = "https://api.ip.sb/geoip";
|
||||||
|
|
||||||
@@ -63,13 +62,13 @@
|
|||||||
public const string HttpProtocol = "http://";
|
public const string HttpProtocol = "http://";
|
||||||
public const string HttpsProtocol = "https://";
|
public const string HttpsProtocol = "https://";
|
||||||
public const string SocksProtocol = "socks://";
|
public const string SocksProtocol = "socks://";
|
||||||
|
public const string Socks5Protocol = "socks5://";
|
||||||
|
|
||||||
public const string UserEMail = "t@t.tt";
|
public const string UserEMail = "t@t.tt";
|
||||||
public const string AutoRunRegPath = @"Software\Microsoft\Windows\CurrentVersion\Run";
|
public const string AutoRunRegPath = @"Software\Microsoft\Windows\CurrentVersion\Run";
|
||||||
public const string AutoRunName = "v2rayNAutoRun";
|
public const string AutoRunName = "v2rayNAutoRun";
|
||||||
public const string CustomIconName = "v2rayN.ico";
|
|
||||||
public const string SystemProxyExceptionsWindows = "localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.*";
|
public const string SystemProxyExceptionsWindows = "localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.*";
|
||||||
public const string SystemProxyExceptionsLinux = "localhost, 127.0.0.0/8, ::1";
|
public const string SystemProxyExceptionsLinux = "localhost,127.0.0.0/8,::1";
|
||||||
public const string RoutingRuleComma = "<COMMA>";
|
public const string RoutingRuleComma = "<COMMA>";
|
||||||
public const string GrpcGunMode = "gun";
|
public const string GrpcGunMode = "gun";
|
||||||
public const string GrpcMultiMode = "multi";
|
public const string GrpcMultiMode = "multi";
|
||||||
@@ -79,71 +78,82 @@
|
|||||||
public const int MinFontSize = 8;
|
public const int MinFontSize = 8;
|
||||||
public const string RebootAs = "rebootas";
|
public const string RebootAs = "rebootas";
|
||||||
public const string AvaAssets = "avares://v2rayN/Assets/";
|
public const string AvaAssets = "avares://v2rayN/Assets/";
|
||||||
|
public const string LocalAppData = "V2RAYN_LOCAL_APPLICATION_DATA";
|
||||||
|
public const string V2RayLocalAsset = "V2RAY_LOCATION_ASSET";
|
||||||
|
public const string XrayLocalAsset = "XRAY_LOCATION_ASSET";
|
||||||
|
|
||||||
public static readonly List<string> IEProxyProtocols = new() {
|
public static readonly List<string> IEProxyProtocols =
|
||||||
"{ip}:{http_port}",
|
[
|
||||||
"socks={ip}:{socks_port}",
|
"{ip}:{http_port}",
|
||||||
"http={ip}:{http_port};https={ip}:{http_port};ftp={ip}:{http_port};socks={ip}:{socks_port}",
|
"socks={ip}:{socks_port}",
|
||||||
"http=http://{ip}:{http_port};https=http://{ip}:{http_port}",
|
"http={ip}:{http_port};https={ip}:{http_port};ftp={ip}:{http_port};socks={ip}:{socks_port}",
|
||||||
""
|
"http=http://{ip}:{http_port};https=http://{ip}:{http_port}",
|
||||||
};
|
""
|
||||||
|
];
|
||||||
|
|
||||||
public static readonly List<string> SubConvertUrls = new List<string> {
|
public static readonly List<string> SubConvertUrls =
|
||||||
@"https://sub.xeton.dev/sub?url={0}",
|
[
|
||||||
@"https://api.dler.io/sub?url={0}",
|
@"https://sub.xeton.dev/sub?url={0}",
|
||||||
@"http://127.0.0.1:25500/sub?url={0}",
|
@"https://api.dler.io/sub?url={0}",
|
||||||
""
|
@"http://127.0.0.1:25500/sub?url={0}",
|
||||||
};
|
""
|
||||||
|
];
|
||||||
|
|
||||||
public static readonly List<string> SubConvertConfig = new List<string> {
|
public static readonly List<string> SubConvertConfig =
|
||||||
@"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online.ini"
|
[@"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online.ini"];
|
||||||
};
|
|
||||||
|
|
||||||
public static readonly List<string> SubConvertTargets = new List<string> {
|
public static readonly List<string> SubConvertTargets =
|
||||||
"",
|
[
|
||||||
"mixed",
|
"",
|
||||||
"v2ray",
|
"mixed",
|
||||||
"clash",
|
"v2ray",
|
||||||
"ss",
|
"clash",
|
||||||
};
|
"ss"
|
||||||
|
];
|
||||||
|
|
||||||
public static readonly List<string> SpeedTestUrls = new() {
|
public static readonly List<string> SpeedTestUrls =
|
||||||
|
[
|
||||||
@"https://speed.cloudflare.com/__down?bytes=100000000",
|
@"https://speed.cloudflare.com/__down?bytes=100000000",
|
||||||
@"https://speed.cloudflare.com/__down?bytes=50000000",
|
@"https://speed.cloudflare.com/__down?bytes=50000000",
|
||||||
@"https://speed.cloudflare.com/__down?bytes=10000000",
|
@"https://speed.cloudflare.com/__down?bytes=10000000",
|
||||||
@"https://cachefly.cachefly.net/50mb.test",
|
@"https://cachefly.cachefly.net/50mb.test"
|
||||||
};
|
];
|
||||||
|
|
||||||
public static readonly List<string> SpeedPingTestUrls = new() {
|
public static readonly List<string> SpeedPingTestUrls =
|
||||||
|
[
|
||||||
@"https://www.google.com/generate_204",
|
@"https://www.google.com/generate_204",
|
||||||
@"https://www.gstatic.com/generate_204",
|
@"https://www.gstatic.com/generate_204",
|
||||||
@"https://www.apple.com/library/test/success.html",
|
@"https://www.apple.com/library/test/success.html",
|
||||||
@"http://www.msftconnecttest.com/connecttest.txt",
|
@"http://www.msftconnecttest.com/connecttest.txt"
|
||||||
};
|
];
|
||||||
|
|
||||||
public static readonly List<string> GeoFilesSources = new() {
|
public static readonly List<string> GeoFilesSources =
|
||||||
|
[
|
||||||
"",
|
"",
|
||||||
@"https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/{0}.dat",
|
@"https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/{0}.dat",
|
||||||
@"https://cdn.jsdelivr.net/gh/chocolate4u/Iran-v2ray-rules@release/{0}.dat",
|
@"https://cdn.jsdelivr.net/gh/chocolate4u/Iran-v2ray-rules@release/{0}.dat"
|
||||||
};
|
];
|
||||||
|
|
||||||
public static readonly List<string> SingboxRulesetSources = new() {
|
public static readonly List<string> SingboxRulesetSources =
|
||||||
|
[
|
||||||
"",
|
"",
|
||||||
@"https://cdn.jsdelivr.net/gh/runetfreedom/russia-v2ray-rules-dat@release/sing-box/rule-set-{0}/{1}.srs",
|
@"https://cdn.jsdelivr.net/gh/runetfreedom/russia-v2ray-rules-dat@release/sing-box/rule-set-{0}/{1}.srs",
|
||||||
@"https://cdn.jsdelivr.net/gh/chocolate4u/Iran-sing-box-rules@rule-set/{1}.srs",
|
@"https://cdn.jsdelivr.net/gh/chocolate4u/Iran-sing-box-rules@rule-set/{1}.srs"
|
||||||
};
|
];
|
||||||
|
|
||||||
public static readonly List<string> RoutingRulesSources = new() {
|
public static readonly List<string> RoutingRulesSources =
|
||||||
|
[
|
||||||
"",
|
"",
|
||||||
@"https://cdn.jsdelivr.net/gh/runetfreedom/russia-v2ray-custom-routing-list@main/v2rayN/template.json",
|
@"https://cdn.jsdelivr.net/gh/runetfreedom/russia-v2ray-custom-routing-list@main/v2rayN/template.json",
|
||||||
@"https://cdn.jsdelivr.net/gh/Chocolate4U/Iran-v2ray-rules@main/v2rayN/template.json",
|
@"https://cdn.jsdelivr.net/gh/Chocolate4U/Iran-v2ray-rules@main/v2rayN/template.json"
|
||||||
};
|
];
|
||||||
|
|
||||||
public static readonly List<string> DNSTemplateSources = new() {
|
public static readonly List<string> DNSTemplateSources =
|
||||||
|
[
|
||||||
"",
|
"",
|
||||||
@"https://cdn.jsdelivr.net/gh/runetfreedom/russia-v2ray-custom-routing-list@main/v2rayN/",
|
@"https://cdn.jsdelivr.net/gh/runetfreedom/russia-v2ray-custom-routing-list@main/v2rayN/",
|
||||||
@"https://cdn.jsdelivr.net/gh/Chocolate4U/Iran-v2ray-rules@main/v2rayN/",
|
@"https://cdn.jsdelivr.net/gh/Chocolate4U/Iran-v2ray-rules@main/v2rayN/"
|
||||||
};
|
];
|
||||||
|
|
||||||
public static readonly Dictionary<string, string> UserAgentTexts = new()
|
public static readonly Dictionary<string, string> UserAgentTexts = new()
|
||||||
{
|
{
|
||||||
@@ -181,42 +191,314 @@
|
|||||||
{EConfigType.WireGuard,"wireguard"}
|
{EConfigType.WireGuard,"wireguard"}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static readonly List<string> VmessSecurities = new() { "aes-128-gcm", "chacha20-poly1305", "auto", "none", "zero" };
|
public static readonly List<string> VmessSecurities =
|
||||||
public static readonly List<string> SsSecurities = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "none", "plain" };
|
[
|
||||||
public static readonly List<string> SsSecuritiesInXray = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "xchacha20-poly1305", "xchacha20-ietf-poly1305", "none", "plain", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305" };
|
"aes-128-gcm",
|
||||||
public static readonly List<string> SsSecuritiesInSingbox = new() { "aes-256-gcm", "aes-192-gcm", "aes-128-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "none", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "rc4-md5", "chacha20-ietf", "xchacha20" };
|
"chacha20-poly1305",
|
||||||
public static readonly List<string> Flows = new() { "", "xtls-rprx-vision", "xtls-rprx-vision-udp443" };
|
"auto",
|
||||||
public static readonly List<string> Networks = new() { "tcp", "kcp", "ws", "httpupgrade", "xhttp", "h2", "quic", "grpc" };
|
"none",
|
||||||
public static readonly List<string> KcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" };
|
"zero"
|
||||||
public static readonly List<string> CoreTypes = 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", "" };
|
|
||||||
public static readonly List<string> DomainMatchers = new() { "linear", "mph", "" };
|
|
||||||
public static readonly List<string> Fingerprints = new() { "chrome", "firefox", "safari", "ios", "android", "edge", "360", "qq", "random", "randomized", "" };
|
|
||||||
public static readonly List<string> UserAgent = new() { "chrome", "firefox", "safari", "edge", "none" };
|
|
||||||
public static readonly List<string> XhttpMode = new() { "auto", "packet-up", "stream-up", "stream-one" };
|
|
||||||
|
|
||||||
public static readonly List<string> AllowInsecure = new() { "true", "false", "" };
|
public static readonly List<string> SsSecurities =
|
||||||
public static readonly List<string> DomainStrategy4Freedoms = new() { "AsIs", "UseIP", "UseIPv4", "UseIPv6", "" };
|
[
|
||||||
public static readonly List<string> SingboxDomainStrategy4Out = new() { "ipv4_only", "prefer_ipv4", "prefer_ipv6", "ipv6_only", "" };
|
"aes-256-gcm",
|
||||||
public static readonly List<string> DomainDNSAddress = ["223.5.5.5", "223.6.6.6", "localhost"];
|
"aes-128-gcm",
|
||||||
public static readonly List<string> SingboxDomainDNSAddress = ["223.5.5.5", "223.6.6.6", "dhcp://auto"];
|
"chacha20-poly1305",
|
||||||
public static readonly List<string> Languages = new() { "zh-Hans", "zh-Hant", "en", "fa-Ir", "ru", "hu" };
|
"chacha20-ietf-poly1305",
|
||||||
public static readonly List<string> Alpns = new() { "h3", "h2", "http/1.1", "h3,h2", "h2,http/1.1", "h3,h2,http/1.1", "" };
|
"none",
|
||||||
public static readonly List<string> LogLevels = new() { "debug", "info", "warning", "error", "none" };
|
"plain"
|
||||||
public static readonly List<string> InboundTags = new() { "socks", "socks2", "socks3" };
|
];
|
||||||
public static readonly List<string> RuleProtocols = new() { "http", "tls", "bittorrent" };
|
|
||||||
public static readonly List<string> RuleNetworks = new() { "", "tcp", "udp", "tcp,udp" };
|
|
||||||
public static readonly List<string> destOverrideProtocols = ["http", "tls", "quic", "fakedns", "fakedns+others"];
|
|
||||||
public static readonly List<string> TunMtus = new() { "1280", "1408", "1500", "9000" };
|
|
||||||
public static readonly List<string> TunStacks = new() { "gvisor", "system", "mixed" };
|
|
||||||
public static readonly List<string> PresetMsgFilters = new() { "proxy", "direct", "block", "" };
|
|
||||||
public static readonly List<string> SingboxMuxs = new() { "h2mux", "smux", "yamux", "" };
|
|
||||||
public static readonly List<string> TuicCongestionControls = new() { "cubic", "new_reno", "bbr" };
|
|
||||||
|
|
||||||
public static readonly List<string> allowSelectType = new() { "selector", "urltest", "loadbalance", "fallback" };
|
public static readonly List<string> SsSecuritiesInXray =
|
||||||
public static readonly List<string> notAllowTestType = new() { "selector", "urltest", "direct", "reject", "compatible", "pass", "loadbalance", "fallback" };
|
[
|
||||||
public static readonly List<string> proxyVehicleType = new() { "file", "http" };
|
"aes-256-gcm",
|
||||||
|
"aes-128-gcm",
|
||||||
|
"chacha20-poly1305",
|
||||||
|
"chacha20-ietf-poly1305",
|
||||||
|
"xchacha20-poly1305",
|
||||||
|
"xchacha20-ietf-poly1305",
|
||||||
|
"none",
|
||||||
|
"plain",
|
||||||
|
"2022-blake3-aes-128-gcm",
|
||||||
|
"2022-blake3-aes-256-gcm",
|
||||||
|
"2022-blake3-chacha20-poly1305"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> SsSecuritiesInSingbox =
|
||||||
|
[
|
||||||
|
"aes-256-gcm",
|
||||||
|
"aes-192-gcm",
|
||||||
|
"aes-128-gcm",
|
||||||
|
"chacha20-ietf-poly1305",
|
||||||
|
"xchacha20-ietf-poly1305",
|
||||||
|
"none",
|
||||||
|
"2022-blake3-aes-128-gcm",
|
||||||
|
"2022-blake3-aes-256-gcm",
|
||||||
|
"2022-blake3-chacha20-poly1305",
|
||||||
|
"aes-128-ctr",
|
||||||
|
"aes-192-ctr",
|
||||||
|
"aes-256-ctr",
|
||||||
|
"aes-128-cfb",
|
||||||
|
"aes-192-cfb",
|
||||||
|
"aes-256-cfb",
|
||||||
|
"rc4-md5",
|
||||||
|
"chacha20-ietf",
|
||||||
|
"xchacha20"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> Flows =
|
||||||
|
[
|
||||||
|
"",
|
||||||
|
"xtls-rprx-vision",
|
||||||
|
"xtls-rprx-vision-udp443"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> Networks =
|
||||||
|
[
|
||||||
|
"tcp",
|
||||||
|
"kcp",
|
||||||
|
"ws",
|
||||||
|
"httpupgrade",
|
||||||
|
"xhttp",
|
||||||
|
"h2",
|
||||||
|
"quic",
|
||||||
|
"grpc"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> KcpHeaderTypes =
|
||||||
|
[
|
||||||
|
"srtp",
|
||||||
|
"utp",
|
||||||
|
"wechat-video",
|
||||||
|
"dtls",
|
||||||
|
"wireguard"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> CoreTypes =
|
||||||
|
[
|
||||||
|
"Xray",
|
||||||
|
"sing_box"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> DomainStrategies =
|
||||||
|
[
|
||||||
|
"AsIs",
|
||||||
|
"IPIfNonMatch",
|
||||||
|
"IPOnDemand"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> DomainStrategies4Singbox =
|
||||||
|
[
|
||||||
|
"ipv4_only",
|
||||||
|
"ipv6_only",
|
||||||
|
"prefer_ipv4",
|
||||||
|
"prefer_ipv6",
|
||||||
|
""
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> DomainMatchers =
|
||||||
|
[
|
||||||
|
"linear",
|
||||||
|
"mph",
|
||||||
|
""
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> Fingerprints =
|
||||||
|
[
|
||||||
|
"chrome",
|
||||||
|
"firefox",
|
||||||
|
"safari",
|
||||||
|
"ios",
|
||||||
|
"android",
|
||||||
|
"edge",
|
||||||
|
"360",
|
||||||
|
"qq",
|
||||||
|
"random",
|
||||||
|
"randomized",
|
||||||
|
""
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> UserAgent =
|
||||||
|
[
|
||||||
|
"chrome",
|
||||||
|
"firefox",
|
||||||
|
"safari",
|
||||||
|
"edge",
|
||||||
|
"none"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> XhttpMode =
|
||||||
|
[
|
||||||
|
"auto",
|
||||||
|
"packet-up",
|
||||||
|
"stream-up",
|
||||||
|
"stream-one"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> AllowInsecure =
|
||||||
|
[
|
||||||
|
"true",
|
||||||
|
"false",
|
||||||
|
""
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> DomainStrategy4Freedoms =
|
||||||
|
[
|
||||||
|
"AsIs",
|
||||||
|
"UseIP",
|
||||||
|
"UseIPv4",
|
||||||
|
"UseIPv6",
|
||||||
|
""
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> SingboxDomainStrategy4Out =
|
||||||
|
[
|
||||||
|
"ipv4_only",
|
||||||
|
"prefer_ipv4",
|
||||||
|
"prefer_ipv6",
|
||||||
|
"ipv6_only",
|
||||||
|
""
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> DomainDNSAddress =
|
||||||
|
[
|
||||||
|
"223.5.5.5",
|
||||||
|
"223.6.6.6",
|
||||||
|
"localhost"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> SingboxDomainDNSAddress =
|
||||||
|
[
|
||||||
|
"223.5.5.5",
|
||||||
|
"223.6.6.6",
|
||||||
|
"dhcp://auto"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> Languages =
|
||||||
|
[
|
||||||
|
"zh-Hans",
|
||||||
|
"zh-Hant",
|
||||||
|
"en",
|
||||||
|
"fa-Ir",
|
||||||
|
"ru",
|
||||||
|
"hu"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> Alpns =
|
||||||
|
[
|
||||||
|
"h3",
|
||||||
|
"h2",
|
||||||
|
"http/1.1",
|
||||||
|
"h3,h2",
|
||||||
|
"h2,http/1.1",
|
||||||
|
"h3,h2,http/1.1",
|
||||||
|
""
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> LogLevels =
|
||||||
|
[
|
||||||
|
"debug",
|
||||||
|
"info",
|
||||||
|
"warning",
|
||||||
|
"error",
|
||||||
|
"none"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> InboundTags =
|
||||||
|
[
|
||||||
|
"socks",
|
||||||
|
"socks2",
|
||||||
|
"socks3"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> RuleProtocols =
|
||||||
|
[
|
||||||
|
"http",
|
||||||
|
"tls",
|
||||||
|
"bittorrent"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> RuleNetworks =
|
||||||
|
[
|
||||||
|
"",
|
||||||
|
"tcp",
|
||||||
|
"udp",
|
||||||
|
"tcp,udp"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> destOverrideProtocols =
|
||||||
|
[
|
||||||
|
"http",
|
||||||
|
"tls",
|
||||||
|
"quic",
|
||||||
|
"fakedns",
|
||||||
|
"fakedns+others"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> TunMtus =
|
||||||
|
[
|
||||||
|
"1280",
|
||||||
|
"1408",
|
||||||
|
"1500",
|
||||||
|
"9000"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> TunStacks =
|
||||||
|
[
|
||||||
|
"gvisor",
|
||||||
|
"system",
|
||||||
|
"mixed"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> PresetMsgFilters =
|
||||||
|
[
|
||||||
|
"proxy",
|
||||||
|
"direct",
|
||||||
|
"block",
|
||||||
|
""
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> SingboxMuxs =
|
||||||
|
[
|
||||||
|
"h2mux",
|
||||||
|
"smux",
|
||||||
|
"yamux",
|
||||||
|
""
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> TuicCongestionControls =
|
||||||
|
[
|
||||||
|
"cubic",
|
||||||
|
"new_reno",
|
||||||
|
"bbr"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> allowSelectType =
|
||||||
|
[
|
||||||
|
"selector",
|
||||||
|
"urltest",
|
||||||
|
"loadbalance",
|
||||||
|
"fallback"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> notAllowTestType =
|
||||||
|
[
|
||||||
|
"selector",
|
||||||
|
"urltest",
|
||||||
|
"direct",
|
||||||
|
"reject",
|
||||||
|
"compatible",
|
||||||
|
"pass",
|
||||||
|
"loadbalance",
|
||||||
|
"fallback"
|
||||||
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> proxyVehicleType =
|
||||||
|
[
|
||||||
|
"file",
|
||||||
|
"http"
|
||||||
|
];
|
||||||
|
|
||||||
#endregion const
|
#endregion const
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,9 +46,9 @@
|
|||||||
|
|
||||||
public bool InitApp()
|
public bool InitApp()
|
||||||
{
|
{
|
||||||
if (Utils.IsNonWindows() && Utils.HasWritePermission() == false)
|
if (Utils.HasWritePermission() == false)
|
||||||
{
|
{
|
||||||
Environment.SetEnvironmentVariable("V2RAYN_LOCAL_APPLICATION_DATA", "1", EnvironmentVariableTarget.Process);
|
Environment.SetEnvironmentVariable(Global.LocalAppData, "1", EnvironmentVariableTarget.Process);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logging.Setup();
|
Logging.Setup();
|
||||||
@@ -79,7 +79,8 @@
|
|||||||
{
|
{
|
||||||
Logging.SaveLog($"v2rayN start up | {Utils.GetRuntimeInfo()}");
|
Logging.SaveLog($"v2rayN start up | {Utils.GetRuntimeInfo()}");
|
||||||
Logging.LoggingEnabled(_config.GuiItem.EnableLog);
|
Logging.LoggingEnabled(_config.GuiItem.EnableLog);
|
||||||
Logging.ClearLogs();
|
|
||||||
|
ClearExpiredFiles();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -91,6 +92,15 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ClearExpiredFiles()
|
||||||
|
{
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
FileManager.DeleteExpiredFiles(Utils.GetLogPath(), DateTime.Now.AddMonths(-1));
|
||||||
|
FileManager.DeleteExpiredFiles(Utils.GetTempPath(), DateTime.Now.AddMonths(-1));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Init
|
#endregion Init
|
||||||
|
|
||||||
#region Config
|
#region Config
|
||||||
@@ -125,7 +135,7 @@
|
|||||||
return await SQLiteHelper.Instance.TableAsync<SubItem>().OrderBy(t => t.Sort).ToListAsync();
|
return await SQLiteHelper.Instance.TableAsync<SubItem>().OrderBy(t => t.Sort).ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<SubItem?> GetSubItem(string subid)
|
public async Task<SubItem?> GetSubItem(string? subid)
|
||||||
{
|
{
|
||||||
return await SQLiteHelper.Instance.TableAsync<SubItem>().FirstOrDefaultAsync(t => t.Id == subid);
|
return await SQLiteHelper.Instance.TableAsync<SubItem>().FirstOrDefaultAsync(t => t.Id == subid);
|
||||||
}
|
}
|
||||||
@@ -170,45 +180,6 @@
|
|||||||
return await SQLiteHelper.Instance.QueryAsync<ProfileItemModel>(sql);
|
return await SQLiteHelper.Instance.QueryAsync<ProfileItemModel>(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<ProfileItemModel>?> ProfileItemsEx(string subid, string filter)
|
|
||||||
{
|
|
||||||
var lstModel = await ProfileItems(_config.SubIndexId, filter);
|
|
||||||
|
|
||||||
await ConfigHandler.SetDefaultServer(_config, lstModel);
|
|
||||||
|
|
||||||
var lstServerStat = (_config.GuiItem.EnableStatistics ? StatisticsHandler.Instance.ServerStat : null) ?? [];
|
|
||||||
var lstProfileExs = await ProfileExHandler.Instance.GetProfileExs();
|
|
||||||
lstModel = (from t in lstModel
|
|
||||||
join t2 in lstServerStat on t.IndexId equals t2.IndexId into t2b
|
|
||||||
from t22 in t2b.DefaultIfEmpty()
|
|
||||||
join t3 in lstProfileExs on t.IndexId equals t3.IndexId into t3b
|
|
||||||
from t33 in t3b.DefaultIfEmpty()
|
|
||||||
select new ProfileItemModel
|
|
||||||
{
|
|
||||||
IndexId = t.IndexId,
|
|
||||||
ConfigType = t.ConfigType,
|
|
||||||
Remarks = t.Remarks,
|
|
||||||
Address = t.Address,
|
|
||||||
Port = t.Port,
|
|
||||||
Security = t.Security,
|
|
||||||
Network = t.Network,
|
|
||||||
StreamSecurity = t.StreamSecurity,
|
|
||||||
Subid = t.Subid,
|
|
||||||
SubRemarks = t.SubRemarks,
|
|
||||||
IsActive = t.IndexId == _config.IndexId,
|
|
||||||
Sort = t33 == null ? 0 : t33.Sort,
|
|
||||||
Delay = t33 == null ? 0 : t33.Delay,
|
|
||||||
DelayVal = t33?.Delay != 0 ? $"{t33?.Delay} {Global.DelayUnit}" : string.Empty,
|
|
||||||
SpeedVal = t33?.Speed != 0 ? $"{t33?.Speed} {Global.SpeedUnit}" : string.Empty,
|
|
||||||
TodayDown = t22 == null ? "" : Utils.HumanFy(t22.TodayDown),
|
|
||||||
TodayUp = t22 == null ? "" : Utils.HumanFy(t22.TodayUp),
|
|
||||||
TotalDown = t22 == null ? "" : Utils.HumanFy(t22.TotalDown),
|
|
||||||
TotalUp = t22 == null ? "" : Utils.HumanFy(t22.TotalUp)
|
|
||||||
}).OrderBy(t => t.Sort).ToList();
|
|
||||||
|
|
||||||
return lstModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<ProfileItem?> GetProfileItem(string indexId)
|
public async Task<ProfileItem?> GetProfileItem(string indexId)
|
||||||
{
|
{
|
||||||
if (Utils.IsNullOrEmpty(indexId))
|
if (Utils.IsNullOrEmpty(indexId))
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ namespace ServiceLib.Handler
|
|||||||
{
|
{
|
||||||
AutoStartTaskService(autoRunName, "", "");
|
AutoStartTaskService(autoRunName, "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task SetTaskWindows()
|
private static async Task SetTaskWindows()
|
||||||
@@ -66,6 +68,7 @@ namespace ServiceLib.Handler
|
|||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
}
|
}
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -127,6 +130,7 @@ namespace ServiceLib.Handler
|
|||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
}
|
}
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task SetTaskLinux()
|
private static async Task SetTaskLinux()
|
||||||
|
|||||||
@@ -94,10 +94,7 @@ namespace ServiceLib.Handler
|
|||||||
EnableTun = false,
|
EnableTun = false,
|
||||||
Mtu = 9000,
|
Mtu = 9000,
|
||||||
};
|
};
|
||||||
config.GuiItem ??= new()
|
config.GuiItem ??= new();
|
||||||
{
|
|
||||||
EnableStatistics = false,
|
|
||||||
};
|
|
||||||
config.MsgUIItem ??= new();
|
config.MsgUIItem ??= new();
|
||||||
|
|
||||||
config.UiItem ??= new UIItem()
|
config.UiItem ??= new UIItem()
|
||||||
@@ -163,11 +160,6 @@ namespace ServiceLib.Handler
|
|||||||
Interval = "10-20"
|
Interval = "10-20"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Utils.IsNotEmpty(config.ConstItem.DefIEProxyExceptions))
|
|
||||||
{
|
|
||||||
config.SystemProxyItem.SystemProxyExceptions = $"{config.ConstItem.DefIEProxyExceptions};{config.SystemProxyItem.SystemProxyExceptions}";
|
|
||||||
config.ConstItem.DefIEProxyExceptions = string.Empty;
|
|
||||||
}
|
|
||||||
if (config.SystemProxyItem.SystemProxyExceptions.IsNullOrEmpty())
|
if (config.SystemProxyItem.SystemProxyExceptions.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
config.SystemProxyItem.SystemProxyExceptions = Utils.IsWindows() ? Global.SystemProxyExceptionsWindows : Global.SystemProxyExceptionsLinux;
|
config.SystemProxyItem.SystemProxyExceptions = Utils.IsWindows() ? Global.SystemProxyExceptionsWindows : Global.SystemProxyExceptionsLinux;
|
||||||
@@ -477,7 +469,7 @@ namespace ServiceLib.Handler
|
|||||||
}
|
}
|
||||||
|
|
||||||
ProfileExHandler.Instance.SetSort(lstProfile[index].IndexId, sort);
|
ProfileExHandler.Instance.SetSort(lstProfile[index].IndexId, sort);
|
||||||
return 0;
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1055,7 +1047,7 @@ namespace ServiceLib.Handler
|
|||||||
Port = node.PreSocksPort.Value,
|
Port = node.PreSocksPort.Value,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
await Task.CompletedTask;
|
||||||
return itemSocks;
|
return itemSocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1625,7 +1617,7 @@ namespace ServiceLib.Handler
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<int> SetDefaultRouting(Config config, RoutingItem routingItem)
|
public static async Task<int> SetDefaultRouting(Config config, RoutingItem routingItem)
|
||||||
|
|||||||
@@ -80,7 +80,7 @@
|
|||||||
|
|
||||||
ret.Msg = string.Format(ResUI.SuccessfulConfiguration, "");
|
ret.Msg = string.Format(ResUI.SuccessfulConfiguration, "");
|
||||||
ret.Success = true;
|
ret.Success = true;
|
||||||
return ret;
|
return await Task.FromResult(ret);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,8 +22,19 @@ namespace ServiceLib.Handler
|
|||||||
_config = config;
|
_config = config;
|
||||||
_updateFunc = updateFunc;
|
_updateFunc = updateFunc;
|
||||||
|
|
||||||
Environment.SetEnvironmentVariable("V2RAY_LOCATION_ASSET", Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
|
Environment.SetEnvironmentVariable(Global.V2RayLocalAsset, Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
|
||||||
Environment.SetEnvironmentVariable("XRAY_LOCATION_ASSET", Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
|
Environment.SetEnvironmentVariable(Global.XrayLocalAsset, Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
|
||||||
|
|
||||||
|
//Copy the bin folder to the storage location (for init)
|
||||||
|
if (Environment.GetEnvironmentVariable(Global.LocalAppData) == "1")
|
||||||
|
{
|
||||||
|
var fromPath = Utils.GetBaseDirectory("bin");
|
||||||
|
var toPath = Utils.GetBinPath("");
|
||||||
|
if (fromPath != toPath)
|
||||||
|
{
|
||||||
|
FileManager.CopyDirectory(fromPath, toPath, true, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Utils.IsNonWindows())
|
if (Utils.IsNonWindows())
|
||||||
{
|
{
|
||||||
@@ -67,13 +78,17 @@ namespace ServiceLib.Handler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateFunc(true, $"{node.GetSummary()}");
|
UpdateFunc(false, $"{node.GetSummary()}");
|
||||||
UpdateFunc(false, $"{Utils.GetRuntimeInfo()}");
|
UpdateFunc(false, $"{Utils.GetRuntimeInfo()}");
|
||||||
UpdateFunc(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")));
|
UpdateFunc(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")));
|
||||||
await CoreStop();
|
await CoreStop();
|
||||||
await Task.Delay(100);
|
await Task.Delay(100);
|
||||||
await CoreStart(node);
|
await CoreStart(node);
|
||||||
await CoreStartPreService(node);
|
await CoreStartPreService(node);
|
||||||
|
if (_process != null)
|
||||||
|
{
|
||||||
|
UpdateFunc(true, $"{node.GetSummary()}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> LoadCoreConfigSpeedtest(List<ServerTestItem> selecteds)
|
public async Task<int> LoadCoreConfigSpeedtest(List<ServerTestItem> selecteds)
|
||||||
@@ -220,8 +235,6 @@ namespace ServiceLib.Handler
|
|||||||
await RunProcessAsLinuxSudo(proc, fileName, coreInfo, configPath);
|
await RunProcessAsLinuxSudo(proc, fileName, coreInfo, configPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
var startUpErrorMessage = new StringBuilder();
|
|
||||||
var startUpSuccessful = false;
|
|
||||||
if (displayLog)
|
if (displayLog)
|
||||||
{
|
{
|
||||||
proc.OutputDataReceived += (sender, e) =>
|
proc.OutputDataReceived += (sender, e) =>
|
||||||
@@ -233,11 +246,6 @@ namespace ServiceLib.Handler
|
|||||||
{
|
{
|
||||||
if (Utils.IsNullOrEmpty(e.Data)) return;
|
if (Utils.IsNullOrEmpty(e.Data)) return;
|
||||||
UpdateFunc(false, e.Data + Environment.NewLine);
|
UpdateFunc(false, e.Data + Environment.NewLine);
|
||||||
|
|
||||||
if (!startUpSuccessful)
|
|
||||||
{
|
|
||||||
startUpErrorMessage.Append(e.Data + Environment.NewLine);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
proc.Start();
|
proc.Start();
|
||||||
@@ -258,18 +266,12 @@ namespace ServiceLib.Handler
|
|||||||
proc.BeginErrorReadLine();
|
proc.BeginErrorReadLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await Task.Delay(500);
|
||||||
AppHandler.Instance.AddProcess(proc.Handle);
|
AppHandler.Instance.AddProcess(proc.Handle);
|
||||||
if (proc.WaitForExit(1000))
|
if (proc is null or { HasExited: true })
|
||||||
{
|
{
|
||||||
proc.CancelErrorRead();
|
throw new Exception(ResUI.FailedToRunCore);
|
||||||
throw new Exception(displayLog ? startUpErrorMessage.ToString() : "启动进程失败并退出 (Failed to start the process and exited)");
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
startUpSuccessful = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
AppHandler.Instance.AddProcess(proc.Handle);
|
|
||||||
return proc;
|
return proc;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -52,144 +52,146 @@
|
|||||||
|
|
||||||
private void InitCoreInfo()
|
private void InitCoreInfo()
|
||||||
{
|
{
|
||||||
_coreInfo = [];
|
_coreInfo =
|
||||||
|
[
|
||||||
|
new CoreInfo
|
||||||
|
{
|
||||||
|
CoreType = ECoreType.v2rayN,
|
||||||
|
Url = Global.NUrl,
|
||||||
|
ReleaseApiUrl = Global.NUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
|
DownloadUrlWin64 = Global.NUrl + "/download/{0}/v2rayN-windows-64.zip",
|
||||||
|
DownloadUrlWinArm64 = Global.NUrl + "/download/{0}/v2rayN-windows-arm64.zip",
|
||||||
|
DownloadUrlLinux64 = Global.NUrl + "/download/{0}/v2rayN-linux-64.zip",
|
||||||
|
DownloadUrlLinuxArm64 = Global.NUrl + "/download/{0}/v2rayN-linux-arm64.zip",
|
||||||
|
DownloadUrlOSX64 = Global.NUrl + "/download/{0}/v2rayN-macos-64.zip",
|
||||||
|
DownloadUrlOSXArm64 = Global.NUrl + "/download/{0}/v2rayN-macos-arm64.zip",
|
||||||
|
},
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
new CoreInfo
|
||||||
{
|
{
|
||||||
CoreType = ECoreType.v2rayN,
|
CoreType = ECoreType.v2fly,
|
||||||
Url = Global.NUrl,
|
CoreExes = ["wv2ray", "v2ray"],
|
||||||
ReleaseApiUrl = Global.NUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
Arguments = "",
|
||||||
DownloadUrlWin64 = Global.NUrl + "/download/{0}/v2rayN-windows-64.zip",
|
Url = Global.V2flyCoreUrl,
|
||||||
DownloadUrlWinArm64 = Global.NUrl + "/download/{0}/v2rayN-windows-arm64.zip",
|
ReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
DownloadUrlLinux64 = Global.NUrl + "/download/{0}/v2rayN-linux-64.zip",
|
Match = "V2Ray",
|
||||||
DownloadUrlLinuxArm64 = Global.NUrl + "/download/{0}/v2rayN-linux-arm64.zip",
|
VersionArg = "-version",
|
||||||
DownloadUrlOSX64 = Global.NUrl + "/download/{0}/v2rayN-macos-64.zip",
|
RedirectInfo = true,
|
||||||
DownloadUrlOSXArm64 = Global.NUrl + "/download/{0}/v2rayN-macos-arm64.zip",
|
},
|
||||||
});
|
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
new CoreInfo
|
||||||
{
|
{
|
||||||
CoreType = ECoreType.v2fly,
|
CoreType = ECoreType.v2fly_v5,
|
||||||
CoreExes = new List<string> { "wv2ray", "v2ray" },
|
CoreExes = ["v2ray"],
|
||||||
Arguments = "",
|
Arguments = "run -c config.json -format jsonv5",
|
||||||
Url = Global.V2flyCoreUrl,
|
Url = Global.V2flyCoreUrl,
|
||||||
ReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
ReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
Match = "V2Ray",
|
Match = "V2Ray",
|
||||||
VersionArg = "-version",
|
VersionArg = "version",
|
||||||
RedirectInfo = true,
|
RedirectInfo = true,
|
||||||
});
|
},
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
new CoreInfo
|
||||||
{
|
{
|
||||||
CoreType = ECoreType.v2fly_v5,
|
CoreType = ECoreType.Xray,
|
||||||
CoreExes = new List<string> { "v2ray" },
|
CoreExes = ["xray", "wxray"],
|
||||||
Arguments = "run -c config.json -format jsonv5",
|
Arguments = "run -c {0}",
|
||||||
Url = Global.V2flyCoreUrl,
|
Url = Global.XrayCoreUrl,
|
||||||
ReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
ReleaseApiUrl = Global.XrayCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
Match = "V2Ray",
|
DownloadUrlWin64 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-64.zip",
|
||||||
VersionArg = "version",
|
DownloadUrlWinArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-arm64-v8a.zip",
|
||||||
RedirectInfo = true,
|
DownloadUrlLinux64 = Global.XrayCoreUrl + "/download/{0}/Xray-linux-64.zip",
|
||||||
});
|
DownloadUrlLinuxArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-linux-arm64-v8a.zip",
|
||||||
|
DownloadUrlOSX64 = Global.XrayCoreUrl + "/download/{0}/Xray-macos-64.zip",
|
||||||
|
DownloadUrlOSXArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-macos-arm64-v8a.zip",
|
||||||
|
Match = "Xray",
|
||||||
|
VersionArg = "-version",
|
||||||
|
RedirectInfo = true,
|
||||||
|
},
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
new CoreInfo
|
||||||
{
|
{
|
||||||
CoreType = ECoreType.Xray,
|
CoreType = ECoreType.mihomo,
|
||||||
CoreExes = new List<string> { "xray", "wxray" },
|
CoreExes = ["mihomo-windows-amd64-compatible", "mihomo-windows-amd64", "mihomo-linux-amd64", "mihomo", "clash"],
|
||||||
Arguments = "run -c {0}",
|
Arguments = "-f config.json" + PortableMode(),
|
||||||
Url = Global.XrayCoreUrl,
|
Url = Global.MihomoCoreUrl,
|
||||||
ReleaseApiUrl = Global.XrayCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
ReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
DownloadUrlWin64 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-64.zip",
|
DownloadUrlWin64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-amd64-compatible-{0}.zip",
|
||||||
DownloadUrlWinArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-arm64-v8a.zip",
|
DownloadUrlWinArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-arm64-{0}.zip",
|
||||||
DownloadUrlLinux64 = Global.XrayCoreUrl + "/download/{0}/Xray-linux-64.zip",
|
DownloadUrlLinux64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-amd64-compatible-{0}.gz",
|
||||||
DownloadUrlLinuxArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-linux-arm64-v8a.zip",
|
DownloadUrlLinuxArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-arm64-{0}.gz",
|
||||||
DownloadUrlOSX64 = Global.XrayCoreUrl + "/download/{0}/Xray-macos-64.zip",
|
DownloadUrlOSX64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-darwin-amd64-compatible-{0}.gz",
|
||||||
DownloadUrlOSXArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-macos-arm64-v8a.zip",
|
DownloadUrlOSXArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-darwin-arm64-{0}.gz",
|
||||||
Match = "Xray",
|
Match = "Mihomo",
|
||||||
VersionArg = "-version",
|
VersionArg = "-v",
|
||||||
RedirectInfo = true,
|
RedirectInfo = true,
|
||||||
});
|
},
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
new CoreInfo
|
||||||
{
|
{
|
||||||
CoreType = ECoreType.mihomo,
|
CoreType = ECoreType.hysteria,
|
||||||
CoreExes = new List<string> { "mihomo-windows-amd64-compatible", "mihomo-windows-amd64", "mihomo-linux-amd64", "mihomo", "clash" },
|
CoreExes = ["hysteria-windows-amd64", "hysteria"],
|
||||||
Arguments = "-f config.json" + PortableMode(),
|
Arguments = "",
|
||||||
Url = Global.MihomoCoreUrl,
|
Url = Global.HysteriaCoreUrl,
|
||||||
ReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
ReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
DownloadUrlWin64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-amd64-compatible-{0}.zip",
|
RedirectInfo = true,
|
||||||
DownloadUrlWinArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-arm64-{0}.zip",
|
},
|
||||||
DownloadUrlLinux64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-amd64-compatible-{0}.gz",
|
|
||||||
DownloadUrlLinuxArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-arm64-{0}.gz",
|
|
||||||
DownloadUrlOSX64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-darwin-amd64-compatible-{0}.gz",
|
|
||||||
DownloadUrlOSXArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-darwin-arm64-{0}.gz",
|
|
||||||
Match = "Mihomo",
|
|
||||||
VersionArg = "-v",
|
|
||||||
RedirectInfo = true,
|
|
||||||
});
|
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
new CoreInfo
|
||||||
{
|
{
|
||||||
CoreType = ECoreType.hysteria,
|
CoreType = ECoreType.naiveproxy,
|
||||||
CoreExes = new List<string> { "hysteria-windows-amd64", "hysteria" },
|
CoreExes = ["naiveproxy", "naive"],
|
||||||
Arguments = "",
|
Arguments = "config.json",
|
||||||
Url = Global.HysteriaCoreUrl,
|
Url = Global.NaiveproxyCoreUrl,
|
||||||
ReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
RedirectInfo = false,
|
||||||
RedirectInfo = true,
|
},
|
||||||
});
|
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
new CoreInfo
|
||||||
{
|
{
|
||||||
CoreType = ECoreType.naiveproxy,
|
CoreType = ECoreType.tuic,
|
||||||
CoreExes = new List<string> { "naiveproxy", "naive" },
|
CoreExes = ["tuic-client", "tuic"],
|
||||||
Arguments = "config.json",
|
Arguments = "-c config.json",
|
||||||
Url = Global.NaiveproxyCoreUrl,
|
Url = Global.TuicCoreUrl,
|
||||||
RedirectInfo = false,
|
RedirectInfo = true,
|
||||||
});
|
},
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
new CoreInfo
|
||||||
{
|
{
|
||||||
CoreType = ECoreType.tuic,
|
CoreType = ECoreType.sing_box,
|
||||||
CoreExes = new List<string> { "tuic-client", "tuic" },
|
CoreExes = ["sing-box-client", "sing-box"],
|
||||||
Arguments = "-c config.json",
|
Arguments = "run -c {0} --disable-color",
|
||||||
Url = Global.TuicCoreUrl,
|
Url = Global.SingboxCoreUrl,
|
||||||
RedirectInfo = true,
|
RedirectInfo = true,
|
||||||
});
|
ReleaseApiUrl = Global.SingboxCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
|
DownloadUrlWin64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-amd64.zip",
|
||||||
|
DownloadUrlWinArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-arm64.zip",
|
||||||
|
DownloadUrlLinux64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-linux-amd64.tar.gz",
|
||||||
|
DownloadUrlLinuxArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-linux-arm64.tar.gz",
|
||||||
|
DownloadUrlOSX64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-darwin-amd64.tar.gz",
|
||||||
|
DownloadUrlOSXArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-darwin-arm64.tar.gz",
|
||||||
|
Match = "sing-box",
|
||||||
|
VersionArg = "version",
|
||||||
|
},
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
new CoreInfo
|
||||||
{
|
{
|
||||||
CoreType = ECoreType.sing_box,
|
CoreType = ECoreType.juicity,
|
||||||
CoreExes = new List<string> { "sing-box-client", "sing-box" },
|
CoreExes = ["juicity-client", "juicity"],
|
||||||
Arguments = "run -c {0} --disable-color",
|
Arguments = "run -c config.json",
|
||||||
Url = Global.SingboxCoreUrl,
|
Url = Global.JuicityCoreUrl
|
||||||
RedirectInfo = true,
|
},
|
||||||
ReleaseApiUrl = Global.SingboxCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
|
||||||
DownloadUrlWin64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-amd64.zip",
|
|
||||||
DownloadUrlWinArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-arm64.zip",
|
|
||||||
DownloadUrlLinux64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-linux-amd64.tar.gz",
|
|
||||||
DownloadUrlLinuxArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-linux-arm64.tar.gz",
|
|
||||||
DownloadUrlOSX64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-darwin-amd64.tar.gz",
|
|
||||||
DownloadUrlOSXArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-darwin-arm64.tar.gz",
|
|
||||||
Match = "sing-box",
|
|
||||||
VersionArg = "version",
|
|
||||||
});
|
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
new CoreInfo
|
||||||
{
|
{
|
||||||
CoreType = ECoreType.juicity,
|
CoreType = ECoreType.hysteria2,
|
||||||
CoreExes = new List<string> { "juicity-client", "juicity" },
|
CoreExes = ["hysteria-windows-amd64", "hysteria-linux-amd64", "hysteria"],
|
||||||
Arguments = "run -c config.json",
|
Arguments = "",
|
||||||
Url = Global.JuicityCoreUrl
|
Url = Global.HysteriaCoreUrl,
|
||||||
});
|
ReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
|
RedirectInfo = true,
|
||||||
|
}
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
];
|
||||||
{
|
|
||||||
CoreType = ECoreType.hysteria2,
|
|
||||||
CoreExes = new List<string> { "hysteria-windows-amd64", "hysteria-linux-amd64", "hysteria" },
|
|
||||||
Arguments = "",
|
|
||||||
Url = Global.HysteriaCoreUrl,
|
|
||||||
ReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
|
||||||
RedirectInfo = true,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string PortableMode()
|
private string PortableMode()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace ServiceLib.Handler
|
|||||||
public async Task Init()
|
public async Task Init()
|
||||||
{
|
{
|
||||||
await InitData();
|
await InitData();
|
||||||
Task.Run(async () =>
|
_ = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@@ -32,7 +32,7 @@ namespace ServiceLib.Handler
|
|||||||
|
|
||||||
public async Task<ConcurrentBag<ProfileExItem>> GetProfileExs()
|
public async Task<ConcurrentBag<ProfileExItem>> GetProfileExs()
|
||||||
{
|
{
|
||||||
return _lstProfileEx;
|
return await Task.FromResult(_lstProfileEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task InitData()
|
private async Task InitData()
|
||||||
|
|||||||
@@ -19,15 +19,13 @@
|
|||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_updateFunc = updateFunc;
|
_updateFunc = updateFunc;
|
||||||
if (!config.GuiItem.EnableStatistics)
|
if (config.GuiItem.EnableStatistics || _config.GuiItem.DisplayRealTimeSpeed)
|
||||||
{
|
{
|
||||||
return;
|
await InitData();
|
||||||
|
|
||||||
|
_statisticsXray = new StatisticsXrayService(config, UpdateServerStatHandler);
|
||||||
|
_statisticsSingbox = new StatisticsSingboxService(config, UpdateServerStatHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
await InitData();
|
|
||||||
|
|
||||||
_statisticsXray = new StatisticsXrayService(config, UpdateServerStatHandler);
|
|
||||||
_statisticsSingbox = new StatisticsSingboxService(config, UpdateServerStatHandler);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
@@ -72,6 +70,11 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (indexId == toIndexId)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var stat = _lstServerStat.FirstOrDefault(t => t.IndexId == indexId);
|
var stat = _lstServerStat.FirstOrDefault(t => t.IndexId == indexId);
|
||||||
if (stat == null)
|
if (stat == null)
|
||||||
{
|
{
|
||||||
@@ -96,7 +99,7 @@
|
|||||||
|
|
||||||
private void UpdateServerStatHandler(ServerSpeedItem server)
|
private void UpdateServerStatHandler(ServerSpeedItem server)
|
||||||
{
|
{
|
||||||
UpdateServerStat(server);
|
_ = UpdateServerStat(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateServerStat(ServerSpeedItem server)
|
private async Task UpdateServerStat(ServerSpeedItem server)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var port = AppHandler.Instance.GetLocalPort(EInboundProtocol.socks);
|
var port = AppHandler.Instance.GetLocalPort(EInboundProtocol.socks);
|
||||||
var exceptions = config.SystemProxyItem.SystemProxyExceptions;
|
var exceptions = config.SystemProxyItem.SystemProxyExceptions.Replace(" ", "");
|
||||||
if (port <= 0)
|
if (port <= 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
private static void GetWindowsProxyString(Config config, int port, out string strProxy, out string strExceptions)
|
private static void GetWindowsProxyString(Config config, int port, out string strProxy, out string strExceptions)
|
||||||
{
|
{
|
||||||
strExceptions = config.SystemProxyItem.SystemProxyExceptions;
|
strExceptions = config.SystemProxyItem.SystemProxyExceptions.Replace(" ", "");
|
||||||
if (config.SystemProxyItem.NotProxyLocalAddress)
|
if (config.SystemProxyItem.NotProxyLocalAddress)
|
||||||
{
|
{
|
||||||
strExceptions = $"<local>;{strExceptions}";
|
strExceptions = $"<local>;{strExceptions}";
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
public string? destinationPort { get; set; }
|
public string? destinationPort { get; set; }
|
||||||
public string? host { get; set; }
|
public string? host { get; set; }
|
||||||
public string? nsMode { get; set; }
|
public string? nsMode { get; set; }
|
||||||
public object uid { get; set; }
|
public object? uid { get; set; }
|
||||||
public string? process { get; set; }
|
public string? process { get; set; }
|
||||||
public string? processPath { get; set; }
|
public string? processPath { get; set; }
|
||||||
public string? remoteDestination { get; set; }
|
public string? remoteDestination { get; set; }
|
||||||
|
|||||||
@@ -67,21 +67,13 @@
|
|||||||
public class GUIItem
|
public class GUIItem
|
||||||
{
|
{
|
||||||
public bool AutoRun { get; set; }
|
public bool AutoRun { get; set; }
|
||||||
|
|
||||||
public bool EnableStatistics { get; set; }
|
public bool EnableStatistics { get; set; }
|
||||||
|
public bool DisplayRealTimeSpeed { get; set; }
|
||||||
public bool KeepOlderDedupl { get; set; }
|
public bool KeepOlderDedupl { get; set; }
|
||||||
|
|
||||||
public bool IgnoreGeoUpdateCore { get; set; } = true;
|
|
||||||
|
|
||||||
public int AutoUpdateInterval { get; set; }
|
public int AutoUpdateInterval { get; set; }
|
||||||
|
|
||||||
public bool EnableSecurityProtocolTls13 { get; set; }
|
public bool EnableSecurityProtocolTls13 { get; set; }
|
||||||
|
|
||||||
public int TrayMenuServersLimit { get; set; } = 20;
|
public int TrayMenuServersLimit { get; set; } = 20;
|
||||||
|
|
||||||
public bool EnableHWA { get; set; } = false;
|
public bool EnableHWA { get; set; } = false;
|
||||||
|
|
||||||
public bool EnableLog { get; set; } = true;
|
public bool EnableLog { get; set; } = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,8 +110,7 @@
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
public class ConstItem
|
public class ConstItem
|
||||||
{
|
{
|
||||||
public string DefIEProxyExceptions { get; set; }
|
public string? SubConvertUrl { get; set; }
|
||||||
public string SubConvertUrl { get; set; } = string.Empty;
|
|
||||||
public string? GeoSourceUrl { get; set; }
|
public string? GeoSourceUrl { get; set; }
|
||||||
public string? SrsSourceUrl { get; set; }
|
public string? SrsSourceUrl { get; set; }
|
||||||
public string? RouteRulesTemplateSourceUrl { get; set; }
|
public string? RouteRulesTemplateSourceUrl { get; set; }
|
||||||
|
|||||||
Generated
+19
-10
@@ -843,6 +843,15 @@ namespace ServiceLib.Resx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Copy proxy command to clipboard 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string menuCopyProxyCmdToClipboard {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("menuCopyProxyCmdToClipboard", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Clone selected server 的本地化字符串。
|
/// 查找类似 Clone selected server 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -2905,6 +2914,15 @@ namespace ServiceLib.Resx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Display real-time speed 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TbSettingsDisplayRealTimeSpeed {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TbSettingsDisplayRealTimeSpeed", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Outbound DNS address 的本地化字符串。
|
/// 查找类似 Outbound DNS address 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -3103,15 +3121,6 @@ namespace ServiceLib.Resx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查找类似 Ignore Geo files when updating core 的本地化字符串。
|
|
||||||
/// </summary>
|
|
||||||
public static string TbSettingsIgnoreGeoUpdateCore {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("TbSettingsIgnoreGeoUpdateCore", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Keep older when deduplication 的本地化字符串。
|
/// 查找类似 Keep older when deduplication 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -3392,7 +3401,7 @@ namespace ServiceLib.Resx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Enable Statistics (Require restart) 的本地化字符串。
|
/// 查找类似 Enable traffic statistics (Require restart) 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string TbSettingsStatistics {
|
public static string TbSettingsStatistics {
|
||||||
get {
|
get {
|
||||||
|
|||||||
@@ -718,8 +718,8 @@
|
|||||||
<data name="TbSettingsHttpPort" xml:space="preserve">
|
<data name="TbSettingsHttpPort" xml:space="preserve">
|
||||||
<value>پورت Http</value>
|
<value>پورت Http</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
|
<data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve">
|
||||||
<value>هنگام بهروزرسانی هسته، فایلهای Geo را نادیده بگیرید</value>
|
<value>نمایش سرعت در زمان واقعی</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
|
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
|
||||||
<value>هنگام کپی برداری، نگه داری قدیمی تر ها</value>
|
<value>هنگام کپی برداری، نگه داری قدیمی تر ها</value>
|
||||||
@@ -1390,4 +1390,7 @@
|
|||||||
<data name="TbSettingsTheme" xml:space="preserve">
|
<data name="TbSettingsTheme" xml:space="preserve">
|
||||||
<value>تم</value>
|
<value>تم</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
||||||
|
<value>کپی کردن دستور پروکسی در کلیپ بورد</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|||||||
@@ -718,8 +718,8 @@
|
|||||||
<data name="TbSettingsHttpPort" xml:space="preserve">
|
<data name="TbSettingsHttpPort" xml:space="preserve">
|
||||||
<value>HTTP Port</value>
|
<value>HTTP Port</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
|
<data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve">
|
||||||
<value>Geo fájlok figyelmen kívül hagyása a yalap frissítésekor</value>
|
<value>Display real-time speed</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
|
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
|
||||||
<value>Régi megőrzése a deduplikáció során</value>
|
<value>Régi megőrzése a deduplikáció során</value>
|
||||||
@@ -1390,4 +1390,7 @@
|
|||||||
<data name="TbSettingsTheme" xml:space="preserve">
|
<data name="TbSettingsTheme" xml:space="preserve">
|
||||||
<value>Theme</value>
|
<value>Theme</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
||||||
|
<value>Copy proxy command to clipboard</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -718,8 +718,8 @@
|
|||||||
<data name="TbSettingsHttpPort" xml:space="preserve">
|
<data name="TbSettingsHttpPort" xml:space="preserve">
|
||||||
<value>HTTP Port</value>
|
<value>HTTP Port</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
|
<data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve">
|
||||||
<value>Ignore Geo files when updating core</value>
|
<value>Display real-time speed (Require restart)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
|
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
|
||||||
<value>Keep older when deduplication</value>
|
<value>Keep older when deduplication</value>
|
||||||
@@ -755,7 +755,7 @@
|
|||||||
<value>Start on boot</value>
|
<value>Start on boot</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsStatistics" xml:space="preserve">
|
<data name="TbSettingsStatistics" xml:space="preserve">
|
||||||
<value>Enable Statistics (Require restart)</value>
|
<value>Enable traffic statistics (Require restart)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsSubConvert" xml:space="preserve">
|
<data name="TbSettingsSubConvert" xml:space="preserve">
|
||||||
<value>Subscription conversion URL</value>
|
<value>Subscription conversion URL</value>
|
||||||
@@ -1390,4 +1390,7 @@
|
|||||||
<data name="TbSettingsTheme" xml:space="preserve">
|
<data name="TbSettingsTheme" xml:space="preserve">
|
||||||
<value>Theme</value>
|
<value>Theme</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
||||||
|
<value>Copy proxy command to clipboard</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -724,8 +724,8 @@
|
|||||||
<data name="TbSettingsHttpPort" xml:space="preserve">
|
<data name="TbSettingsHttpPort" xml:space="preserve">
|
||||||
<value>HTTP порт</value>
|
<value>HTTP порт</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
|
<data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve">
|
||||||
<value>Игнорировать файлы Geo при обновлении ядра</value>
|
<value>Display real-time speed</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
|
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
|
||||||
<value>Сохранить старые при удалении дублей</value>
|
<value>Сохранить старые при удалении дублей</value>
|
||||||
@@ -1390,4 +1390,7 @@
|
|||||||
<data name="TbSettingsTheme" xml:space="preserve">
|
<data name="TbSettingsTheme" xml:space="preserve">
|
||||||
<value>Theme</value>
|
<value>Theme</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
||||||
|
<value>Copy proxy command to clipboard</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -718,8 +718,8 @@
|
|||||||
<data name="TbSettingsHttpPort" xml:space="preserve">
|
<data name="TbSettingsHttpPort" xml:space="preserve">
|
||||||
<value>本地http监听端口</value>
|
<value>本地http监听端口</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
|
<data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve">
|
||||||
<value>更新Core时忽略Geo文件</value>
|
<value>显示实时速度(需重启)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
|
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
|
||||||
<value>去重时保留序号较小的项</value>
|
<value>去重时保留序号较小的项</value>
|
||||||
@@ -755,7 +755,7 @@
|
|||||||
<value>开机启动(可能会不成功)</value>
|
<value>开机启动(可能会不成功)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsStatistics" xml:space="preserve">
|
<data name="TbSettingsStatistics" xml:space="preserve">
|
||||||
<value>启用统计(实时网速显示,需重启)</value>
|
<value>启用流量统计(需重启)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsSubConvert" xml:space="preserve">
|
<data name="TbSettingsSubConvert" xml:space="preserve">
|
||||||
<value>订阅转换网址(可选)</value>
|
<value>订阅转换网址(可选)</value>
|
||||||
@@ -1387,4 +1387,7 @@
|
|||||||
<data name="TbSettingsTheme" xml:space="preserve">
|
<data name="TbSettingsTheme" xml:space="preserve">
|
||||||
<value>主题</value>
|
<value>主题</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
||||||
|
<value>复制终端代理命令至剪贴板</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -719,8 +719,8 @@
|
|||||||
<data name="TbSettingsHttpPort" xml:space="preserve">
|
<data name="TbSettingsHttpPort" xml:space="preserve">
|
||||||
<value>本機HTTP偵聽埠</value>
|
<value>本機HTTP偵聽埠</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
|
<data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve">
|
||||||
<value>更新Core時忽略Geo檔案</value>
|
<value>顯示即時速度(需重啟)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
|
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
|
||||||
<value>去重時保留序號較小的項</value>
|
<value>去重時保留序號較小的項</value>
|
||||||
@@ -756,7 +756,7 @@
|
|||||||
<value>開機啟動(可能會不成功)</value>
|
<value>開機啟動(可能會不成功)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsStatistics" xml:space="preserve">
|
<data name="TbSettingsStatistics" xml:space="preserve">
|
||||||
<value>啟用統計(即時網速顯示,需重啟)</value>
|
<value>啟用流量統計(需重啟)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsSubConvert" xml:space="preserve">
|
<data name="TbSettingsSubConvert" xml:space="preserve">
|
||||||
<value>訂閱轉換網址(可選)</value>
|
<value>訂閱轉換網址(可選)</value>
|
||||||
@@ -1388,4 +1388,7 @@
|
|||||||
<data name="TbSettingsTheme" xml:space="preserve">
|
<data name="TbSettingsTheme" xml:space="preserve">
|
||||||
<value>主題</value>
|
<value>主題</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
||||||
|
<value>複製終端代理指令至剪貼簿</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
"tag": "remote",
|
"tag": "remote",
|
||||||
"address": "8.8.8.8",
|
"address": "tcp://8.8.8.8",
|
||||||
"strategy": "prefer_ipv4",
|
"strategy": "prefer_ipv4",
|
||||||
"detour": "proxy"
|
"detour": "proxy"
|
||||||
},
|
},
|
||||||
@@ -32,4 +32,4 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"final": "remote"
|
"final": "remote"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
"tag": "remote",
|
"tag": "remote",
|
||||||
"address": "8.8.8.8",
|
"address": "tcp://8.8.8.8",
|
||||||
"strategy": "prefer_ipv4",
|
"strategy": "prefer_ipv4",
|
||||||
"detour": "proxy"
|
"detour": "proxy"
|
||||||
},
|
},
|
||||||
@@ -33,4 +33,4 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"final": "remote"
|
"final": "remote"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Version>7.6.0</Version>
|
<Version>7.7.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Downloader" Version="3.3.1" />
|
<PackageReference Include="Downloader" Version="3.3.3" />
|
||||||
<PackageReference Include="ReactiveUI" Version="20.1.63" />
|
<PackageReference Include="ReactiveUI" Version="20.1.63" />
|
||||||
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
|
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
|
||||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<PackageReference Include="WebDav.Client" Version="2.8.0" />
|
<PackageReference Include="WebDav.Client" Version="2.8.0" />
|
||||||
<PackageReference Include="YamlDotNet" Version="16.3.0" />
|
<PackageReference Include="YamlDotNet" Version="16.3.0" />
|
||||||
<PackageReference Include="QRCoder" Version="1.6.0" />
|
<PackageReference Include="QRCoder" Version="1.6.0" />
|
||||||
<PackageReference Include="CliWrap" Version="3.7.0" />
|
<PackageReference Include="CliWrap" Version="3.7.1" />
|
||||||
<PackageReference Include="SkiaSharp.QrCode" Version="0.7.0" />
|
<PackageReference Include="SkiaSharp.QrCode" Version="0.7.0" />
|
||||||
<PackageReference Include="ZXing.Net.Bindings.SkiaSharp" Version="0.16.14" />
|
<PackageReference Include="ZXing.Net.Bindings.SkiaSharp" Version="0.16.14" />
|
||||||
<PackageReference Include="TaskScheduler" Version="2.11.0" />
|
<PackageReference Include="TaskScheduler" Version="2.11.0" />
|
||||||
|
|||||||
@@ -476,7 +476,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
}
|
}
|
||||||
return 0;
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<int> GenInbounds(SingboxConfig singboxConfig)
|
private async Task<int> GenInbounds(SingboxConfig singboxConfig)
|
||||||
@@ -721,7 +721,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
}
|
}
|
||||||
return 0;
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<int> GenOutboundTls(ProfileItem node, Outbound4Sbox outbound)
|
private async Task<int> GenOutboundTls(ProfileItem node, Outbound4Sbox outbound)
|
||||||
@@ -771,7 +771,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
}
|
}
|
||||||
return 0;
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<int> GenOutboundTransport(ProfileItem node, Outbound4Sbox outbound)
|
private async Task<int> GenOutboundTransport(ProfileItem node, Outbound4Sbox outbound)
|
||||||
@@ -848,7 +848,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
}
|
}
|
||||||
return 0;
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<int> GenMoreOutbounds(ProfileItem node, SingboxConfig singboxConfig)
|
private async Task<int> GenMoreOutbounds(ProfileItem node, SingboxConfig singboxConfig)
|
||||||
@@ -1088,7 +1088,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
}
|
}
|
||||||
return 0;
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ParseV2Domain(string domain, Rule4Sbox rule)
|
private bool ParseV2Domain(string domain, Rule4Sbox rule)
|
||||||
@@ -1240,7 +1240,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
singboxConfig.dns = dns4Sbox;
|
singboxConfig.dns = dns4Sbox;
|
||||||
return 0;
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<int> GenExperimental(SingboxConfig singboxConfig)
|
private async Task<int> GenExperimental(SingboxConfig singboxConfig)
|
||||||
@@ -1264,7 +1264,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<int> ConvertGeo2Ruleset(SingboxConfig singboxConfig)
|
private async Task<int> ConvertGeo2Ruleset(SingboxConfig singboxConfig)
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
}
|
}
|
||||||
return 0;
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<int> GenInbounds(V2rayConfig v2rayConfig)
|
private async Task<int> GenInbounds(V2rayConfig v2rayConfig)
|
||||||
@@ -423,7 +423,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
}
|
}
|
||||||
return 0;
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Inbounds4Ray GetInbound(InItem inItem, EInboundProtocol protocol, bool bSocks)
|
private Inbounds4Ray GetInbound(InItem inItem, EInboundProtocol protocol, bool bSocks)
|
||||||
@@ -560,7 +560,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
}
|
}
|
||||||
return 0;
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<int> GenOutbound(ProfileItem node, Outbounds4Ray outbound)
|
private async Task<int> GenOutbound(ProfileItem node, Outbounds4Ray outbound)
|
||||||
@@ -774,7 +774,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
}
|
}
|
||||||
return 0;
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<int> GenBoundStreamSettings(ProfileItem node, Outbounds4Ray outbound)
|
private async Task<int> GenBoundStreamSettings(ProfileItem node, Outbounds4Ray outbound)
|
||||||
@@ -1103,12 +1103,12 @@ namespace ServiceLib.Services.CoreConfig
|
|||||||
servers.AsArray().Add(JsonUtils.SerializeToNode(dnsServer));
|
servers.AsArray().Add(JsonUtils.SerializeToNode(dnsServer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<int> GenStatistic(V2rayConfig v2rayConfig)
|
private async Task<int> GenStatistic(V2rayConfig v2rayConfig)
|
||||||
{
|
{
|
||||||
if (_config.GuiItem.EnableStatistics)
|
if (_config.GuiItem.EnableStatistics || _config.GuiItem.DisplayRealTimeSpeed)
|
||||||
{
|
{
|
||||||
string tag = EInboundProtocol.api.ToString();
|
string tag = EInboundProtocol.api.ToString();
|
||||||
Metrics4Ray apiObj = new();
|
Metrics4Ray apiObj = new();
|
||||||
@@ -1150,7 +1150,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||||||
v2rayConfig.routing.rules.Add(apiRoutingRule);
|
v2rayConfig.routing.rules.Add(apiRoutingRule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<int> GenMoreOutbounds(ProfileItem node, V2rayConfig v2rayConfig)
|
private async Task<int> GenMoreOutbounds(ProfileItem node, V2rayConfig v2rayConfig)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace ServiceLib.ViewModels
|
|||||||
BrowseServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
BrowseServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
_updateView?.Invoke(EViewAction.BrowseServer, null);
|
_updateView?.Invoke(EViewAction.BrowseServer, null);
|
||||||
|
await Task.CompletedTask;
|
||||||
});
|
});
|
||||||
EditServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
EditServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
@@ -109,6 +110,7 @@ namespace ServiceLib.ViewModels
|
|||||||
{
|
{
|
||||||
NoticeHandler.Instance.Enqueue(ResUI.FailedReadConfiguration);
|
NoticeHandler.Instance.Enqueue(ResUI.FailedReadConfiguration);
|
||||||
}
|
}
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -173,10 +173,10 @@ namespace ServiceLib.ViewModels
|
|||||||
var configDirZipTemp = Utils.GetTempPath($"v2rayN_{DateTime.Now:yyyyMMddHHmmss}");
|
var configDirZipTemp = Utils.GetTempPath($"v2rayN_{DateTime.Now:yyyyMMddHHmmss}");
|
||||||
var configDirTemp = Path.Combine(configDirZipTemp, _guiConfigs);
|
var configDirTemp = Path.Combine(configDirZipTemp, _guiConfigs);
|
||||||
|
|
||||||
FileManager.CopyDirectory(configDir, configDirTemp, false, "cache.db");
|
FileManager.CopyDirectory(configDir, configDirTemp, false, true, "cache.db");
|
||||||
var ret = FileManager.CreateFromDirectory(configDirZipTemp, fileName);
|
var ret = FileManager.CreateFromDirectory(configDirZipTemp, fileName);
|
||||||
Directory.Delete(configDirZipTemp, true);
|
Directory.Delete(configDirZipTemp, true);
|
||||||
return ret;
|
return await Task.FromResult(ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ namespace ServiceLib.ViewModels
|
|||||||
{
|
{
|
||||||
foreach (var subDir in dir.GetDirectories())
|
foreach (var subDir in dir.GetDirectories())
|
||||||
{
|
{
|
||||||
FileManager.CopyDirectory(subDir.FullName, toPath, false, null);
|
FileManager.CopyDirectory(subDir.FullName, toPath, false, true);
|
||||||
subDir.Delete(true);
|
subDir.Delete(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -259,7 +259,7 @@ namespace ServiceLib.ViewModels
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FileManager.ZipExtractToFile(fileName, toPath, _config.GuiItem.IgnoreGeoUpdateCore ? "geo" : "");
|
FileManager.ZipExtractToFile(fileName, toPath, "geo");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.IsNonWindows())
|
if (Utils.IsNonWindows())
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace ServiceLib.ViewModels
|
|||||||
await ClashConnectionClose(true);
|
await ClashConnectionClose(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
Init();
|
_ = Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Init()
|
private async Task Init()
|
||||||
@@ -73,6 +73,7 @@ namespace ServiceLib.ViewModels
|
|||||||
Task.Delay(1000).Wait();
|
Task.Delay(1000).Wait();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task GetClashConnections()
|
private async Task GetClashConnections()
|
||||||
|
|||||||
@@ -90,13 +90,13 @@ namespace ServiceLib.ViewModels
|
|||||||
y => y == true)
|
y => y == true)
|
||||||
.Subscribe(c => { _config.ClashUIItem.ProxiesAutoRefresh = AutoRefresh; });
|
.Subscribe(c => { _config.ClashUIItem.ProxiesAutoRefresh = AutoRefresh; });
|
||||||
|
|
||||||
Init();
|
_ = Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Init()
|
private async Task Init()
|
||||||
{
|
{
|
||||||
await ProxiesReload();
|
await ProxiesReload();
|
||||||
DelayTestTask();
|
_ = DelayTestTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DoRulemodeSelected(bool c)
|
private async Task DoRulemodeSelected(bool c)
|
||||||
@@ -265,7 +265,7 @@ namespace ServiceLib.ViewModels
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_proxies.TryGetValue(name, out ProxiesItem proxy);
|
_proxies.TryGetValue(name, out var proxy);
|
||||||
if (proxy == null || proxy.all == null)
|
if (proxy == null || proxy.all == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -316,7 +316,7 @@ namespace ServiceLib.ViewModels
|
|||||||
{
|
{
|
||||||
if (_proxies is null)
|
if (_proxies is null)
|
||||||
return null;
|
return null;
|
||||||
_proxies.TryGetValue(name, out ProxiesItem proxy2);
|
_proxies.TryGetValue(name, out var proxy2);
|
||||||
if (proxy2 != null)
|
if (proxy2 != null)
|
||||||
{
|
{
|
||||||
return proxy2;
|
return proxy2;
|
||||||
@@ -399,6 +399,7 @@ namespace ServiceLib.ViewModels
|
|||||||
|
|
||||||
_updateView?.Invoke(EViewAction.DispatcherProxiesDelayTest, new SpeedTestResult() { IndexId = item.Name, Delay = result });
|
_updateView?.Invoke(EViewAction.DispatcherProxiesDelayTest, new SpeedTestResult() { IndexId = item.Name, Delay = result });
|
||||||
});
|
});
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ProxiesDelayTestResult(SpeedTestResult result)
|
public void ProxiesDelayTestResult(SpeedTestResult result)
|
||||||
@@ -434,7 +435,7 @@ namespace ServiceLib.ViewModels
|
|||||||
public async Task DelayTestTask()
|
public async Task DelayTestTask()
|
||||||
{
|
{
|
||||||
var lastTime = DateTime.Now;
|
var lastTime = DateTime.Now;
|
||||||
Task.Run(async () =>
|
_ = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@@ -457,6 +458,7 @@ namespace ServiceLib.ViewModels
|
|||||||
lastTime = dtNow;
|
lastTime = dtNow;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion task
|
#endregion task
|
||||||
|
|||||||
@@ -32,15 +32,17 @@ namespace ServiceLib.ViewModels
|
|||||||
ImportDefConfig4V2rayCmd = ReactiveCommand.CreateFromTask(async () =>
|
ImportDefConfig4V2rayCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
normalDNS = Utils.GetEmbedText(Global.DNSV2rayNormalFileName);
|
normalDNS = Utils.GetEmbedText(Global.DNSV2rayNormalFileName);
|
||||||
|
await Task.CompletedTask;
|
||||||
});
|
});
|
||||||
|
|
||||||
ImportDefConfig4SingboxCmd = ReactiveCommand.CreateFromTask(async () =>
|
ImportDefConfig4SingboxCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
normalDNS2 = Utils.GetEmbedText(Global.DNSSingboxNormalFileName);
|
normalDNS2 = Utils.GetEmbedText(Global.DNSSingboxNormalFileName);
|
||||||
tunDNS2 = Utils.GetEmbedText(Global.TunSingboxDNSFileName);
|
tunDNS2 = Utils.GetEmbedText(Global.TunSingboxDNSFileName);
|
||||||
|
await Task.CompletedTask;
|
||||||
});
|
});
|
||||||
|
|
||||||
Init();
|
_ = Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Init()
|
private async Task Init()
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ namespace ServiceLib.ViewModels
|
|||||||
|
|
||||||
#endregion Menu
|
#endregion Menu
|
||||||
|
|
||||||
|
private bool _hasNextReloadJob = false;
|
||||||
|
|
||||||
#region Init
|
#region Init
|
||||||
|
|
||||||
public MainWindowViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
|
public MainWindowViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
|
||||||
@@ -204,7 +206,7 @@ namespace ServiceLib.ViewModels
|
|||||||
|
|
||||||
#endregion WhenAnyValue && ReactiveCommand
|
#endregion WhenAnyValue && ReactiveCommand
|
||||||
|
|
||||||
Init();
|
_ = Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Init()
|
private async Task Init()
|
||||||
@@ -217,11 +219,12 @@ namespace ServiceLib.ViewModels
|
|||||||
await CoreHandler.Instance.Init(_config, UpdateHandler);
|
await CoreHandler.Instance.Init(_config, UpdateHandler);
|
||||||
TaskHandler.Instance.RegUpdateTask(_config, UpdateTaskHandler);
|
TaskHandler.Instance.RegUpdateTask(_config, UpdateTaskHandler);
|
||||||
|
|
||||||
if (_config.GuiItem.EnableStatistics)
|
if (_config.GuiItem.EnableStatistics || _config.GuiItem.DisplayRealTimeSpeed)
|
||||||
{
|
{
|
||||||
await StatisticsHandler.Instance.Init(_config, UpdateStatisticsHandler);
|
await StatisticsHandler.Instance.Init(_config, UpdateStatisticsHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BlReloadEnabled = true;
|
||||||
await Reload();
|
await Reload();
|
||||||
await AutoHideStartup();
|
await AutoHideStartup();
|
||||||
Locator.Current.GetService<StatusBarViewModel>()?.RefreshRoutingsMenu();
|
Locator.Current.GetService<StatusBarViewModel>()?.RefreshRoutingsMenu();
|
||||||
@@ -249,7 +252,7 @@ namespace ServiceLib.ViewModels
|
|||||||
RefreshServers();
|
RefreshServers();
|
||||||
if (indexIdOld != _config.IndexId)
|
if (indexIdOld != _config.IndexId)
|
||||||
{
|
{
|
||||||
Reload();
|
_ = Reload();
|
||||||
}
|
}
|
||||||
if (_config.UiItem.EnableAutoAdjustMainLvColWidth)
|
if (_config.UiItem.EnableAutoAdjustMainLvColWidth)
|
||||||
{
|
{
|
||||||
@@ -269,16 +272,13 @@ namespace ServiceLib.ViewModels
|
|||||||
|
|
||||||
public void SetStatisticsResult(ServerSpeedItem update)
|
public void SetStatisticsResult(ServerSpeedItem update)
|
||||||
{
|
{
|
||||||
try
|
if (_config.GuiItem.DisplayRealTimeSpeed)
|
||||||
{
|
{
|
||||||
Locator.Current.GetService<StatusBarViewModel>()?.UpdateStatistics(update);
|
Locator.Current.GetService<StatusBarViewModel>()?.UpdateStatistics(update);
|
||||||
if ((update.ProxyUp + update.ProxyDown) > 0 && DateTime.Now.Second % 9 == 0)
|
|
||||||
{
|
|
||||||
Locator.Current.GetService<ProfilesViewModel>()?.UpdateStatistics(update);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch
|
if (_config.GuiItem.EnableStatistics && (update.ProxyUp + update.ProxyDown) > 0 && DateTime.Now.Second % 9 == 0)
|
||||||
{
|
{
|
||||||
|
Locator.Current.GetService<ProfilesViewModel>()?.UpdateStatistics(update);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,6 +403,7 @@ namespace ServiceLib.ViewModels
|
|||||||
public async Task AddServerViaScanAsync()
|
public async Task AddServerViaScanAsync()
|
||||||
{
|
{
|
||||||
_updateView?.Invoke(EViewAction.ScanScreenTask, null);
|
_updateView?.Invoke(EViewAction.ScanScreenTask, null);
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ScanScreenResult(byte[]? bytes)
|
public async Task ScanScreenResult(byte[]? bytes)
|
||||||
@@ -414,6 +415,7 @@ namespace ServiceLib.ViewModels
|
|||||||
public async Task AddServerViaImageAsync()
|
public async Task AddServerViaImageAsync()
|
||||||
{
|
{
|
||||||
_updateView?.Invoke(EViewAction.ScanImageTask, null);
|
_updateView?.Invoke(EViewAction.ScanImageTask, null);
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ScanImageResult(string fileName)
|
public async Task ScanImageResult(string fileName)
|
||||||
@@ -527,6 +529,7 @@ namespace ServiceLib.ViewModels
|
|||||||
{
|
{
|
||||||
ProcUtils.ProcessStart("open", path);
|
ProcUtils.ProcessStart("open", path);
|
||||||
}
|
}
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Setting
|
#endregion Setting
|
||||||
@@ -535,19 +538,33 @@ namespace ServiceLib.ViewModels
|
|||||||
|
|
||||||
public async Task Reload()
|
public async Task Reload()
|
||||||
{
|
{
|
||||||
|
//If there are unfinished reload job, marked with next job.
|
||||||
|
if (!BlReloadEnabled)
|
||||||
|
{
|
||||||
|
_hasNextReloadJob = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BlReloadEnabled = false;
|
BlReloadEnabled = false;
|
||||||
|
|
||||||
await LoadCore();
|
await LoadCore();
|
||||||
Locator.Current.GetService<StatusBarViewModel>()?.TestServerAvailability();
|
|
||||||
await SysProxyHandler.UpdateSysProxy(_config, false);
|
await SysProxyHandler.UpdateSysProxy(_config, false);
|
||||||
|
Locator.Current.GetService<StatusBarViewModel>()?.TestServerAvailability();
|
||||||
|
|
||||||
_updateView?.Invoke(EViewAction.DispatcherReload, null);
|
_updateView?.Invoke(EViewAction.DispatcherReload, null);
|
||||||
|
|
||||||
|
BlReloadEnabled = true;
|
||||||
|
if (_hasNextReloadJob)
|
||||||
|
{
|
||||||
|
_hasNextReloadJob = false;
|
||||||
|
await Reload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReloadResult()
|
public void ReloadResult()
|
||||||
{
|
{
|
||||||
|
// BlReloadEnabled = true;
|
||||||
//Locator.Current.GetService<StatusBarViewModel>()?.ChangeSystemProxyAsync(_config.systemProxyItem.sysProxyType, false);
|
//Locator.Current.GetService<StatusBarViewModel>()?.ChangeSystemProxyAsync(_config.systemProxyItem.sysProxyType, false);
|
||||||
BlReloadEnabled = true;
|
|
||||||
ShowClashUI = _config.IsRunningCore(ECoreType.sing_box);
|
ShowClashUI = _config.IsRunningCore(ECoreType.sing_box);
|
||||||
if (ShowClashUI)
|
if (ShowClashUI)
|
||||||
{
|
{
|
||||||
@@ -558,16 +575,8 @@ namespace ServiceLib.ViewModels
|
|||||||
|
|
||||||
private async Task LoadCore()
|
private async Task LoadCore()
|
||||||
{
|
{
|
||||||
//if (_config.tunModeItem.enableTun)
|
var node = await ConfigHandler.GetDefaultServer(_config);
|
||||||
//{
|
await CoreHandler.Instance.LoadCore(node);
|
||||||
// Task.Delay(1000).Wait();
|
|
||||||
// WindowsUtils.RemoveTunDevice();
|
|
||||||
//}
|
|
||||||
await Task.Run(async () =>
|
|
||||||
{
|
|
||||||
var node = await ConfigHandler.GetDefaultServer(_config);
|
|
||||||
await CoreHandler.Instance.LoadCore(node);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task CloseCore()
|
public async Task CloseCore()
|
||||||
@@ -582,6 +591,7 @@ namespace ServiceLib.ViewModels
|
|||||||
{
|
{
|
||||||
ShowHideWindow(false);
|
ShowHideWindow(false);
|
||||||
}
|
}
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion core job
|
#endregion core job
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ namespace ServiceLib.ViewModels
|
|||||||
{
|
{
|
||||||
_queueMsg.Enqueue(Environment.NewLine);
|
_queueMsg.Enqueue(Environment.NewLine);
|
||||||
}
|
}
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearMsg()
|
public void ClearMsg()
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace ServiceLib.ViewModels
|
|||||||
[Reactive] public bool AutoRun { get; set; }
|
[Reactive] public bool AutoRun { get; set; }
|
||||||
[Reactive] public bool EnableStatistics { get; set; }
|
[Reactive] public bool EnableStatistics { get; set; }
|
||||||
[Reactive] public bool KeepOlderDedupl { get; set; }
|
[Reactive] public bool KeepOlderDedupl { get; set; }
|
||||||
[Reactive] public bool IgnoreGeoUpdateCore { get; set; }
|
[Reactive] public bool DisplayRealTimeSpeed { get; set; }
|
||||||
[Reactive] public bool EnableAutoAdjustMainLvColWidth { get; set; }
|
[Reactive] public bool EnableAutoAdjustMainLvColWidth { get; set; }
|
||||||
[Reactive] public bool EnableUpdateSubOnlyRemarksExist { get; set; }
|
[Reactive] public bool EnableUpdateSubOnlyRemarksExist { get; set; }
|
||||||
[Reactive] public bool EnableSecurityProtocolTls13 { get; set; }
|
[Reactive] public bool EnableSecurityProtocolTls13 { get; set; }
|
||||||
@@ -115,7 +115,7 @@ namespace ServiceLib.ViewModels
|
|||||||
await SaveSettingAsync();
|
await SaveSettingAsync();
|
||||||
});
|
});
|
||||||
|
|
||||||
Init();
|
_ = Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Init()
|
private async Task Init()
|
||||||
@@ -164,8 +164,8 @@ namespace ServiceLib.ViewModels
|
|||||||
|
|
||||||
AutoRun = _config.GuiItem.AutoRun;
|
AutoRun = _config.GuiItem.AutoRun;
|
||||||
EnableStatistics = _config.GuiItem.EnableStatistics;
|
EnableStatistics = _config.GuiItem.EnableStatistics;
|
||||||
|
DisplayRealTimeSpeed = _config.GuiItem.DisplayRealTimeSpeed;
|
||||||
KeepOlderDedupl = _config.GuiItem.KeepOlderDedupl;
|
KeepOlderDedupl = _config.GuiItem.KeepOlderDedupl;
|
||||||
IgnoreGeoUpdateCore = _config.GuiItem.IgnoreGeoUpdateCore;
|
|
||||||
EnableAutoAdjustMainLvColWidth = _config.UiItem.EnableAutoAdjustMainLvColWidth;
|
EnableAutoAdjustMainLvColWidth = _config.UiItem.EnableAutoAdjustMainLvColWidth;
|
||||||
EnableUpdateSubOnlyRemarksExist = _config.UiItem.EnableUpdateSubOnlyRemarksExist;
|
EnableUpdateSubOnlyRemarksExist = _config.UiItem.EnableUpdateSubOnlyRemarksExist;
|
||||||
EnableSecurityProtocolTls13 = _config.GuiItem.EnableSecurityProtocolTls13;
|
EnableSecurityProtocolTls13 = _config.GuiItem.EnableSecurityProtocolTls13;
|
||||||
@@ -261,6 +261,7 @@ namespace ServiceLib.ViewModels
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SaveSettingAsync()
|
private async Task SaveSettingAsync()
|
||||||
@@ -272,6 +273,7 @@ namespace ServiceLib.ViewModels
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var needReboot = (EnableStatistics != _config.GuiItem.EnableStatistics
|
var needReboot = (EnableStatistics != _config.GuiItem.EnableStatistics
|
||||||
|
|| DisplayRealTimeSpeed != _config.GuiItem.DisplayRealTimeSpeed
|
||||||
|| EnableDragDropSort != _config.UiItem.EnableDragDropSort
|
|| EnableDragDropSort != _config.UiItem.EnableDragDropSort
|
||||||
|| EnableHWA != _config.GuiItem.EnableHWA
|
|| EnableHWA != _config.GuiItem.EnableHWA
|
||||||
|| CurrentFontFamily != _config.UiItem.CurrentFontFamily
|
|| CurrentFontFamily != _config.UiItem.CurrentFontFamily
|
||||||
@@ -317,8 +319,8 @@ namespace ServiceLib.ViewModels
|
|||||||
|
|
||||||
_config.GuiItem.AutoRun = AutoRun;
|
_config.GuiItem.AutoRun = AutoRun;
|
||||||
_config.GuiItem.EnableStatistics = EnableStatistics;
|
_config.GuiItem.EnableStatistics = EnableStatistics;
|
||||||
|
_config.GuiItem.DisplayRealTimeSpeed = DisplayRealTimeSpeed;
|
||||||
_config.GuiItem.KeepOlderDedupl = KeepOlderDedupl;
|
_config.GuiItem.KeepOlderDedupl = KeepOlderDedupl;
|
||||||
_config.GuiItem.IgnoreGeoUpdateCore = IgnoreGeoUpdateCore;
|
|
||||||
_config.UiItem.EnableAutoAdjustMainLvColWidth = EnableAutoAdjustMainLvColWidth;
|
_config.UiItem.EnableAutoAdjustMainLvColWidth = EnableAutoAdjustMainLvColWidth;
|
||||||
_config.UiItem.EnableUpdateSubOnlyRemarksExist = EnableUpdateSubOnlyRemarksExist;
|
_config.UiItem.EnableUpdateSubOnlyRemarksExist = EnableUpdateSubOnlyRemarksExist;
|
||||||
_config.GuiItem.EnableSecurityProtocolTls13 = EnableSecurityProtocolTls13;
|
_config.GuiItem.EnableSecurityProtocolTls13 = EnableSecurityProtocolTls13;
|
||||||
@@ -410,6 +412,7 @@ namespace ServiceLib.ViewModels
|
|||||||
}
|
}
|
||||||
item.CoreType = (ECoreType)Enum.Parse(typeof(ECoreType), type);
|
item.CoreType = (ECoreType)Enum.Parse(typeof(ECoreType), type);
|
||||||
}
|
}
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -231,7 +231,7 @@ namespace ServiceLib.ViewModels
|
|||||||
MessageBus.Current.Listen<string>(EMsgCommand.RefreshProfiles.ToString()).Subscribe(OnNext);
|
MessageBus.Current.Listen<string>(EMsgCommand.RefreshProfiles.ToString()).Subscribe(OnNext);
|
||||||
}
|
}
|
||||||
|
|
||||||
Init();
|
_ = Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Init()
|
private async Task Init()
|
||||||
@@ -360,7 +360,7 @@ namespace ServiceLib.ViewModels
|
|||||||
|
|
||||||
public async Task RefreshServersBiz()
|
public async Task RefreshServersBiz()
|
||||||
{
|
{
|
||||||
var lstModel = await AppHandler.Instance.ProfileItemsEx(_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)) ?? [];
|
||||||
|
|
||||||
_profileItems.Clear();
|
_profileItems.Clear();
|
||||||
@@ -399,6 +399,45 @@ namespace ServiceLib.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<List<ProfileItemModel>?> GetProfileItemsEx(string subid, string filter)
|
||||||
|
{
|
||||||
|
var lstModel = await AppHandler.Instance.ProfileItems(_config.SubIndexId, filter);
|
||||||
|
|
||||||
|
await ConfigHandler.SetDefaultServer(_config, lstModel);
|
||||||
|
|
||||||
|
var lstServerStat = (_config.GuiItem.EnableStatistics ? StatisticsHandler.Instance.ServerStat : null) ?? [];
|
||||||
|
var lstProfileExs = await ProfileExHandler.Instance.GetProfileExs();
|
||||||
|
lstModel = (from t in lstModel
|
||||||
|
join t2 in lstServerStat on t.IndexId equals t2.IndexId into t2b
|
||||||
|
from t22 in t2b.DefaultIfEmpty()
|
||||||
|
join t3 in lstProfileExs on t.IndexId equals t3.IndexId into t3b
|
||||||
|
from t33 in t3b.DefaultIfEmpty()
|
||||||
|
select new ProfileItemModel
|
||||||
|
{
|
||||||
|
IndexId = t.IndexId,
|
||||||
|
ConfigType = t.ConfigType,
|
||||||
|
Remarks = t.Remarks,
|
||||||
|
Address = t.Address,
|
||||||
|
Port = t.Port,
|
||||||
|
Security = t.Security,
|
||||||
|
Network = t.Network,
|
||||||
|
StreamSecurity = t.StreamSecurity,
|
||||||
|
Subid = t.Subid,
|
||||||
|
SubRemarks = t.SubRemarks,
|
||||||
|
IsActive = t.IndexId == _config.IndexId,
|
||||||
|
Sort = t33 == null ? 0 : t33.Sort,
|
||||||
|
Delay = t33 == null ? 0 : t33.Delay,
|
||||||
|
DelayVal = t33?.Delay != 0 ? $"{t33?.Delay} {Global.DelayUnit}" : string.Empty,
|
||||||
|
SpeedVal = t33?.Speed != 0 ? $"{t33?.Speed} {Global.SpeedUnit}" : string.Empty,
|
||||||
|
TodayDown = t22 == null ? "" : Utils.HumanFy(t22.TodayDown),
|
||||||
|
TodayUp = t22 == null ? "" : Utils.HumanFy(t22.TodayUp),
|
||||||
|
TotalDown = t22 == null ? "" : Utils.HumanFy(t22.TotalDown),
|
||||||
|
TotalUp = t22 == null ? "" : Utils.HumanFy(t22.TotalUp)
|
||||||
|
}).OrderBy(t => t.Sort).ToList();
|
||||||
|
|
||||||
|
return lstModel;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Servers && Groups
|
#endregion Servers && Groups
|
||||||
|
|
||||||
#region Add Servers
|
#region Add Servers
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ namespace ServiceLib.ViewModels
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string result = Utils.LoadResource(fileName);
|
var result = Utils.LoadResource(fileName);
|
||||||
if (Utils.IsNullOrEmpty(result))
|
if (Utils.IsNullOrEmpty(result))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace ServiceLib.ViewModels
|
|||||||
await SaveRoutingAsync();
|
await SaveRoutingAsync();
|
||||||
});
|
});
|
||||||
|
|
||||||
Init();
|
_ = Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Init()
|
private async Task Init()
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace ServiceLib.ViewModels
|
|||||||
public ReactiveCommand<Unit, Unit> AddServerViaScanCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddServerViaScanCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> SubUpdateCmd { get; }
|
public ReactiveCommand<Unit, Unit> SubUpdateCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> SubUpdateViaProxyCmd { get; }
|
public ReactiveCommand<Unit, Unit> SubUpdateViaProxyCmd { get; }
|
||||||
|
public ReactiveCommand<Unit, Unit> CopyProxyCmdToClipboardCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> NotifyLeftClickCmd { get; }
|
public ReactiveCommand<Unit, Unit> NotifyLeftClickCmd { get; }
|
||||||
|
|
||||||
#region System Proxy
|
#region System Proxy
|
||||||
@@ -128,9 +129,15 @@ namespace ServiceLib.ViewModels
|
|||||||
y => y == true)
|
y => y == true)
|
||||||
.Subscribe(async c => await DoEnableTun(c));
|
.Subscribe(async c => await DoEnableTun(c));
|
||||||
|
|
||||||
|
CopyProxyCmdToClipboardCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
|
{
|
||||||
|
await CopyProxyCmdToClipboard();
|
||||||
|
});
|
||||||
|
|
||||||
NotifyLeftClickCmd = ReactiveCommand.CreateFromTask(async () =>
|
NotifyLeftClickCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
Locator.Current.GetService<MainWindowViewModel>()?.ShowHideWindow(null);
|
Locator.Current.GetService<MainWindowViewModel>()?.ShowHideWindow(null);
|
||||||
|
await Task.CompletedTask;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddServerViaClipboardCmd = ReactiveCommand.CreateFromTask(async () =>
|
AddServerViaClipboardCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
@@ -174,7 +181,7 @@ namespace ServiceLib.ViewModels
|
|||||||
{
|
{
|
||||||
InitUpdateView(updateView);
|
InitUpdateView(updateView);
|
||||||
}
|
}
|
||||||
Init();
|
_ = Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Init()
|
private async Task Init()
|
||||||
@@ -198,6 +205,23 @@ namespace ServiceLib.ViewModels
|
|||||||
await _updateView?.Invoke(EViewAction.DispatcherRefreshServersBiz, null);
|
await _updateView?.Invoke(EViewAction.DispatcherRefreshServersBiz, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task CopyProxyCmdToClipboard()
|
||||||
|
{
|
||||||
|
var cmd = Utils.IsWindows() ? "set" : "export";
|
||||||
|
var address = $"{Global.Loopback}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks)}";
|
||||||
|
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
sb.AppendLine($"{cmd} http_proxy={Global.HttpProtocol}{address}");
|
||||||
|
sb.AppendLine($"{cmd} https_proxy={Global.HttpProtocol}{address}");
|
||||||
|
sb.AppendLine($"{cmd} all_proxy={Global.Socks5Protocol}{address}");
|
||||||
|
sb.AppendLine("");
|
||||||
|
sb.AppendLine($"{cmd} HTTP_PROXY={Global.HttpProtocol}{address}");
|
||||||
|
sb.AppendLine($"{cmd} HTTPS_PROXY={Global.HttpProtocol}{address}");
|
||||||
|
sb.AppendLine($"{cmd} ALL_PROXY={Global.Socks5Protocol}{address}");
|
||||||
|
|
||||||
|
await _updateView?.Invoke(EViewAction.SetClipboardData, sb.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
private async Task AddServerViaClipboard()
|
private async Task AddServerViaClipboard()
|
||||||
{
|
{
|
||||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
var service = Locator.Current.GetService<MainWindowViewModel>();
|
||||||
@@ -400,10 +424,12 @@ namespace ServiceLib.ViewModels
|
|||||||
Locator.Current.GetService<MainWindowViewModel>()?.RebootAsAdmin();
|
Locator.Current.GetService<MainWindowViewModel>()?.RebootAsAdmin();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//else if (Utils.IsLinux())
|
else if (Utils.IsOSX())
|
||||||
//{
|
{
|
||||||
// NoticeHandler.Instance.SendMessageAndEnqueue(ResUI.TbSettingsLinuxSudoPasswordIsEmpty);
|
_config.TunModeItem.EnableTun = false;
|
||||||
//}
|
NoticeHandler.Instance.SendMessageAndEnqueue(ResUI.TbSettingsLinuxSudoPasswordIsEmpty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await ConfigHandler.SaveConfig(_config);
|
await ConfigHandler.SaveConfig(_config);
|
||||||
Locator.Current.GetService<MainWindowViewModel>()?.Reload();
|
Locator.Current.GetService<MainWindowViewModel>()?.Reload();
|
||||||
@@ -453,12 +479,19 @@ namespace ServiceLib.ViewModels
|
|||||||
{
|
{
|
||||||
InboundLanDisplay = $"{ResUI.LabLAN}:{Global.None}";
|
InboundLanDisplay = $"{ResUI.LabLAN}:{Global.None}";
|
||||||
}
|
}
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateStatistics(ServerSpeedItem update)
|
public void UpdateStatistics(ServerSpeedItem update)
|
||||||
{
|
{
|
||||||
SpeedProxyDisplay = string.Format(ResUI.SpeedDisplayText, Global.ProxyTag, Utils.HumanFy(update.ProxyUp), Utils.HumanFy(update.ProxyDown));
|
try
|
||||||
SpeedDirectDisplay = string.Format(ResUI.SpeedDisplayText, Global.DirectTag, Utils.HumanFy(update.DirectUp), Utils.HumanFy(update.DirectDown));
|
{
|
||||||
|
SpeedProxyDisplay = string.Format(ResUI.SpeedDisplayText, Global.ProxyTag, Utils.HumanFy(update.ProxyUp), Utils.HumanFy(update.ProxyDown));
|
||||||
|
SpeedDirectDisplay = string.Format(ResUI.SpeedDisplayText, Global.DirectTag, Utils.HumanFy(update.DirectUp), Utils.HumanFy(update.DirectDown));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion UI
|
#endregion UI
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace ServiceLib.ViewModels
|
|||||||
await _updateView?.Invoke(EViewAction.ShareSub, SelectedSource?.Url);
|
await _updateView?.Invoke(EViewAction.ShareSub, SelectedSource?.Url);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
|
|
||||||
Init();
|
_ = Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Init()
|
private async Task Init()
|
||||||
|
|||||||
@@ -50,6 +50,8 @@
|
|||||||
<NativeMenuItem Command="{Binding SubUpdateCmd}" Header="{x:Static resx:ResUI.menuSubUpdate}" />
|
<NativeMenuItem Command="{Binding SubUpdateCmd}" Header="{x:Static resx:ResUI.menuSubUpdate}" />
|
||||||
<NativeMenuItem Command="{Binding SubUpdateViaProxyCmd}" Header="{x:Static resx:ResUI.menuSubUpdateViaProxy}" />
|
<NativeMenuItem Command="{Binding SubUpdateViaProxyCmd}" Header="{x:Static resx:ResUI.menuSubUpdateViaProxy}" />
|
||||||
<NativeMenuItemSeparator />
|
<NativeMenuItemSeparator />
|
||||||
|
<NativeMenuItem Command="{Binding CopyProxyCmdToClipboardCmd}" Header="{x:Static resx:ResUI.menuCopyProxyCmdToClipboard}" />
|
||||||
|
<NativeMenuItemSeparator />
|
||||||
<NativeMenuItem Command="{Binding NotifyLeftClickCmd}" Header="{x:Static resx:ResUI.menuShowOrHideMainWindow}" />
|
<NativeMenuItem Command="{Binding NotifyLeftClickCmd}" Header="{x:Static resx:ResUI.menuShowOrHideMainWindow}" />
|
||||||
<NativeMenuItem Click="MenuExit_Click" Header="{x:Static resx:ResUI.menuExit}" />
|
<NativeMenuItem Click="MenuExit_Click" Header="{x:Static resx:ResUI.menuExit}" />
|
||||||
</NativeMenu>
|
</NativeMenu>
|
||||||
|
|||||||
@@ -385,9 +385,9 @@
|
|||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Classes="Margin8"
|
Classes="Margin8"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsKeepOlderDedupl}" />
|
Text="{x:Static resx:ResUI.TbSettingsDisplayRealTimeSpeed}" />
|
||||||
<ToggleSwitch
|
<ToggleSwitch
|
||||||
x:Name="togKeepOlderDedupl"
|
x:Name="togDisplayRealTimeSpeed"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
@@ -398,9 +398,9 @@
|
|||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Classes="Margin8"
|
Classes="Margin8"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsIgnoreGeoUpdateCore}" />
|
Text="{x:Static resx:ResUI.TbSettingsKeepOlderDedupl}" />
|
||||||
<ToggleSwitch
|
<ToggleSwitch
|
||||||
x:Name="togIgnoreGeoUpdateCore"
|
x:Name="togKeepOlderDedupl"
|
||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
|
|||||||
@@ -126,8 +126,8 @@ namespace v2rayN.Desktop.Views
|
|||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.AutoRun, v => v.togAutoRun.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.AutoRun, v => v.togAutoRun.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.EnableStatistics, v => v.togEnableStatistics.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.EnableStatistics, v => v.togEnableStatistics.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.DisplayRealTimeSpeed, v => v.togDisplayRealTimeSpeed.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.IgnoreGeoUpdateCore, v => v.togIgnoreGeoUpdateCore.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.EnableSecurityProtocolTls13, v => v.togEnableSecurityProtocolTls13.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.EnableSecurityProtocolTls13, v => v.togEnableSecurityProtocolTls13.IsChecked).DisposeWith(disposables);
|
||||||
|
|||||||
@@ -123,6 +123,7 @@
|
|||||||
Classes="Margin8"
|
Classes="Margin8"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
|
|
||||||
|
<!--
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
@@ -144,6 +145,7 @@
|
|||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Classes="Margin8"
|
Classes="Margin8"
|
||||||
Content="{x:Static resx:ResUI.TbBrowse}" />
|
Content="{x:Static resx:ResUI.TbBrowse}" />
|
||||||
|
-->
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace v2rayN.Desktop.Views
|
|||||||
lstRules.SelectionChanged += lstRules_SelectionChanged;
|
lstRules.SelectionChanged += lstRules_SelectionChanged;
|
||||||
lstRules.DoubleTapped += LstRules_DoubleTapped;
|
lstRules.DoubleTapped += LstRules_DoubleTapped;
|
||||||
menuRuleSelectAll.Click += menuRuleSelectAll_Click;
|
menuRuleSelectAll.Click += menuRuleSelectAll_Click;
|
||||||
btnBrowseCustomIcon.Click += btnBrowseCustomIcon_Click;
|
//btnBrowseCustomIcon.Click += btnBrowseCustomIcon_Click;
|
||||||
btnBrowseCustomRulesetPath4Singbox.Click += btnBrowseCustomRulesetPath4Singbox_ClickAsync;
|
btnBrowseCustomRulesetPath4Singbox.Click += btnBrowseCustomRulesetPath4Singbox_ClickAsync;
|
||||||
|
|
||||||
ViewModel = new RoutingRuleSettingViewModel(routingItem, UpdateViewHandler);
|
ViewModel = new RoutingRuleSettingViewModel(routingItem, UpdateViewHandler);
|
||||||
@@ -51,7 +51,7 @@ namespace v2rayN.Desktop.Views
|
|||||||
this.Bind(ViewModel, vm => vm.SelectedRouting.DomainStrategy4Singbox, v => v.cmbdomainStrategy4Singbox.SelectedValue).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedRouting.DomainStrategy4Singbox, v => v.cmbdomainStrategy4Singbox.SelectedValue).DisposeWith(disposables);
|
||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.SelectedRouting.Url, v => v.txtUrl.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedRouting.Url, v => v.txtUrl.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedRouting.CustomIcon, v => v.txtCustomIcon.Text).DisposeWith(disposables);
|
//this.Bind(ViewModel, vm => vm.SelectedRouting.CustomIcon, v => v.txtCustomIcon.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedRouting.CustomRulesetPath4Singbox, v => v.txtCustomRulesetPath4Singbox.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedRouting.CustomRulesetPath4Singbox, v => v.txtCustomRulesetPath4Singbox.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedRouting.Sort, v => v.txtSort.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedRouting.Sort, v => v.txtSort.Text).DisposeWith(disposables);
|
||||||
|
|
||||||
@@ -179,16 +179,16 @@ namespace v2rayN.Desktop.Views
|
|||||||
lstRules.SelectAll();
|
lstRules.SelectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void btnBrowseCustomIcon_Click(object? sender, RoutedEventArgs e)
|
//private async void btnBrowseCustomIcon_Click(object? sender, RoutedEventArgs e)
|
||||||
{
|
//{
|
||||||
var fileName = await UI.OpenFileDialog(this, FilePickerFileTypes.ImagePng);
|
// var fileName = await UI.OpenFileDialog(this, FilePickerFileTypes.ImagePng);
|
||||||
if (fileName.IsNullOrEmpty())
|
// if (fileName.IsNullOrEmpty())
|
||||||
{
|
// {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
txtCustomIcon.Text = fileName;
|
// txtCustomIcon.Text = fileName;
|
||||||
}
|
//}
|
||||||
|
|
||||||
private async void btnBrowseCustomRulesetPath4Singbox_ClickAsync(object? sender, RoutedEventArgs e)
|
private async void btnBrowseCustomRulesetPath4Singbox_ClickAsync(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,73 +11,71 @@
|
|||||||
x:DataType="vms:StatusBarViewModel"
|
x:DataType="vms:StatusBarViewModel"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel Height="50">
|
<DockPanel Margin="4">
|
||||||
<DockPanel>
|
<StackPanel
|
||||||
<StackPanel
|
Margin="8,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
DockPanel.Dock="Right">
|
||||||
|
<TextBlock x:Name="txtSpeedProxyDisplay" HorizontalAlignment="Right" />
|
||||||
|
<Border Margin="1" />
|
||||||
|
<TextBlock x:Name="txtSpeedDirectDisplay" HorizontalAlignment="Right" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel
|
||||||
|
Margin="8,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
DockPanel.Dock="Left">
|
||||||
|
<TextBlock x:Name="txtInboundDisplay" />
|
||||||
|
<Border Margin="1" />
|
||||||
|
<TextBlock x:Name="txtInboundLanDisplay" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel
|
||||||
|
x:Name="spEnableTun"
|
||||||
|
Margin="8,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
DockPanel.Dock="Left"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<TextBlock
|
||||||
Margin="8,0"
|
Margin="8,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
DockPanel.Dock="Right">
|
Text="{x:Static resx:ResUI.TbEnableTunAs}" />
|
||||||
<TextBlock x:Name="txtSpeedProxyDisplay" />
|
<ToggleSwitch
|
||||||
<Border Margin="2" />
|
x:Name="togEnableTun"
|
||||||
<TextBlock x:Name="txtSpeedDirectDisplay" />
|
HorizontalAlignment="Center"
|
||||||
</StackPanel>
|
Classes="Margin8"
|
||||||
|
Theme="{DynamicResource SimpleToggleSwitch}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel
|
<StackPanel
|
||||||
|
Margin="8,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
DockPanel.Dock="Left"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<ComboBox
|
||||||
|
x:Name="cmbSystemProxy"
|
||||||
|
Width="160"
|
||||||
Margin="8,0"
|
Margin="8,0"
|
||||||
VerticalAlignment="Center"
|
ToolTip.Tip="{x:Static resx:ResUI.menuSystemproxy}">
|
||||||
DockPanel.Dock="Left">
|
<ComboBoxItem Content="{x:Static resx:ResUI.menuSystemProxyClear}" />
|
||||||
<TextBlock x:Name="txtInboundDisplay" />
|
<ComboBoxItem Content="{x:Static resx:ResUI.menuSystemProxySet}" />
|
||||||
<Border Margin="2" />
|
<ComboBoxItem Content="{x:Static resx:ResUI.menuSystemProxyNothing}" />
|
||||||
<TextBlock x:Name="txtInboundLanDisplay" />
|
</ComboBox>
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<StackPanel
|
<ComboBox
|
||||||
x:Name="spEnableTun"
|
x:Name="cmbRoutings2"
|
||||||
|
Width="160"
|
||||||
Margin="8,0"
|
Margin="8,0"
|
||||||
VerticalAlignment="Center"
|
DisplayMemberBinding="{Binding Remarks}"
|
||||||
DockPanel.Dock="Left"
|
ItemsSource="{Binding RoutingItems}"
|
||||||
Orientation="Horizontal">
|
ToolTip.Tip="{x:Static resx:ResUI.menuRouting}" />
|
||||||
<TextBlock
|
</StackPanel>
|
||||||
Margin="8,0"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Text="{x:Static resx:ResUI.TbEnableTunAs}" />
|
|
||||||
<ToggleSwitch
|
|
||||||
x:Name="togEnableTun"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Classes="Margin8"
|
|
||||||
Theme="{DynamicResource SimpleToggleSwitch}" />
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<StackPanel
|
<StackPanel Margin="8,0" VerticalAlignment="Center">
|
||||||
Margin="8,0"
|
<TextBlock x:Name="txtRunningServerDisplay" />
|
||||||
VerticalAlignment="Center"
|
<Border Margin="1" />
|
||||||
DockPanel.Dock="Left"
|
<TextBlock x:Name="txtRunningInfoDisplay" />
|
||||||
Orientation="Horizontal">
|
</StackPanel>
|
||||||
<ComboBox
|
</DockPanel>
|
||||||
x:Name="cmbSystemProxy"
|
|
||||||
Width="160"
|
|
||||||
Margin="8,0"
|
|
||||||
ToolTip.Tip="{x:Static resx:ResUI.menuSystemproxy}">
|
|
||||||
<ComboBoxItem Content="{x:Static resx:ResUI.menuSystemProxyClear}" />
|
|
||||||
<ComboBoxItem Content="{x:Static resx:ResUI.menuSystemProxySet}" />
|
|
||||||
<ComboBoxItem Content="{x:Static resx:ResUI.menuSystemProxyNothing}" />
|
|
||||||
</ComboBox>
|
|
||||||
|
|
||||||
<ComboBox
|
|
||||||
x:Name="cmbRoutings2"
|
|
||||||
Width="160"
|
|
||||||
Margin="8,0"
|
|
||||||
DisplayMemberBinding="{Binding Remarks}"
|
|
||||||
ItemsSource="{Binding RoutingItems}"
|
|
||||||
ToolTip.Tip="{x:Static resx:ResUI.menuRouting}" />
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<StackPanel Margin="8,0" VerticalAlignment="Center">
|
|
||||||
<TextBlock x:Name="txtRunningServerDisplay" />
|
|
||||||
<Border Margin="2" />
|
|
||||||
<TextBlock x:Name="txtRunningInfoDisplay" />
|
|
||||||
</StackPanel>
|
|
||||||
</DockPanel>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -69,6 +69,11 @@ namespace v2rayN.Desktop.Views
|
|||||||
},
|
},
|
||||||
DispatcherPriority.Default);
|
DispatcherPriority.Default);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EViewAction.SetClipboardData:
|
||||||
|
if (obj is null) return false;
|
||||||
|
await AvaUtils.SetClipboardData(this, (string)obj);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return await Task.FromResult(true);
|
return await Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -601,9 +601,9 @@
|
|||||||
Margin="{StaticResource Margin8}"
|
Margin="{StaticResource Margin8}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsKeepOlderDedupl}" />
|
Text="{x:Static resx:ResUI.TbSettingsDisplayRealTimeSpeed}" />
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
x:Name="togKeepOlderDedupl"
|
x:Name="togDisplayRealTimeSpeed"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="{StaticResource Margin8}"
|
Margin="{StaticResource Margin8}"
|
||||||
@@ -615,9 +615,9 @@
|
|||||||
Margin="{StaticResource Margin8}"
|
Margin="{StaticResource Margin8}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsIgnoreGeoUpdateCore}" />
|
Text="{x:Static resx:ResUI.TbSettingsKeepOlderDedupl}" />
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
x:Name="togIgnoreGeoUpdateCore"
|
x:Name="togKeepOlderDedupl"
|
||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="{StaticResource Margin8}"
|
Margin="{StaticResource Margin8}"
|
||||||
|
|||||||
@@ -136,8 +136,8 @@ namespace v2rayN.Views
|
|||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.AutoRun, v => v.togAutoRun.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.AutoRun, v => v.togAutoRun.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.EnableStatistics, v => v.togEnableStatistics.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.EnableStatistics, v => v.togEnableStatistics.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.DisplayRealTimeSpeed, v => v.togDisplayRealTimeSpeed.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.IgnoreGeoUpdateCore, v => v.togIgnoreGeoUpdateCore.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.EnableSecurityProtocolTls13, v => v.togEnableSecurityProtocolTls13.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.EnableSecurityProtocolTls13, v => v.togEnableSecurityProtocolTls13.IsChecked).DisposeWith(disposables);
|
||||||
@@ -248,7 +248,9 @@ namespace v2rayN.Views
|
|||||||
{
|
{
|
||||||
Logging.SaveLog("GetFonts", ex);
|
Logging.SaveLog("GetFonts", ex);
|
||||||
}
|
}
|
||||||
return lstFonts.OrderBy(t => t).ToList();
|
|
||||||
|
var lst = lstFonts.OrderBy(t => t).ToList();
|
||||||
|
return await Task.FromResult(lst);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClbdestOverride_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
private void ClbdestOverride_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||||
|
|||||||
@@ -15,15 +15,24 @@
|
|||||||
Style="{StaticResource ViewGlobal}"
|
Style="{StaticResource ViewGlobal}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<Grid>
|
<Grid>
|
||||||
<materialDesign:ColorZone Height="50" Mode="Standard">
|
<materialDesign:ColorZone
|
||||||
|
Height="auto"
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
Mode="Standard">
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Margin="{StaticResource MarginLeftRight8}"
|
Margin="{StaticResource MarginLeftRight8}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
DockPanel.Dock="Right">
|
DockPanel.Dock="Right">
|
||||||
<TextBlock x:Name="txtSpeedProxyDisplay" Style="{StaticResource StatusbarItem}" />
|
<TextBlock
|
||||||
<Border Margin="{StaticResource Margin4}" />
|
x:Name="txtSpeedProxyDisplay"
|
||||||
<TextBlock x:Name="txtSpeedDirectDisplay" Style="{StaticResource StatusbarItem}" />
|
HorizontalAlignment="Right"
|
||||||
|
Style="{StaticResource StatusbarItem}" />
|
||||||
|
<Border Margin="1" />
|
||||||
|
<TextBlock
|
||||||
|
x:Name="txtSpeedDirectDisplay"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Style="{StaticResource StatusbarItem}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel
|
<StackPanel
|
||||||
@@ -32,7 +41,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
DockPanel.Dock="Left">
|
DockPanel.Dock="Left">
|
||||||
<TextBlock x:Name="txtInboundDisplay" Style="{StaticResource StatusbarItem}" />
|
<TextBlock x:Name="txtInboundDisplay" Style="{StaticResource StatusbarItem}" />
|
||||||
<Border Margin="{StaticResource Margin4}" />
|
<Border Margin="1" />
|
||||||
<TextBlock x:Name="txtInboundLanDisplay" Style="{StaticResource StatusbarItem}" />
|
<TextBlock x:Name="txtInboundLanDisplay" Style="{StaticResource StatusbarItem}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
@@ -85,7 +94,7 @@
|
|||||||
|
|
||||||
<StackPanel Margin="{StaticResource MarginLeftRight8}" VerticalAlignment="Center">
|
<StackPanel Margin="{StaticResource MarginLeftRight8}" VerticalAlignment="Center">
|
||||||
<TextBlock x:Name="txtRunningServerDisplay" Style="{StaticResource StatusbarItem}" />
|
<TextBlock x:Name="txtRunningServerDisplay" Style="{StaticResource StatusbarItem}" />
|
||||||
<Border Margin="{StaticResource Margin4}" />
|
<Border Margin="1" />
|
||||||
<TextBlock x:Name="txtRunningInfoDisplay" Style="{StaticResource StatusbarItem}" />
|
<TextBlock x:Name="txtRunningInfoDisplay" Style="{StaticResource StatusbarItem}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
@@ -193,6 +202,11 @@
|
|||||||
Height="{StaticResource MenuItemHeight}"
|
Height="{StaticResource MenuItemHeight}"
|
||||||
Header="{x:Static resx:ResUI.menuSubUpdateViaProxy}" />
|
Header="{x:Static resx:ResUI.menuSubUpdateViaProxy}" />
|
||||||
<Separator />
|
<Separator />
|
||||||
|
<MenuItem
|
||||||
|
x:Name="menuCopyProxyCmdToClipboard"
|
||||||
|
Height="{StaticResource MenuItemHeight}"
|
||||||
|
Header="{x:Static resx:ResUI.menuCopyProxyCmdToClipboard}" />
|
||||||
|
<Separator />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
x:Name="menuExit"
|
x:Name="menuExit"
|
||||||
Height="{StaticResource MenuItemHeight}"
|
Height="{StaticResource MenuItemHeight}"
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ namespace v2rayN.Views
|
|||||||
this.BindCommand(ViewModel, vm => vm.SubUpdateCmd, v => v.menuSubUpdate2).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SubUpdateCmd, v => v.menuSubUpdate2).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.SubUpdateViaProxyCmd, v => v.menuSubUpdateViaProxy2).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SubUpdateViaProxyCmd, v => v.menuSubUpdateViaProxy2).DisposeWith(disposables);
|
||||||
|
|
||||||
|
this.BindCommand(ViewModel, vm => vm.CopyProxyCmdToClipboardCmd, v => v.menuCopyProxyCmdToClipboard).DisposeWith(disposables);
|
||||||
|
|
||||||
this.OneWayBind(ViewModel, vm => vm.RunningServerToolTipText, v => v.tbNotify.ToolTipText).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.RunningServerToolTipText, v => v.tbNotify.ToolTipText).DisposeWith(disposables);
|
||||||
this.OneWayBind(ViewModel, vm => vm.NotifyLeftClickCmd, v => v.tbNotify.LeftClickCommand).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.NotifyLeftClickCmd, v => v.tbNotify.LeftClickCommand).DisposeWith(disposables);
|
||||||
|
|
||||||
@@ -96,6 +98,10 @@ namespace v2rayN.Views
|
|||||||
Application.Current.MainWindow.Icon = WindowsHandler.Instance.GetAppIcon(_config);
|
Application.Current.MainWindow.Icon = WindowsHandler.Instance.GetAppIcon(_config);
|
||||||
}), DispatcherPriority.Normal);
|
}), DispatcherPriority.Normal);
|
||||||
break;
|
break;
|
||||||
|
case EViewAction.SetClipboardData:
|
||||||
|
if (obj is null) return false;
|
||||||
|
WindowsUtils.SetClipboardData((string)obj);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return await Task.FromResult(true);
|
return await Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user