mirror of
https://github.com/snltty/linker.git
synced 2025-10-30 04:02:13 +08:00
167
This commit is contained in:
@@ -174,6 +174,13 @@ namespace linker.messenger.serializer.memorypack
|
|||||||
[MemoryPackIgnore]
|
[MemoryPackIgnore]
|
||||||
public readonly UpdaterInfo info;
|
public readonly UpdaterInfo info;
|
||||||
|
|
||||||
|
[MemoryPackInclude]
|
||||||
|
string Version => info.Version;
|
||||||
|
[MemoryPackInclude]
|
||||||
|
string[] Msg => info.Msg;
|
||||||
|
[MemoryPackInclude]
|
||||||
|
string DateTime => info.DateTime;
|
||||||
|
|
||||||
[MemoryPackInclude]
|
[MemoryPackInclude]
|
||||||
string MachineId => info.MachineId;
|
string MachineId => info.MachineId;
|
||||||
|
|
||||||
@@ -187,9 +194,9 @@ namespace linker.messenger.serializer.memorypack
|
|||||||
long Current => info.Current;
|
long Current => info.Current;
|
||||||
|
|
||||||
[MemoryPackConstructor]
|
[MemoryPackConstructor]
|
||||||
SerializableUpdateInfo(string machineId, UpdaterStatus status, long length, long current)
|
SerializableUpdateInfo(string version, string[] msg,string datetime,string machineId, UpdaterStatus status, long length, long current)
|
||||||
{
|
{
|
||||||
this.info = new UpdaterInfo { MachineId = machineId, Status = status, Length = length, Current = current };
|
this.info = new UpdaterInfo { Version=version, Msg=msg, DateTime=datetime, MachineId = machineId, Status = status, Length = length, Current = current };
|
||||||
}
|
}
|
||||||
|
|
||||||
public SerializableUpdateInfo(UpdaterInfo info)
|
public SerializableUpdateInfo(UpdaterInfo info)
|
||||||
|
|||||||
@@ -47,10 +47,6 @@ namespace linker.messenger.signin
|
|||||||
|
|
||||||
public void PushNetworkEnabledBefore()
|
public void PushNetworkEnabledBefore()
|
||||||
{
|
{
|
||||||
if (networdkEnabledTimes == 0)
|
|
||||||
{
|
|
||||||
NetworkFirstEnabledHandle?.Invoke();
|
|
||||||
}
|
|
||||||
NetworkEnabledHandleBefore?.Invoke();
|
NetworkEnabledHandleBefore?.Invoke();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using linker.libs;
|
using linker.libs;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using linker.messenger.signin;
|
using linker.messenger.signin;
|
||||||
|
using linker.libs.extends;
|
||||||
|
|
||||||
namespace linker.messenger.updater
|
namespace linker.messenger.updater
|
||||||
{
|
{
|
||||||
@@ -33,7 +34,6 @@ namespace linker.messenger.updater
|
|||||||
}
|
}
|
||||||
private void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
CheckTask();
|
|
||||||
UpdateTask();
|
UpdateTask();
|
||||||
updateInfo.Update();
|
updateInfo.Update();
|
||||||
}
|
}
|
||||||
@@ -93,6 +93,7 @@ namespace linker.messenger.updater
|
|||||||
{
|
{
|
||||||
if (updateInfo.Updated)
|
if (updateInfo.Updated)
|
||||||
{
|
{
|
||||||
|
await GetUpdateInfo();
|
||||||
updateInfo.MachineId = signInClientStore.Id;
|
updateInfo.MachineId = signInClientStore.Id;
|
||||||
string[] machines = subscribes.Where(c => c.Value.DiffLessEqual(15000)).Select(c => c.Key).ToArray();
|
string[] machines = subscribes.Where(c => c.Value.DiffLessEqual(15000)).Select(c => c.Key).ToArray();
|
||||||
if (machines.Length > 0)
|
if (machines.Length > 0)
|
||||||
@@ -101,7 +102,17 @@ namespace linker.messenger.updater
|
|||||||
{
|
{
|
||||||
Connection = signInClientState.Connection,
|
Connection = signInClientState.Connection,
|
||||||
MessengerId = (ushort)UpdaterMessengerIds.UpdateForward,
|
MessengerId = (ushort)UpdaterMessengerIds.UpdateForward,
|
||||||
Payload = serializer.Serialize(new UpdaterClientInfo { ToMachines = machines, Info = updateInfo }),
|
Payload = serializer.Serialize(new UpdaterClientInfo
|
||||||
|
{
|
||||||
|
ToMachines = machines,
|
||||||
|
Info = new UpdaterInfo
|
||||||
|
{
|
||||||
|
Current = updateInfo.Current,
|
||||||
|
Length = updateInfo.Length,
|
||||||
|
Status = updateInfo.Status,
|
||||||
|
MachineId = updateInfo.MachineId
|
||||||
|
}
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Update(updateInfo);
|
Update(updateInfo);
|
||||||
@@ -117,17 +128,6 @@ namespace linker.messenger.updater
|
|||||||
LoggerHelper.Instance.Info($"check update");
|
LoggerHelper.Instance.Info($"check update");
|
||||||
_ = GetUpdateInfo();
|
_ = GetUpdateInfo();
|
||||||
}
|
}
|
||||||
private void CheckTask()
|
|
||||||
{
|
|
||||||
TimerHelper.SetInterval(async () =>
|
|
||||||
{
|
|
||||||
if (updaterCommonTransfer.CheckUpdate)
|
|
||||||
{
|
|
||||||
await GetUpdateInfo();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}, () => updaterCommonTransfer.UpdateIntervalSeconds * 1000);
|
|
||||||
}
|
|
||||||
private async Task GetUpdateInfo()
|
private async Task GetUpdateInfo()
|
||||||
{
|
{
|
||||||
if (updateInfo.Status > UpdaterStatus.Checked) return;
|
if (updateInfo.Status > UpdaterStatus.Checked) return;
|
||||||
|
|||||||
@@ -212,6 +212,8 @@ namespace linker.messenger.updater
|
|||||||
/// <param name="version"></param>
|
/// <param name="version"></param>
|
||||||
public void Confirm(UpdaterInfo updateInfo, string version)
|
public void Confirm(UpdaterInfo updateInfo, string version)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(version)) return;
|
||||||
|
|
||||||
TimerHelper.Async(async () =>
|
TimerHelper.Async(async () =>
|
||||||
{
|
{
|
||||||
await DownloadUpdate(updateInfo, version);
|
await DownloadUpdate(updateInfo, version);
|
||||||
|
|||||||
@@ -118,6 +118,14 @@ namespace linker.messenger.updater
|
|||||||
UpdaterConfirmServerInfo confirm = serializer.Deserialize<UpdaterConfirmServerInfo>(connection.ReceiveRequestWrap.Payload.Span);
|
UpdaterConfirmServerInfo confirm = serializer.Deserialize<UpdaterConfirmServerInfo>(connection.ReceiveRequestWrap.Payload.Span);
|
||||||
if (updaterServerStore.SecretKey == confirm.SecretKey)
|
if (updaterServerStore.SecretKey == confirm.SecretKey)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(confirm.Version))
|
||||||
|
{
|
||||||
|
confirm.Version = updaterServerTransfer.Get().Version;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(confirm.Version))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
updaterServerTransfer.Confirm(confirm.Version);
|
updaterServerTransfer.Confirm(confirm.Version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -166,6 +174,14 @@ namespace linker.messenger.updater
|
|||||||
else machines = signCaching.Get(cache.GroupId).Where(c => c.MachineId == confirm.MachineId && c.GroupId == cache.GroupId);
|
else machines = signCaching.Get(cache.GroupId).Where(c => c.MachineId == confirm.MachineId && c.GroupId == cache.GroupId);
|
||||||
|
|
||||||
confirm.SecretKey = string.Empty;
|
confirm.SecretKey = string.Empty;
|
||||||
|
if (string.IsNullOrWhiteSpace(confirm.Version))
|
||||||
|
{
|
||||||
|
confirm.Version = updaterServerTransfer.Get().Version;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(confirm.Version))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
var tasks = machines.Select(c =>
|
var tasks = machines.Select(c =>
|
||||||
{
|
{
|
||||||
return messengerSender.SendOnly(new MessageRequestWrap
|
return messengerSender.SendOnly(new MessageRequestWrap
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
namespace linker.messenger.updater
|
using linker.libs;
|
||||||
|
|
||||||
|
namespace linker.messenger.updater
|
||||||
{
|
{
|
||||||
public sealed class UpdaterServerTransfer
|
public sealed class UpdaterServerTransfer
|
||||||
{
|
{
|
||||||
private UpdaterInfo updateInfo = new UpdaterInfo { Status = UpdaterStatus.Checked };
|
private UpdaterInfo updateInfo = new UpdaterInfo { Status = UpdaterStatus.Checked };
|
||||||
private readonly UpdaterHelper updaterHelper;
|
private readonly UpdaterHelper updaterHelper;
|
||||||
|
private readonly IUpdaterCommonStore updaterCommonTransfer;
|
||||||
public UpdaterServerTransfer(UpdaterHelper updaterHelper)
|
public UpdaterServerTransfer(UpdaterHelper updaterHelper, IUpdaterCommonStore updaterCommonTransfer)
|
||||||
{
|
{
|
||||||
this.updaterHelper = updaterHelper;
|
this.updaterHelper = updaterHelper;
|
||||||
|
this.updaterCommonTransfer = updaterCommonTransfer;
|
||||||
|
CheckTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
public UpdaterInfo Get()
|
public UpdaterInfo Get()
|
||||||
@@ -22,5 +26,16 @@
|
|||||||
updaterHelper.Confirm(updateInfo, version);
|
updaterHelper.Confirm(updateInfo, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckTask()
|
||||||
|
{
|
||||||
|
TimerHelper.SetInterval(async () =>
|
||||||
|
{
|
||||||
|
if (updaterCommonTransfer.CheckUpdate)
|
||||||
|
{
|
||||||
|
await updaterHelper.GetUpdateInfo(updateInfo);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}, () => updaterCommonTransfer.UpdateIntervalSeconds * 1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<project ver="10" name="linker.tray.win" libEmbed="true" icon="..\linker\favicon.ico" ui="win" output="linker.tray.win.exe" CompanyName="snltty" FileDescription="linker.tray.win" LegalCopyright="Copyright (C) snltty 2024" ProductName="linker.tray.win" InternalName="linker.install.win" FileVersion="0.0.0.202" ProductVersion="0.0.0.202" publishDir="/dist/" dstrip="false" local="false" ignored="false">
|
<project ver="10" name="linker.tray.win" libEmbed="true" icon="..\linker\favicon.ico" ui="win" output="linker.tray.win.exe" CompanyName="snltty" FileDescription="linker.tray.win" LegalCopyright="Copyright (C) snltty 2024" ProductName="linker.tray.win" InternalName="linker.install.win" FileVersion="0.0.0.203" ProductVersion="0.0.0.203" publishDir="/dist/" dstrip="false" local="false" ignored="false">
|
||||||
<file name="main.aardio" path="main.aardio" comment="main.aardio"/>
|
<file name="main.aardio" path="main.aardio" comment="main.aardio"/>
|
||||||
<folder name="资源文件" path="res" embed="true" local="false" ignored="false">
|
<folder name="资源文件" path="res" embed="true" local="false" ignored="false">
|
||||||
<file name="favicon.ico" path="res\favicon.ico" comment="res\favicon.ico"/>
|
<file name="favicon.ico" path="res\favicon.ico" comment="res\favicon.ico"/>
|
||||||
|
|||||||
BIN
src/linker.tray.win/dist/linker.tray.win.exe
vendored
BIN
src/linker.tray.win/dist/linker.tray.win.exe
vendored
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
v1.6.7
|
v1.6.7
|
||||||
2025-02-18 11:10:37
|
2025-02-18 15:17:31
|
||||||
1. 修复首次启动网卡未启动bug
|
1. 修复首次启动网卡未启动bug
|
||||||
2. 自定义网卡名
|
2. 自定义网卡名
|
||||||
3. 可禁用NAT
|
3. 可禁用NAT
|
||||||
|
|||||||
Reference in New Issue
Block a user