Add self-update command and fix hash mismatch after pull

- kisync update: show available releases from Gitea
- kisync update --apply: download and replace exe in-place
- Background update check after every command (non-blocking)
- Fix: compute hash from disk-read object (not server object) to prevent
  false "modified" status after pull due to line-ending differences

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-14 17:41:35 +03:00
parent 9f041c2d3d
commit 0ad43a6981
3 changed files with 251 additions and 6 deletions

View File

@@ -252,7 +252,10 @@ export async function pullCommand(force = false): Promise<void> {
writeEndpointToDisk(ep, endpointDir);
const hash = computeEndpointHash(ep);
// Хеш считаем от того, что реально записалось на диск,
// чтобы он совпадал при последующем readEndpointFromDisk в status
const diskEp = readEndpointFromDisk(endpointDir);
const hash = computeEndpointHash(diskEp || ep);
newState.endpoints[ep.id] = {
updated_at: ep.updated_at,
folder_path: path.relative(root, endpointDir),