diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index cbc0e9b5..3afc1288 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -48,16 +48,18 @@ jobs: env: GITHUB_TOKEN: '${{ secrets.ACTIONS_TOKEN }}' with: - tag_name: v1.1.1.3 - release_name: v1.1.1.3.${{ steps.date.outputs.today }} + tag_name: v1.1.2.1 + release_name: v1.1.2.1.${{ steps.date.outputs.today }} draft: false prerelease: false body: | 1. 更新配置同步方式,以版本同步 - 2. 增加设备列表搜索,按 设备名/设备IP/虚拟网卡IP/端口转发端口和IP 搜索 - 3. 新增端口转发配置复制,可以将A转发到B的配置复制给C转发到B - 4. 新增服务器代理穿透配置复制 - 5. 请更新服务端 + 2. 设备列表搜索,按 设备名/设备IP/虚拟网卡IP/端口转发端口和IP 搜索 + 3. 端口转发配置复制,可以将A转发到B的配置复制给C转发到B + 4. 服务器代理穿透配置复制 + 5. 修复虚拟网卡添加路由错误 + 6. 自动更新,管理所有客户端更新 + 7. 请更新服务端 - name: upload win x64 id: upload-win-x64 diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml index 1e04becd..6d2444c1 100644 --- a/.github/workflows/nuget.yml +++ b/.github/workflows/nuget.yml @@ -36,5 +36,5 @@ jobs: - name: Push run: | - nuget push ./linker.tunnel/bin/release/linker.tunnel.1.1.1.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol - nuget push ./linker.libs/bin/release/linker.libs.1.1.1.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol + nuget push ./linker.tunnel/bin/release/linker.tunnel.1.1.2.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol + nuget push ./linker.libs/bin/release/linker.libs.1.1.2.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol diff --git a/.workflow/branch-pipeline.yml b/.workflow/branch-pipeline.yml deleted file mode 100644 index 9d2a2926..00000000 --- a/.workflow/branch-pipeline.yml +++ /dev/null @@ -1,53 +0,0 @@ -version: '1.0' -name: branch-pipeline -displayName: BranchPipeline -stages: - - stage: - name: compile - displayName: 编译 - steps: - - step: build@maven - name: build_maven - displayName: Maven 构建 - # 支持6、7、8、9、10、11六个版本 - jdkVersion: 8 - # 支持2.2.1、3.2.5、3.3.9、3.5.2、3.5.3、3.5.4、3.6.1、3.6.3八个版本 - mavenVersion: 3.3.9 - # 构建命令 - commands: - - mvn -B clean package -Dmaven.test.skip=true - # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除 - artifacts: - # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址 - - name: BUILD_ARTIFACT - # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径,如通常jar包在target目录下。当前目录为代码库根目录 - path: - - ./target - - step: publish@general_artifacts - name: publish_general_artifacts - displayName: 上传制品 - # 上游构建任务定义的产物名,默认BUILD_ARTIFACT - dependArtifact: BUILD_ARTIFACT - # 上传到制品库时的制品命名,默认output - artifactName: output - dependsOn: build_maven - - stage: - name: release - displayName: 发布 - steps: - - step: publish@release_artifacts - name: publish_release_artifacts - displayName: '发布' - # 上游上传制品任务的产出 - dependArtifact: output - # 发布制品版本号 - version: '1.0.0.0' - # 是否开启版本号自增,默认开启 - autoIncrement: true -triggers: - push: - branches: - exclude: - - master - include: - - .* diff --git a/.workflow/master-pipeline.yml b/.workflow/master-pipeline.yml deleted file mode 100644 index 5d926c26..00000000 --- a/.workflow/master-pipeline.yml +++ /dev/null @@ -1,51 +0,0 @@ -version: '1.0' -name: master-pipeline -displayName: MasterPipeline -stages: - - stage: - name: compile - displayName: 编译 - steps: - - step: build@maven - name: build_maven - displayName: Maven 构建 - # 支持6、7、8、9、10、11六个版本 - jdkVersion: 8 - # 支持2.2.1、3.2.5、3.3.9、3.5.2、3.5.3、3.5.4、3.6.1、3.6.3八个版本 - mavenVersion: 3.3.9 - # 构建命令 - commands: - - mvn -B clean package -Dmaven.test.skip=true - # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除 - artifacts: - # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址 - - name: BUILD_ARTIFACT - # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径,如通常jar包在target目录下。当前目录为代码库根目录 - path: - - ./target - - step: publish@general_artifacts - name: publish_general_artifacts - displayName: 上传制品 - # 上游构建任务定义的产物名,默认BUILD_ARTIFACT - dependArtifact: BUILD_ARTIFACT - # 上传到制品库时的制品命名,默认output - artifactName: output - dependsOn: build_maven - - stage: - name: release - displayName: 发布 - steps: - - step: publish@release_artifacts - name: publish_release_artifacts - displayName: '发布' - # 上游上传制品任务的产出 - dependArtifact: output - # 发布制品版本号 - version: '1.0.0.0' - # 是否开启版本号自增,默认开启 - autoIncrement: true -triggers: - push: - branches: - include: - - master diff --git a/.workflow/pr-pipeline.yml b/.workflow/pr-pipeline.yml deleted file mode 100644 index 3f7579dd..00000000 --- a/.workflow/pr-pipeline.yml +++ /dev/null @@ -1,40 +0,0 @@ -version: '1.0' -name: pr-pipeline -displayName: PRPipeline -stages: - - stage: - name: compile - displayName: 编译 - steps: - - step: build@maven - name: build_maven - displayName: Maven 构建 - # 支持6、7、8、9、10、11六个版本 - jdkVersion: 8 - # 支持2.2.1、3.2.5、3.3.9、3.5.2、3.5.3、3.5.4、3.6.1、3.6.3八个版本 - mavenVersion: 3.3.9 - # 构建命令 - commands: - - mvn -B clean package -Dmaven.test.skip=true - # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除 - artifacts: - # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址 - - name: BUILD_ARTIFACT - # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径,如通常jar包在target目录下。当前目录为代码库根目录 - path: - - ./target - - step: publish@general_artifacts - name: publish_general_artifacts - displayName: 上传制品 - # 上游构建任务定义的产物名,默认BUILD_ARTIFACT - dependArtifact: BUILD_ARTIFACT - # 构建产物制品库,默认default,系统默认创建 - artifactRepository: default - # 上传到制品库时的制品命名,默认output - artifactName: output - dependsOn: build_maven -triggers: - pr: - branches: - include: - - master diff --git a/linker.doc.web/docs/6、发布.md b/linker.doc.web/docs/6、发布.md new file mode 100644 index 00000000..a69a88ce --- /dev/null +++ b/linker.doc.web/docs/6、发布.md @@ -0,0 +1,13 @@ +--- +sidebar_position: 6 +--- + +# 6、发布 + +你可以自己发布项目,因为涉及到很多内容,所以建议使用脚本发布 + +1. 安装 Nodejs https://nodejs.org/en/download/package-manager +2. 安装 .NET8.0 SDK https://dotnet.microsoft.com/zh-cn/download 或者安装 vs2022 https://visualstudio.microsoft.com/zh-hans/vs/ +3. 发布项目自动压缩,所以你需要安装 7zip https://www.7-zip.org/ +4. 在`cmd`或者`PowerShell`下运行根目录下`publish.bat`,等待发布完成 +5. 发布完成后,在根目录下,`public`>`publish` 和 `public`>`publish-zip` \ No newline at end of file diff --git a/linker.doc.web/docs/6、集成打洞到你的项目.md b/linker.doc.web/docs/7、集成打洞到你的项目.md similarity index 97% rename from linker.doc.web/docs/6、集成打洞到你的项目.md rename to linker.doc.web/docs/7、集成打洞到你的项目.md index 476d98d3..368f4e40 100644 --- a/linker.doc.web/docs/6、集成打洞到你的项目.md +++ b/linker.doc.web/docs/7、集成打洞到你的项目.md @@ -1,8 +1,8 @@ --- -sidebar_position: 6 +sidebar_position: 7 --- -# 6、集成打洞到你的项目 +# 7、集成打洞到你的项目 你需要自己实现信标服务器,用于交换打洞信息 diff --git a/linker.libs/linker.libs.csproj b/linker.libs/linker.libs.csproj index 5187cd3a..569cef09 100644 --- a/linker.libs/linker.libs.csproj +++ b/linker.libs/linker.libs.csproj @@ -14,9 +14,9 @@ snltty https://github.com/snltty/linker https://github.com/snltty/linker - 1.1.1 - 1.1.1.3 - 1.1.1.3 + 1.1.2 + 1.1.2.1 + 1.1.2.1 full diff --git a/linker.service/linker.service.csproj b/linker.service/linker.service.csproj index 4b3ef81b..8bd5771f 100644 --- a/linker.service/linker.service.csproj +++ b/linker.service/linker.service.csproj @@ -14,7 +14,7 @@ false true true - 1.1.1 + 1.1.2 snltty snltty snltty @@ -22,8 +22,8 @@ https://github.com/snltty/linker https://github.com/snltty/linker snltty service - 1.1.1.3 - 1.1.1.3 + 1.1.2.1 + 1.1.2.1 diff --git a/linker.sln b/linker.sln index 7926db8b..2d2273fc 100644 --- a/linker.sln +++ b/linker.sln @@ -13,8 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "linker.service", "linker.se EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "linker.tunnel", "linker.tunnel\linker.tunnel.csproj", "{AFADE8D6-AB00-456B-9F43-53BC95B7B608}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "linker.updater", "linker.updater\linker.updater.csproj", "{B7E2B873-C96E-4F3E-9411-D8D549F4D3A5}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -85,18 +83,6 @@ Global {AFADE8D6-AB00-456B-9F43-53BC95B7B608}.Release|x64.Build.0 = Release|Any CPU {AFADE8D6-AB00-456B-9F43-53BC95B7B608}.Release|x86.ActiveCfg = Release|Any CPU {AFADE8D6-AB00-456B-9F43-53BC95B7B608}.Release|x86.Build.0 = Release|Any CPU - {B7E2B873-C96E-4F3E-9411-D8D549F4D3A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B7E2B873-C96E-4F3E-9411-D8D549F4D3A5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B7E2B873-C96E-4F3E-9411-D8D549F4D3A5}.Debug|x64.ActiveCfg = Debug|Any CPU - {B7E2B873-C96E-4F3E-9411-D8D549F4D3A5}.Debug|x64.Build.0 = Debug|Any CPU - {B7E2B873-C96E-4F3E-9411-D8D549F4D3A5}.Debug|x86.ActiveCfg = Debug|Any CPU - {B7E2B873-C96E-4F3E-9411-D8D549F4D3A5}.Debug|x86.Build.0 = Debug|Any CPU - {B7E2B873-C96E-4F3E-9411-D8D549F4D3A5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B7E2B873-C96E-4F3E-9411-D8D549F4D3A5}.Release|Any CPU.Build.0 = Release|Any CPU - {B7E2B873-C96E-4F3E-9411-D8D549F4D3A5}.Release|x64.ActiveCfg = Release|Any CPU - {B7E2B873-C96E-4F3E-9411-D8D549F4D3A5}.Release|x64.Build.0 = Release|Any CPU - {B7E2B873-C96E-4F3E-9411-D8D549F4D3A5}.Release|x86.ActiveCfg = Release|Any CPU - {B7E2B873-C96E-4F3E-9411-D8D549F4D3A5}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/linker.tunnel/linker.tunnel.csproj b/linker.tunnel/linker.tunnel.csproj index f80f4a5d..40128bd1 100644 --- a/linker.tunnel/linker.tunnel.csproj +++ b/linker.tunnel/linker.tunnel.csproj @@ -9,7 +9,7 @@ true true linker tunnel - 1.1.1 + 1.1.2 snltty snltty linker tunnel @@ -17,8 +17,8 @@ https://github.com/snltty/linker https://github.com/snltty/linker linker tunnel - 1.1.1.3 - 1.1.1.3 + 1.1.2.1 + 1.1.2.1 diff --git a/linker.updater/Program.cs b/linker.updater/Program.cs deleted file mode 100644 index 5dd57cd4..00000000 --- a/linker.updater/Program.cs +++ /dev/null @@ -1,256 +0,0 @@ -using Fizzler.Systems.HtmlAgilityPack; -using HtmlAgilityPack; -using linker.libs; -using System.Diagnostics; -using System.IO.Compression; -using System.Runtime.InteropServices; -using System.Text; - -namespace linker.updater -{ - internal class Program - { - static async Task Main(string[] args) - { - if (args.Length > 0) - { - rootPath = args[0]; - } - Updater(); - await Helper.Await(); - } - - static string rootPath = "./updater"; - static void Updater() - { - Task.Factory.StartNew(async () => - { - while (true) - { - try - { - UpdateInfo updateInfo = GetUpdateInfo(); - if (updateInfo != null) - { - if (NeedDownload()) - { - await DownloadUpdate(updateInfo); - } - } - } - catch (Exception) - { - } - try - { - if (NeedExtract()) - { - ExtractUpdate(); - } - } - catch (Exception) - { - } - - await Task.Delay(15000); - } - - - }, TaskCreationOptions.LongRunning); - } - - static bool NeedExtract() - { - try - { - return File.Exists(Path.Join(rootPath, "updater.zip")) && File.Exists(Path.Join(rootPath, "extract.txt")); - } - catch (Exception) - { - } - return false; - } - static void ExtractUpdate() - { - try - { - string[] command = File.ReadAllText(Path.Join(rootPath, "extract.txt")).Split(Environment.NewLine); - CommandHelper.Execute(string.Empty, new string[] { command[0] }); - - ZipFile.ExtractToDirectory(Path.Join(rootPath, "updater.zip"), Path.Join(rootPath, "../"), Encoding.UTF8, true); - - File.Delete(Path.Join(rootPath, "extract.txt")); - File.Delete(Path.Join(rootPath, "updater.zip")); - - CommandHelper.Execute(string.Empty, new string[] { command[1] }); - } - catch (Exception) - { - } - } - - static bool NeedDownload() - { - try - { - return File.Exists(Path.Join(rootPath, "extract.txt")); - } - catch (Exception) - { - } - return false; - } - static async Task DownloadUpdate(UpdateInfo updateInfo) - { - try - { - if (Directory.Exists(rootPath) == false) - { - Directory.CreateDirectory(rootPath); - } - - using FileStream fileStream = new FileStream(Path.Join(rootPath, "updater.zip"), FileMode.OpenOrCreate, FileAccess.ReadWrite); - using HttpClient httpClient = new HttpClient(); - using Stream stream = await httpClient.GetStreamAsync(updateInfo.Url); - await stream.CopyToAsync(fileStream); - - fileStream.Flush(); - fileStream.Close(); - fileStream.Dispose(); - } - catch (Exception) - { - } - } - - static UpdateInfo GetUpdateInfo() - { - try - { - using HttpClient httpClient = new HttpClient(); - string str = httpClient.GetStringAsync("http://gh.snltty.com:1808/https://github.com/snltty/linker/releases/latest").Result; - HtmlDocument hdc = new HtmlDocument(); - hdc.LoadHtml(str); - string tag = hdc.DocumentNode.QuerySelector("span.css-truncate-target span").InnerText.Trim(); - - str = httpClient.GetStringAsync($"http://gh.snltty.com:1808/https://github.com/snltty/linker/releases/expanded_assets/{tag}").Result; - HtmlDocument hdc1 = new HtmlDocument(); - hdc1.LoadHtml(str); - string msg = hdc.DocumentNode.QuerySelector(".markdown-body").InnerText.Trim(); - - string system = OperatingSystem.IsWindows() ? "win" : OperatingSystem.IsLinux() ? "linux" : "osx"; - string arch = RuntimeInformation.ProcessArchitecture.ToString().ToLower(); - string zip = $"linker-{system}-{arch}.zip"; - var a = hdc1.DocumentNode.QuerySelectorAll("a").FirstOrDefault(c => c.InnerText.Trim() == zip); - - - File.WriteAllText(Path.Join(rootPath, "version.txt"), tag); - File.WriteAllText(Path.Join(rootPath, "msg.txt"), msg); - - return new UpdateInfo - { - Msg = msg, - Version = tag, - Url = $"http://gh.snltty.com:1808/https://github.com{a.GetAttributeValue("href", "").Trim()}" - }; - } - catch (Exception) - { - } - return null; - } - sealed class UpdateInfo - { - public string Version { get; set; } - public string Msg { get; set; } - public string Url { get; set; } - } - } - - - public sealed class CommandHelper - { - - public static string Execute(string arg, string[] commands, bool readResult = true) - { - if (OperatingSystem.IsWindows()) - { - return Windows(arg, commands, readResult); - } - else if (OperatingSystem.IsLinux()) - { - return Linux(arg, commands, readResult); - } - return Osx(arg, commands, readResult); - } - public static string Windows(string arg, string[] commands, bool readResult = true) - { - return Execute("cmd.exe", arg, commands, readResult); - } - public static string Linux(string arg, string[] commands, bool readResult = true) - { - return Execute("/bin/bash", arg, commands, readResult); - } - public static string Osx(string arg, string[] commands, bool readResult = true) - { - return Execute("/bin/bash", arg, commands, readResult); - } - - public static Process Execute(string fileName, string arg) - { - Process proc = new Process(); - proc.StartInfo.CreateNoWindow = true; - proc.StartInfo.FileName = fileName; - proc.StartInfo.UseShellExecute = false; - proc.StartInfo.RedirectStandardError = true; - proc.StartInfo.RedirectStandardInput = true; - proc.StartInfo.RedirectStandardOutput = true; - proc.StartInfo.Arguments = arg; - proc.StartInfo.Verb = "runas"; - proc.Start(); - - //Process proc = Process.Start(fileName, arg); - return proc; - } - - public static string Execute(string fileName, string arg, string[] commands, bool readResult = true) - { - using Process proc = new Process(); - proc.StartInfo.WorkingDirectory = Path.GetFullPath(Path.Join("./")); - proc.StartInfo.CreateNoWindow = true; - proc.StartInfo.FileName = fileName; - proc.StartInfo.UseShellExecute = false; - proc.StartInfo.RedirectStandardError = true; - proc.StartInfo.RedirectStandardInput = true; - proc.StartInfo.RedirectStandardOutput = true; - proc.StartInfo.Arguments = arg; - proc.StartInfo.Verb = "runas"; - proc.Start(); - - if (commands.Length > 0) - { - for (int i = 0; i < commands.Length; i++) - { - proc.StandardInput.WriteLine(commands[i]); - } - } - proc.StandardInput.AutoFlush = true; - if (readResult) - { - proc.StandardInput.WriteLine("exit"); - proc.StandardInput.Close(); - string output = proc.StandardOutput.ReadToEnd(); - string error = proc.StandardError.ReadToEnd(); - proc.WaitForExit(); - proc.Close(); - proc.Dispose(); - - return output; - } - proc.StandardOutput.Read(); - proc.Close(); - proc.Dispose(); - return string.Empty; - } - } -} diff --git a/linker.updater/app.manifest b/linker.updater/app.manifest deleted file mode 100644 index fd401142..00000000 --- a/linker.updater/app.manifest +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/linker.updater/favicon.ico b/linker.updater/favicon.ico deleted file mode 100644 index fce64be6..00000000 Binary files a/linker.updater/favicon.ico and /dev/null differ diff --git a/linker.updater/linker.updater.csproj b/linker.updater/linker.updater.csproj deleted file mode 100644 index 8851a610..00000000 --- a/linker.updater/linker.updater.csproj +++ /dev/null @@ -1,50 +0,0 @@ - - - - Exe - net8.0 - enable - disable - true - true - Debug;Release - Linux - false - true - true - 1.1.1 - snltty - snltty - snltty - snltty - https://github.com/snltty/linker - https://github.com/snltty/linker - snltty updater - 1.1.1.3 - 1.1.1.3 - favicon.ico - app.manifest - - - - - full - true - - - none - false - True - - - - - - - - - - - - - diff --git a/linker.web/src/apis/updater.js b/linker.web/src/apis/updater.js index 4e8e7088..55ceab68 100644 --- a/linker.web/src/apis/updater.js +++ b/linker.web/src/apis/updater.js @@ -3,4 +3,10 @@ import { sendWebsocketMsg } from './request' export const getUpdater = () => { return sendWebsocketMsg('updaterclient/get'); +} +export const confirm = (machineId) => { + return sendWebsocketMsg('updaterclient/confirm', machineId); +} +export const exit = (machineId) => { + return sendWebsocketMsg('updaterclient/exit', machineId); } \ No newline at end of file diff --git a/linker.web/src/components/install/Index.vue b/linker.web/src/components/install/Index.vue index 940496de..3ef7e4d2 100644 --- a/linker.web/src/components/install/Index.vue +++ b/linker.web/src/components/install/Index.vue @@ -50,9 +50,9 @@ export default { steps:['选择模式','服务端','客户端','完成'] }); - watch(() => globalData.value.configed, (val) => { + watch(() => globalData.value.config.configed, (val) => { if (val) { - state.show = globalData.value.connected && globalData.value.configed && globalData.value.config.Common.Install == false; + state.show = globalData.value.api.connected && globalData.value.config.configed && globalData.value.config.Common.Install == false; } }); diff --git a/linker.web/src/components/status/Api.vue b/linker.web/src/components/status/Api.vue index c994de5b..109e05ed 100644 --- a/linker.web/src/components/status/Api.vue +++ b/linker.web/src/components/status/Api.vue @@ -1,6 +1,6 @@