自动同步

This commit is contained in:
snltty
2024-09-03 11:52:36 +08:00
parent 27b5449433
commit e8357ff4ca
13 changed files with 84 additions and 41 deletions

View File

@@ -33,11 +33,11 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
with:
tag_name: v1.2.8
release_name: v1.2.8.${{ steps.date.outputs.today }}
tag_name: v1.2.9
release_name: v1.2.9.${{ steps.date.outputs.today }}
draft: false
prerelease: false
body: "1. 修复管理页面数据表格绑定显示信息错误\r\n2. 将程序分发给他人进行组网时可删除web文件夹使其其仅能使用简单管理页面管理自身"
body: 1. 选择是否自动同步配置文件
- name: upload-win-x86-oss
id: upload-win-x86-oss
uses: tvrcgo/oss-action@v0.1.1
@@ -47,7 +47,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-win-x86.zip
target-path: /downloads/linker/v1.2.8/linker-win-x86.zip
target-path: /downloads/linker/v1.2.9/linker-win-x86.zip
- name: upload-win-x86
id: upload-win-x86
uses: actions/upload-release-asset@master
@@ -67,7 +67,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-win-x64.zip
target-path: /downloads/linker/v1.2.8/linker-win-x64.zip
target-path: /downloads/linker/v1.2.9/linker-win-x64.zip
- name: upload-win-x64
id: upload-win-x64
uses: actions/upload-release-asset@master
@@ -87,7 +87,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-win-arm64.zip
target-path: /downloads/linker/v1.2.8/linker-win-arm64.zip
target-path: /downloads/linker/v1.2.9/linker-win-arm64.zip
- name: upload-win-arm64
id: upload-win-arm64
uses: actions/upload-release-asset@master
@@ -107,7 +107,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-x64.zip
target-path: /downloads/linker/v1.2.8/linker-linux-x64.zip
target-path: /downloads/linker/v1.2.9/linker-linux-x64.zip
- name: upload-linux-x64
id: upload-linux-x64
uses: actions/upload-release-asset@master
@@ -127,7 +127,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-arm.zip
target-path: /downloads/linker/v1.2.8/linker-linux-arm.zip
target-path: /downloads/linker/v1.2.9/linker-linux-arm.zip
- name: upload-linux-arm
id: upload-linux-arm
uses: actions/upload-release-asset@master
@@ -147,7 +147,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-arm64.zip
target-path: /downloads/linker/v1.2.8/linker-linux-arm64.zip
target-path: /downloads/linker/v1.2.9/linker-linux-arm64.zip
- name: upload-linux-arm64
id: upload-linux-arm64
uses: actions/upload-release-asset@master
@@ -167,7 +167,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-musl-x64.zip
target-path: /downloads/linker/v1.2.8/linker-linux-musl-x64.zip
target-path: /downloads/linker/v1.2.9/linker-linux-musl-x64.zip
- name: upload-linux-musl-x64
id: upload-linux-musl-x64
uses: actions/upload-release-asset@master
@@ -187,7 +187,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-musl-arm.zip
target-path: /downloads/linker/v1.2.8/linker-linux-musl-arm.zip
target-path: /downloads/linker/v1.2.9/linker-linux-musl-arm.zip
- name: upload-linux-musl-arm
id: upload-linux-musl-arm
uses: actions/upload-release-asset@master
@@ -207,7 +207,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-musl-arm64.zip
target-path: /downloads/linker/v1.2.8/linker-linux-musl-arm64.zip
target-path: /downloads/linker/v1.2.9/linker-linux-musl-arm64.zip
- name: upload-linux-musl-arm64
id: upload-linux-musl-arm64
uses: actions/upload-release-asset@master
@@ -227,7 +227,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-osx-x64.zip
target-path: /downloads/linker/v1.2.8/linker-osx-x64.zip
target-path: /downloads/linker/v1.2.9/linker-osx-x64.zip
- name: upload-osx-x64
id: upload-osx-x64
uses: actions/upload-release-asset@master
@@ -247,7 +247,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-osx-arm64.zip
target-path: /downloads/linker/v1.2.8/linker-osx-arm64.zip
target-path: /downloads/linker/v1.2.9/linker-osx-arm64.zip
- name: upload-osx-arm64
id: upload-osx-arm64
uses: actions/upload-release-asset@master
@@ -277,7 +277,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-windows-route.zip
target-path: /downloads/linker/v1.2.8/linker-windows-route.zip
target-path: /downloads/linker/v1.2.9/linker-windows-route.zip
- name: upload-windows-route
id: upload-windows-route
uses: actions/upload-release-asset@master

View File

@@ -38,6 +38,6 @@ jobs:
- name: Push
run: |
nuget push ./linker.tunnel/bin/release/linker.tunnel.1.2.8.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol
nuget push ./linker.libs/bin/release/linker.libs.1.2.8.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol
nuget push ./linker.tun/bin/release/linker.tun.1.2.8.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol
nuget push ./linker.tunnel/bin/release/linker.tunnel.1.2.9.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol
nuget push ./linker.libs/bin/release/linker.libs.1.2.9.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol
nuget push ./linker.tun/bin/release/linker.tun.1.2.9.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol

View File

@@ -14,9 +14,9 @@
<Copyright>snltty</Copyright>
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<Version>1.2.8</Version>
<AssemblyVersion>1.2.8</AssemblyVersion>
<FileVersion>1.2.8</FileVersion>
<Version>1.2.9</Version>
<AssemblyVersion>1.2.9</AssemblyVersion>
<FileVersion>1.2.9</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>full</DebugType>

View File

@@ -9,7 +9,7 @@
<JsonSerializerIsReflectionEnabledByDefault>true</JsonSerializerIsReflectionEnabledByDefault>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
<Title>linker tun</Title>
<Version>1.2.8</Version>
<Version>1.2.9</Version>
<Authors>snltty</Authors>
<Company>snltty</Company>
<Description>linker tun</Description>
@@ -17,8 +17,8 @@
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>linker tun</PackageReleaseNotes>
<AssemblyVersion>1.2.8</AssemblyVersion>
<FileVersion>1.2.8</FileVersion>
<AssemblyVersion>1.2.9</AssemblyVersion>
<FileVersion>1.2.9</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -388,8 +388,11 @@ namespace linker.tunnel
}
//在尝试外网
eps.AddRange(new List<IPEndPoint>{
//有NAT
new IPEndPoint(tunnelTransportInfo.Remote.Remote.Address,tunnelTransportInfo.Remote.Remote.Port),
new IPEndPoint(tunnelTransportInfo.Remote.Remote.Address,tunnelTransportInfo.Remote.Remote.Port+1),
//无NAT
new IPEndPoint(tunnelTransportInfo.Remote.Remote.Address,tunnelTransportInfo.Remote.Local.Port),
});
//再尝试IPV6
foreach (IPAddress item in tunnelTransportInfo.Remote.LocalIps.Where(c => c.AddressFamily == AddressFamily.InterNetworkV6))

View File

@@ -9,7 +9,7 @@
<JsonSerializerIsReflectionEnabledByDefault>true</JsonSerializerIsReflectionEnabledByDefault>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
<Title>linker tunnel</Title>
<Version>1.2.8</Version>
<Version>1.2.9</Version>
<Authors>snltty</Authors>
<Company>snltty</Company>
<Description>linker tunnel</Description>
@@ -17,8 +17,8 @@
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>linker tunnel</PackageReleaseNotes>
<AssemblyVersion>1.2.8</AssemblyVersion>
<FileVersion>1.2.8</FileVersion>
<AssemblyVersion>1.2.9</AssemblyVersion>
<FileVersion>1.2.9</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -3,3 +3,6 @@ import { sendWebsocketMsg } from './request'
export const updateVersion = (data) => {
return sendWebsocketMsg('RunningConfig/UpdateVersion', data);
}
export const updateDisableSync = (data) => {
return sendWebsocketMsg('RunningConfig/UpdateDisableSync', data);
}

View File

@@ -16,6 +16,7 @@ export const provideGlobalData = () => {
Relay: { Servers: [] },
Tuntap: { IP: '', PrefixLength: 24 },
Client: { Servers: [] },
AutoSyncs: {}
},
configed: false
},

View File

@@ -4,20 +4,27 @@
<el-button size="small" @click=handleEdit>手动修改版本</el-button>
<span>高版本一端自动同步到低版本一端</span>
<span class="flex-1"></span>
<el-checkbox v-model="disableSyncValue" @change="handleSync">关闭自动同步</el-checkbox>
<slot></slot>
</div>
</template>
<script>
import {updateVersion} from '@/apis/running'
import {updateDisableSync, updateVersion} from '@/apis/running'
import { injectGlobalData } from '@/provide';
import { ElMessageBox } from 'element-plus';
import { computed } from 'vue'
import { computed, ref, watch } from 'vue'
export default {
props:['ckey'],
setup(props) {
const globalData = injectGlobalData();
const version = computed(()=>globalData.value.config.Running.Versions[props.ckey]);
const disableSync = computed(()=>globalData.value.config.Running.DisableSyncs[props.ckey] || false);
watch(()=>disableSync.value,()=>{
disableSyncValue.value = disableSync.value;
});
const disableSyncValue = ref(disableSync.value);
const handleEdit = () => {
ElMessageBox.prompt('输入你要修改到的版本', '修改版本', {
@@ -34,9 +41,12 @@ export default {
});
}
const handleSync = ()=>{
updateDisableSync({key:props.ckey,sync:disableSyncValue.value})
}
return {
version,handleEdit
version,disableSyncValue,handleEdit,handleSync
}
}
}

View File

@@ -17,17 +17,16 @@
<EnablePreviewFeatures>true</EnablePreviewFeatures>
<ServerGarbageCollection>false</ServerGarbageCollection>
<Title>linker</Title>
<Version>1.2.8</Version>
<Version>1.2.9</Version>
<Authors>snltty</Authors>
<Company>snltty</Company>
<Description>1. 修复管理页面数据表格绑定显示信息错误
2. 将程序分发给他人进行组网时可删除web文件夹使其其仅能使用简单管理页面管理自身</Description>
<Description>1. 选择是否自动同步配置文件</Description>
<Copyright>snltty</Copyright>
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>linker</PackageReleaseNotes>
<AssemblyVersion>1.2.8</AssemblyVersion>
<FileVersion>1.2.8</FileVersion>
<AssemblyVersion>1.2.9</AssemblyVersion>
<FileVersion>1.2.9</FileVersion>
</PropertyGroup>

View File

@@ -20,10 +20,20 @@ namespace linker.plugins.config
runningConfigTransfer.UpdateVersion(info.Key, info.Version);
}
public void UpdateDisableSync(ApiControllerParamsInfo param)
{
UpdateDisableSyncInfo info = param.Content.DeJson<UpdateDisableSyncInfo>();
runningConfigTransfer.UpdateDisableSync(info.Key, info.Sync);
}
public sealed class UpdateVersionInfo
{
public string Key { get; set; }
public ulong Version { get; set; }
}
public sealed class UpdateDisableSyncInfo
{
public string Key { get; set; }
public bool Sync { get; set; }
}
}
}

View File

@@ -1,5 +1,4 @@
using linker.libs;
using linker.libs.extends;
using linker.plugins.client;
using linker.plugins.config.messenger;
using linker.plugins.messenger;
@@ -14,6 +13,7 @@ namespace linker.client.config
/// 同步配置的版本记录
/// </summary>
public Dictionary<string, ulong> Versions { get; set; } = new Dictionary<string, ulong>();
public Dictionary<string, bool> DisableSyncs { get; set; } = new Dictionary<string, bool>();
}
[MemoryPackable]
@@ -76,7 +76,10 @@ namespace linker.client.config
/// <returns></returns>
public Memory<byte> InputConfig(ConfigVersionInfo info)
{
Console.WriteLine(info.ToJson());
if (GetDisableSync(info.Key))
{
return Helper.EmptyArray;
}
ulong version = GetVersion(info.Key);
if (setters.TryGetValue(info.Key, out Action<Memory<byte>> setter) && info.Version > version)
@@ -106,6 +109,11 @@ namespace linker.client.config
/// <param name="data"></param>
public void Sync(string key, Memory<byte> data)
{
if (GetDisableSync(key))
{
return;
}
ulong version = GetVersion(key);
sender.SendReply(new MessageRequestWrap
{
@@ -163,5 +171,15 @@ namespace linker.client.config
ulong version = GetVersion(key);
UpdateVersion(key, version + 1);
}
private bool GetDisableSync(string key)
{
return runningConfig.Data.DisableSyncs.TryGetValue(key, out bool sync) && sync;
}
public void UpdateDisableSync(string key, bool sync)
{
runningConfig.Data.DisableSyncs[key] = sync;
runningConfig.Data.Update();
}
}
}

View File

@@ -1,4 +1,3 @@
v1.2.8
2024-09-02 15:23:00
1. 修复管理页面数据表格绑定显示信息错误
2. 将程序分发给他人进行组网时可删除web文件夹使其其仅能使用简单管理页面管理自身
v1.2.9
2024-09-03 11:52:36
1. 选择是否自动同步配置文件