mirror of
https://github.com/2dust/v2rayN.git
synced 2026-03-06 08:03:18 +00:00
Compare commits
5 commits
5732b84a7b
...
3cc75cd46d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3cc75cd46d | ||
|
|
f809ee7b20 | ||
|
|
1295d8191c | ||
|
|
bc2adbfa77 | ||
|
|
9583dff176 |
15 changed files with 104 additions and 63 deletions
3
.github/workflows/build-linux.yml
vendored
3
.github/workflows/build-linux.yml
vendored
|
|
@ -73,4 +73,5 @@ jobs:
|
||||||
with:
|
with:
|
||||||
file: ${{ github.workspace }}/v2rayN*.zip
|
file: ${{ github.workspace }}/v2rayN*.zip
|
||||||
tag: ${{ github.event.inputs.release_tag }}
|
tag: ${{ github.event.inputs.release_tag }}
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
prerelease: true
|
||||||
3
.github/workflows/build-osx.yml
vendored
3
.github/workflows/build-osx.yml
vendored
|
|
@ -74,4 +74,5 @@ jobs:
|
||||||
with:
|
with:
|
||||||
file: ${{ github.workspace }}/v2rayN*.zip
|
file: ${{ github.workspace }}/v2rayN*.zip
|
||||||
tag: ${{ github.event.inputs.release_tag }}
|
tag: ${{ github.event.inputs.release_tag }}
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
prerelease: true
|
||||||
3
.github/workflows/build-windows.yml
vendored
3
.github/workflows/build-windows.yml
vendored
|
|
@ -64,4 +64,5 @@ jobs:
|
||||||
with:
|
with:
|
||||||
file: ${{ github.workspace }}/v2rayN*.zip
|
file: ${{ github.workspace }}/v2rayN*.zip
|
||||||
tag: ${{ github.event.inputs.release_tag }}
|
tag: ${{ github.event.inputs.release_tag }}
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
prerelease: true
|
||||||
|
|
@ -11,16 +11,16 @@ echo "When this file exists, app will not store configs under this folder" > "$P
|
||||||
chmod +x "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN"
|
chmod +x "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN"
|
||||||
|
|
||||||
mkdir -p "$PackagePath/icons.iconset"
|
mkdir -p "$PackagePath/icons.iconset"
|
||||||
sips -z 16 16 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_16x16.png"
|
sips -z 16 16 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_16x16.png"
|
||||||
sips -z 32 32 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_16x16@2x.png"
|
sips -z 32 32 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_16x16@2x.png"
|
||||||
sips -z 32 32 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_32x32.png"
|
sips -z 32 32 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_32x32.png"
|
||||||
sips -z 64 64 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_32x32@2x.png"
|
sips -z 64 64 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_32x32@2x.png"
|
||||||
sips -z 128 128 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_128x128.png"
|
sips -z 128 128 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_128x128.png"
|
||||||
sips -z 256 256 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_128x128@2x.png"
|
sips -z 256 256 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_128x128@2x.png"
|
||||||
sips -z 256 256 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_256x256.png"
|
sips -z 256 256 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_256x256.png"
|
||||||
sips -z 512 512 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_256x256@2x.png"
|
sips -z 512 512 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_256x256@2x.png"
|
||||||
sips -z 512 512 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_512x512.png"
|
sips -z 512 512 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_512x512.png"
|
||||||
sips -z 1024 1024 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_512x512@2x.png"
|
sips -z 1024 1024 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_512x512@2x.png"
|
||||||
iconutil -c icns "$PackagePath/icons.iconset" -o "$PackagePath/v2rayN.app/Contents/Resources/AppIcon.icns"
|
iconutil -c icns "$PackagePath/icons.iconset" -o "$PackagePath/v2rayN.app/Contents/Resources/AppIcon.icns"
|
||||||
|
|
||||||
cat >"$PackagePath/v2rayN.app/Contents/Info.plist" <<-EOF
|
cat >"$PackagePath/v2rayN.app/Contents/Info.plist" <<-EOF
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,15 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var fileName = Uri.UnescapeDataString(string.Join(" ", args));
|
var argData = Uri.UnescapeDataString(string.Join(" ", args));
|
||||||
UpgradeApp.Upgrade(fileName);
|
if (argData.Equals("rebootas"))
|
||||||
|
{
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
Utils.StartV2RayN();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpgradeApp.Upgrade(argData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -21,11 +21,11 @@ namespace AmazTool
|
||||||
Console.WriteLine(Resx.Resource.TryTerminateProcess);
|
Console.WriteLine(Resx.Resource.TryTerminateProcess);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var existing = Process.GetProcessesByName(V2rayN);
|
var existing = Process.GetProcessesByName(Utils.V2rayN);
|
||||||
foreach (var pp in existing)
|
foreach (var pp in existing)
|
||||||
{
|
{
|
||||||
var path = pp.MainModule?.FileName ?? "";
|
var path = pp.MainModule?.FileName ?? "";
|
||||||
if (path.StartsWith(GetPath(V2rayN)))
|
if (path.StartsWith(Utils.GetPath(Utils.V2rayN)))
|
||||||
{
|
{
|
||||||
pp?.Kill();
|
pp?.Kill();
|
||||||
pp?.WaitForExit(1000);
|
pp?.WaitForExit(1000);
|
||||||
|
|
@ -42,7 +42,7 @@ namespace AmazTool
|
||||||
StringBuilder sb = new();
|
StringBuilder sb = new();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string thisAppOldFile = $"{GetExePath()}.tmp";
|
string thisAppOldFile = $"{Utils.GetExePath()}.tmp";
|
||||||
File.Delete(thisAppOldFile);
|
File.Delete(thisAppOldFile);
|
||||||
string splitKey = "/";
|
string splitKey = "/";
|
||||||
|
|
||||||
|
|
@ -62,12 +62,12 @@ namespace AmazTool
|
||||||
if (lst.Length == 1) continue;
|
if (lst.Length == 1) continue;
|
||||||
string fullName = string.Join(splitKey, lst[1..lst.Length]);
|
string fullName = string.Join(splitKey, lst[1..lst.Length]);
|
||||||
|
|
||||||
if (string.Equals(GetExePath(), GetPath(fullName), StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(Utils.GetExePath(), Utils.GetPath(fullName), StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
File.Move(GetExePath(), thisAppOldFile);
|
File.Move(Utils.GetExePath(), thisAppOldFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
string entryOutputPath = GetPath(fullName);
|
string entryOutputPath = Utils.GetPath(fullName);
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(entryOutputPath)!);
|
Directory.CreateDirectory(Path.GetDirectoryName(entryOutputPath)!);
|
||||||
entry.ExtractToFile(entryOutputPath, true);
|
entry.ExtractToFile(entryOutputPath, true);
|
||||||
|
|
||||||
|
|
@ -92,39 +92,11 @@ namespace AmazTool
|
||||||
|
|
||||||
Console.WriteLine(Resx.Resource.Restartv2rayN);
|
Console.WriteLine(Resx.Resource.Restartv2rayN);
|
||||||
Waiting(2);
|
Waiting(2);
|
||||||
Process process = new()
|
|
||||||
{
|
Utils.StartV2RayN();
|
||||||
StartInfo = new()
|
|
||||||
{
|
|
||||||
UseShellExecute = true,
|
|
||||||
FileName = V2rayN,
|
|
||||||
WorkingDirectory = StartupPath()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
process.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetExePath()
|
public static void Waiting(int second)
|
||||||
{
|
|
||||||
return Environment.ProcessPath ?? Process.GetCurrentProcess().MainModule?.FileName ?? string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string StartupPath()
|
|
||||||
{
|
|
||||||
return AppDomain.CurrentDomain.BaseDirectory;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string GetPath(string fileName)
|
|
||||||
{
|
|
||||||
string startupPath = StartupPath();
|
|
||||||
if (string.IsNullOrEmpty(fileName))
|
|
||||||
{
|
|
||||||
return startupPath;
|
|
||||||
}
|
|
||||||
return Path.Combine(startupPath, fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Waiting(int second)
|
|
||||||
{
|
{
|
||||||
for (var i = second; i > 0; i--)
|
for (var i = second; i > 0; i--)
|
||||||
{
|
{
|
||||||
|
|
@ -132,7 +104,5 @@ namespace AmazTool
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string V2rayN => "v2rayN";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
43
v2rayN/AmazTool/Utils.cs
Normal file
43
v2rayN/AmazTool/Utils.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace AmazTool
|
||||||
|
{
|
||||||
|
internal class Utils
|
||||||
|
{
|
||||||
|
public static string GetExePath()
|
||||||
|
{
|
||||||
|
return Environment.ProcessPath ?? Process.GetCurrentProcess().MainModule?.FileName ?? string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string StartupPath()
|
||||||
|
{
|
||||||
|
return AppDomain.CurrentDomain.BaseDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetPath(string fileName)
|
||||||
|
{
|
||||||
|
string startupPath = StartupPath();
|
||||||
|
if (string.IsNullOrEmpty(fileName))
|
||||||
|
{
|
||||||
|
return startupPath;
|
||||||
|
}
|
||||||
|
return Path.Combine(startupPath, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string V2rayN => "v2rayN";
|
||||||
|
|
||||||
|
public static void StartV2RayN()
|
||||||
|
{
|
||||||
|
Process process = new()
|
||||||
|
{
|
||||||
|
StartInfo = new()
|
||||||
|
{
|
||||||
|
UseShellExecute = true,
|
||||||
|
FileName = V2rayN,
|
||||||
|
WorkingDirectory = StartupPath()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
process.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -517,10 +517,10 @@ namespace ServiceLib.Common
|
||||||
|
|
||||||
#region 杂项
|
#region 杂项
|
||||||
|
|
||||||
public static bool UpgradeAppExists(out string fileName)
|
public static bool UpgradeAppExists(out string upgradeFileName)
|
||||||
{
|
{
|
||||||
fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, GetExeName("AmazTool"));
|
upgradeFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, GetExeName("AmazTool"));
|
||||||
return File.Exists(fileName);
|
return File.Exists(upgradeFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@ namespace ServiceLib.Handler
|
||||||
{
|
{
|
||||||
if (it.CoreType == ECoreType.v2rayN)
|
if (it.CoreType == ECoreType.v2rayN)
|
||||||
{
|
{
|
||||||
if (Utils.UpgradeAppExists(out var fileName))
|
if (Utils.UpgradeAppExists(out var upgradeFileName))
|
||||||
{
|
{
|
||||||
await Utils.SetLinuxChmod(fileName);
|
await Utils.SetLinuxChmod(upgradeFileName);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,15 @@
|
||||||
"proxy.example.com": "127.0.0.1"
|
"proxy.example.com": "127.0.0.1"
|
||||||
},
|
},
|
||||||
"servers": [
|
"servers": [
|
||||||
|
{
|
||||||
|
"address": "1.1.1.1",
|
||||||
|
"domains": [
|
||||||
|
"geosite:geolocation-!cn"
|
||||||
|
],
|
||||||
|
"expectIPs": [
|
||||||
|
"geoip:!cn"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"address": "223.5.5.5",
|
"address": "223.5.5.5",
|
||||||
"domains": [
|
"domains": [
|
||||||
|
|
@ -13,7 +22,6 @@
|
||||||
"geoip:cn"
|
"geoip:cn"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"1.1.1.1",
|
|
||||||
"8.8.8.8",
|
"8.8.8.8",
|
||||||
"https://dns.google/dns-query"
|
"https://dns.google/dns-query"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Version>7.5.1</Version>
|
<Version>7.5.2</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,13 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
ProcUtils.RebootAsAdmin(false);
|
ProcUtils.RebootAsAdmin(false);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Utils.UpgradeAppExists(out var upgradeFileName))
|
||||||
|
{
|
||||||
|
ProcUtils.ProcessStart(upgradeFileName, Global.RebootAs, Utils.StartupPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
service?.Shutdown();
|
service?.Shutdown();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -310,14 +310,14 @@ namespace ServiceLib.ViewModels
|
||||||
|
|
||||||
public async Task UpgradeApp(string arg)
|
public async Task UpgradeApp(string arg)
|
||||||
{
|
{
|
||||||
if (!Utils.UpgradeAppExists(out var fileName))
|
if (!Utils.UpgradeAppExists(out var upgradeFileName))
|
||||||
{
|
{
|
||||||
NoticeHandler.Instance.SendMessageAndEnqueue(ResUI.UpgradeAppNotExistTip);
|
NoticeHandler.Instance.SendMessageAndEnqueue(ResUI.UpgradeAppNotExistTip);
|
||||||
Logging.SaveLog("UpgradeApp does not exist");
|
Logging.SaveLog("UpgradeApp does not exist");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var id = ProcUtils.ProcessStart(fileName, arg, Utils.StartupPath());
|
var id = ProcUtils.ProcessStart(upgradeFileName, arg, Utils.StartupPath());
|
||||||
if (id > 0)
|
if (id > 0)
|
||||||
{
|
{
|
||||||
await MyAppExitAsync(false);
|
await MyAppExitAsync(false);
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,9 @@
|
||||||
<None Update="v2rayN.png">
|
<None Update="v2rayN.png">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Update="v2rayN2.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
BIN
v2rayN/v2rayN.Desktop/v2rayN2.png
Normal file
BIN
v2rayN/v2rayN.Desktop/v2rayN2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Loading…
Reference in a new issue