From 574bfa79f76483898647485fb6edad7badf0f668 Mon Sep 17 00:00:00 2001 From: sivadaboi Date: Fri, 2 Oct 2026 08:59:22 +0530 Subject: [PATCH 01/11] Auto-track verifiable folders again; trust own devices to choose folders --- CHANGELOG.md | 19 +++ .../frontend/src/views/Devices.svelte | 38 +++++ cmd/opensave-app/wails.json | 2 +- e2e/folder_choice_test.go | 120 ++++++++++++++ internal/api/routes_peers.go | 30 ++++ internal/api/server.go | 5 +- internal/cliapp/commands_sync.go | 34 ++++ internal/cliapp/completion.go | 1 + internal/cliapp/usage.go | 1 + internal/daemon/daemon.go | 21 ++- internal/daemon/newgames.go | 24 +++ internal/p2p/cve_2026_103398_test.go | 91 +++++++++- internal/p2p/engine.go | 12 +- internal/p2p/matching_test.go | 6 +- internal/p2p/routes.go | 42 ++++- internal/p2p/wanclient_handlers.go | 3 +- internal/presets/verify.go | 156 ++++++++++++++++++ internal/presets/verify_test.go | 109 ++++++++++++ .../migrations/0038_peer_folder_trust.sql | 13 ++ internal/store/offered_games.go | 5 +- internal/store/peer_folder_trust.go | 38 +++++ internal/store/peer_folder_trust_test.go | 61 +++++++ internal/store/peers.go | 4 + internal/version/version.go | 2 +- packaging/man/opensave.1 | 5 + 25 files changed, 813 insertions(+), 29 deletions(-) create mode 100644 e2e/folder_choice_test.go create mode 100644 internal/presets/verify.go create mode 100644 internal/presets/verify_test.go create mode 100644 internal/store/migrations/0038_peer_folder_trust.sql create mode 100644 internal/store/peer_folder_trust.go create mode 100644 internal/store/peer_folder_trust_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 8519c376..a2527313 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -157,9 +157,28 @@ All notable changes to OpenSave are documented here. This project adheres to backup or an earlier install, it simply takes the newer save. (#106) - **A Steam folder holding only Steam's own file is not offered as a game with saves.** (#115) +- **A game waiting for a folder no longer stays on Home once it syncs.** And + when a game is offered, OpenSave now looks for its folder straight away + rather than at the next hourly scan, so a game you have already played on + this device starts syncing within seconds. ### Changed +- **Games from your other devices set themselves up again.** 2.4.1 stopped + another device from choosing folders on this one, and in doing so made + many games wait on Home for you to pick a folder. Now a game arriving from + another device is tracked by itself wherever this device can tell the + folder is that game's save: where the save catalogue or Steam says the game + keeps its saves here, even before you have played it (so a new PC fills + itself in, saves in place before first launch), in an emulator's save + folder, or a folder a scan has seen. The other device still chooses + nothing. +- **Trust your own devices to choose folders.** For a folder this device + can't recognise, such as one you tracked by hand on the other device, the + game still waits on Home for you to place it. On Devices, "Trust it to + choose folders" lets one of your own devices decide instead, as every + device could before 2.4.1 (`opensave peers trust on`). It is off + until you turn it on, asks first, and goes when the device is unpaired. - **Much faster with saves of many files.** Checking a 240,000-file save for changes went from 13–19 seconds to about 1.3, and a follow-up snapshot copies the unchanged files from the one before instead of compressing them diff --git a/cmd/opensave-app/frontend/src/views/Devices.svelte b/cmd/opensave-app/frontend/src/views/Devices.svelte index 641c5f3b..28aa2405 100644 --- a/cmd/opensave-app/frontend/src/views/Devices.svelte +++ b/cmd/opensave-app/frontend/src/views/Devices.svelte @@ -45,6 +45,30 @@ run(() => api.del(`/api/peers/${peer.id}`), `Unpaired ${peer.name}`); }; + // A game a paired device syncs is tracked by itself only at a folder this + // device recognises as that game's save; anywhere else it waits on Home + // for the user to place. Their own devices they can let choose instead, as + // every device could before 2.4.1 — which is why turning it on asks. + const setChoosesFolders = async (peer, box) => { + const allowed = box.checked; + if (allowed) { + const ok = await askConfirm( + `Only do this for a device that is yours. When "${peer.name}" syncs a game this device ` + + `doesn't recognise, its saves go in the folder "${peer.name}" names, instead of waiting ` + + `on Home for you to choose one.`, + { title: `Trust "${peer.name}" to choose folders?`, confirmText: 'Trust it' } + ); + if (!ok) { + box.checked = false; // as it was: nothing changed + return; + } + } + run( + () => api.post(`/api/peers/${peer.id}/choose-folders`, { allowed }), + allowed ? `${peer.name} can choose folders here` : `${peer.name} no longer chooses folders here` + ); + }; + // The only repair for a pairing with no encryption key is to make it again, // and this button can only do the first half of that. Saying "Pair again to // encrypt" on a control that just unpairs would leave someone believing they @@ -115,6 +139,15 @@ {/if} + {#if peer.hasNewerBuild && peer.status === 'online'}