diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 8f9ced8f..b7a9d4ec 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -235,6 +235,17 @@ jobs:
cp opensave-decky-plugin/package.json decky-pkg/OpenSave/
cp opensave-decky-plugin/main.py decky-pkg/OpenSave/
cp opensave-decky-plugin/dist/index.js decky-pkg/OpenSave/dist/
+ # The zip says the version of the tag it is released under. Plugin
+ # managers compare the two, and a mismatch offers the same update
+ # again and again (#149). A manual run has no tag: it keeps the files'.
+ if [ "$GITHUB_REF_TYPE" = "tag" ]; then
+ V="${GITHUB_REF_NAME#v}"
+ for f in plugin.json package.json; do
+ jq --arg v "$V" '.version = $v' "decky-pkg/OpenSave/$f" > "$f.stamped"
+ mv "$f.stamped" "decky-pkg/OpenSave/$f"
+ test "$(jq -r .version "decky-pkg/OpenSave/$f")" = "$V"
+ done
+ fi
(cd decky-pkg && zip -r ../OpenSave-decky-plugin.zip OpenSave)
unzip -l OpenSave-decky-plugin.zip
diff --git a/cmd/opensave-app/frontend/src/App.svelte b/cmd/opensave-app/frontend/src/App.svelte
index cce5ee7d..3b1251b1 100644
--- a/cmd/opensave-app/frontend/src/App.svelte
+++ b/cmd/opensave-app/frontend/src/App.svelte
@@ -6,7 +6,7 @@
import { startController, controllerOn, padUsed, pageStep } from './lib/controller.js';
import { startFocusRing } from './lib/focusring.js';
import { appearance } from './lib/appearance.js';
- import { locale, resolveLocale } from './lib/i18n.js';
+ import { locale, resolveLocale, t } from './lib/i18n.js';
import { paletteOpen } from './lib/shortcuts.js';
import { newlyEmptied } from './lib/emptied.js';
import { demandAttention } from './lib/notify.js';
@@ -111,13 +111,13 @@
const { now, fresh } = newlyEmptied(emptiedBefore, all);
emptiedBefore = now;
for (const g of fresh) {
- toast(`Every save file of ${g.name} was deleted here. Your other devices keep theirs until you choose.`, 'warning', {
+ toast($t('app.emptiedBody', { name: g.name }), 'warning', {
ttl: 15000,
- action: { label: 'Choose', run: () => navigate('game', { gameId: g.id }) }
+ action: { label: $t('app.choose'), run: () => navigate('game', { gameId: g.id }) }
});
demandAttention('emptied', {
title: g.name,
- body: 'Every save file was deleted here. Your other devices keep theirs until you choose.',
+ body: $t('app.emptiedBody', { name: g.name }),
game: g
});
}
@@ -198,34 +198,34 @@
{#if $appUpdate.state === 'downloading'}
- Updating OpenSave — downloading {$appUpdate.percentage ?? 0}%…
+ {$t('app.updatingDownloading', { n: $appUpdate.percentage ?? 0 })}
{:else if $appUpdate.state === 'installing'}
- Installing update…
+ {$t('app.installingUpdate')}
{:else}
- Restarting with the new version…
+ {$t('app.restartingVersion')}
{/if}
- The app restarts itself when done — your games keep syncing.
+ {$t('app.restartsItself')}
{:else if update}
- OpenSave {update.latest} is available — you're on {update.current}.
+ {$t('app.updateAvailable', { latest: update.latest, current: update.current })}
{/if}
@@ -361,11 +361,6 @@
color: var(--text-dim) !important;
font-size: 0.8rem;
}
- .boot-hint code {
- background: var(--bg-raised);
- padding: 1px 5px;
- border-radius: 5px;
- }
.update-banner {
display: flex;
align-items: center;
diff --git a/cmd/opensave-app/frontend/src/components/ConflictModal.svelte b/cmd/opensave-app/frontend/src/components/ConflictModal.svelte
index b16e4151..1a856f64 100644
--- a/cmd/opensave-app/frontend/src/components/ConflictModal.svelte
+++ b/cmd/opensave-app/frontend/src/components/ConflictModal.svelte
@@ -5,6 +5,8 @@
import { visited } from '../lib/later.js';
import { api } from '../lib/api.js';
import { demandAttention } from '../lib/notify.js';
+ // `fmtTime` below has a parameter named `t`, so the translator comes in aliased.
+ import { t as i18n, segments } from '../lib/i18n.js';
import Chevron from './ui/Chevron.svelte';
import Gamepad2 from 'lucide-svelte/icons/gamepad-2';
import Monitor from 'lucide-svelte/icons/monitor';
@@ -58,7 +60,7 @@
}
$: gameName = current ? ($games[current[0]]?.name ?? current[0]) : '';
$: conflict = current ? current[1] : null;
- $: peerName = conflict ? (conflict.peer.Name ?? conflict.peer.name ?? 'the other device') : '';
+ $: peerName = conflict ? (conflict.peer.Name ?? conflict.peer.name ?? $i18n('conflict.otherDevice')) : '';
$: peerType = conflict ? $peers[conflict.peer.ID ?? conflict.peer.id]?.deviceType : '';
$: localIcon = isHandheld($settings?.deviceType) ? Gamepad2 : Monitor;
$: peerIcon = isHandheld(peerType) ? Gamepad2 : Monitor;
@@ -71,9 +73,9 @@
const fresh = list.filter(([gid]) => !seen.has(gid));
if (fresh.length > 0) {
const game = $games[fresh[0][0]];
- const name = game?.name ?? 'a game';
- demandAttention('conflicts', { title: name, body: 'Its save changed here and on another device at once — choose which to keep.', game });
- toast(`Save conflict for “${name}” — choose which version to keep`, 'error');
+ const name = game?.name ?? $i18n('conflict.aGame');
+ demandAttention('conflicts', { title: name, body: $i18n('conflict.attentionBody'), game });
+ toast($i18n('conflict.attentionToast', { name }), 'error');
}
seen = new Set(list.map(([gid]) => gid));
// Housekeeping: forget "applying" markers for conflicts that no longer
@@ -136,9 +138,9 @@
// different measurements.
function sideSummary(stats) {
const files = stats?.files;
- if (files === 0) return 'save folder is empty';
+ if (files === 0) return $i18n('conflict.saveFolderEmpty');
if (typeof files !== 'number') return '';
- return `whole save: ${files} file${files === 1 ? '' : 's'} · ${fmtSize(stats?.totalBytes ?? -1)}`;
+ return $i18n('conflict.wholeSave', { n: files, size: fmtSize(stats?.totalBytes ?? -1) });
}
async function resolve(resolution) {
@@ -156,7 +158,7 @@
});
applying = new Set(applying).add(gameId);
if (resolution !== 'keep-local') {
- toast(`Applying your choice for “${name}” — transferring ${peerName}'s files…`, 'info');
+ toast($i18n('conflict.applyingToast', { name, peer: peerName }), 'info');
}
showDiff = false;
} catch (e) {
@@ -167,12 +169,30 @@
}
const fmtTime = (t) => (t ? new Date(t).toLocaleString() : '—');
- const fmtMs = (ms) => (ms ? new Date(ms).toLocaleString() : 'unknown');
+ const fmtMs = (ms) => (ms ? new Date(ms).toLocaleString() : $i18n('conflict.unknown'));
const fmtSize = (n) =>
n < 0 ? '—' : n >= 1048576 ? (n / 1048576).toFixed(1) + ' MB' : n >= 1024 ? (n / 1024).toFixed(1) + ' KB' : n + ' B';
const diffIcon = (s) => (s === 'changed' ? '✱' : s === 'only-remote' ? '+' : '−');
const diffLabel = (s) =>
- s === 'changed' ? 'differs' : s === 'only-remote' ? `only on ${peerName}` : 'only on this device';
+ s === 'changed'
+ ? $i18n('conflict.differs')
+ : s === 'only-remote'
+ ? $i18n('conflict.onlyOnPeer', { peer: peerName })
+ : $i18n('conflict.onlyOnDevice');
+
+ // The hint paragraph reads as one sentence stream in every language; the
+ // three option names arrive already quoted and are bolded in place.
+ const hintParams = (peerName) => ({
+ both: $i18n('conflict.keepBothQuoted'),
+ mine: $i18n('conflict.keepMineQuoted'),
+ theirs: $i18n('conflict.keepTheirsQuoted'),
+ peer: peerName
+ });
+ $: hintParts = segments($i18n('conflict.hintAll', hintParams(peerName)), hintParams(peerName), [
+ 'both',
+ 'mine',
+ 'theirs'
+ ]);
@@ -180,75 +200,68 @@
{#if current && conflict}
-
Save conflict — {gameName}
+
{$i18n('conflict.title', { game: gameName })}
- Both this device and {peerName} changed this save since the last sync.
- Pick which version to play from.
+ {#each segments($i18n('conflict.desc', { peer: peerName }), { peer: peerName }, ['peer']) as part}{#if part.bold}{part.text}{:else}{part.text}{/if}{/each}
- This device
- {#if newerSide === 'local'}played more recently{/if}
+ {$i18n('conflict.thisDevice')}
+ {#if newerSide === 'local'}{$i18n('conflict.playedRecently')}{/if}
- Nothing is lost whichever you pick. “Keep both” (recommended) keeps
- playing yours — {peerName} receives it too — and keeps {peerName}'s version here on a branch you can switch
- to. “Keep mine” makes your
- version the shared one — {peerName} receives it (their old save is snapshotted first).
- “Keep theirs” adopts {peerName}'s version here, snapshotting yours first.
- Restore anything from the game's Snapshots / Branches tabs.
+
+ {#each hintParts as part}{#if part.bold}{part.text}{:else}{part.text}{/if}{/each}
diff --git a/cmd/opensave-app/frontend/src/components/LocationConflictModal.svelte b/cmd/opensave-app/frontend/src/components/LocationConflictModal.svelte
index abd206f3..ec825728 100644
--- a/cmd/opensave-app/frontend/src/components/LocationConflictModal.svelte
+++ b/cmd/opensave-app/frontend/src/components/LocationConflictModal.svelte
@@ -13,6 +13,7 @@
import { visited } from '../lib/later.js';
import { api } from '../lib/api.js';
import { demandAttention } from '../lib/notify.js';
+ import { t, segments } from '../lib/i18n.js';
import Chevron from './ui/Chevron.svelte';
import Gamepad2 from 'lucide-svelte/icons/gamepad-2';
import Monitor from 'lucide-svelte/icons/monitor';
@@ -42,7 +43,7 @@
$: pending = ($locationConflicts ?? []).filter((c) => !applying.has(keyOf(c)) && !later.has(keyOf(c)));
$: current = pending[0]; // one at a time, like the whole-game screen
$: gameName = current ? ($games[current.gameId]?.name ?? current.gameId) : '';
- $: peerName = current ? (current.peer?.name ?? current.peer?.Name ?? 'the other device') : '';
+ $: peerName = current ? (current.peer?.name ?? current.peer?.Name ?? $t('conflict.otherDevice')) : '';
$: peerType = current ? $peers[current.peer?.id ?? current.peer?.ID]?.deviceType : '';
$: localIcon = isHandheld($settings?.deviceType) ? Gamepad2 : Monitor;
$: peerIcon = isHandheld(peerType) ? Gamepad2 : Monitor;
@@ -54,9 +55,9 @@
const fresh = list.filter((c) => !seen.has(keyOf(c)));
if (fresh.length > 0) {
const game = $games[fresh[0].gameId];
- const name = game?.name ?? 'a game';
- demandAttention('conflicts', { title: name, body: `Its “${fresh[0].root}” folder differs on both devices — choose which to keep.`, game });
- toast(`The “${fresh[0].root}” folder of “${name}” differs on both devices`, 'error');
+ const name = game?.name ?? $t('conflict.aGame');
+ demandAttention('conflicts', { title: name, body: $t('locConflict.attentionBody', { root: fresh[0].root }), game });
+ toast($t('locConflict.attentionToast', { root: fresh[0].root, name }), 'error');
}
seen = new Set(list.map(keyOf));
// Forget in-flight markers for conflicts that are gone.
@@ -83,7 +84,7 @@
});
applying = new Set(applying).add(keyOf(c));
if (resolution === 'keep-remote') {
- toast(`Bringing ${peerName}'s “${c.root}” folder over…`, 'info');
+ toast($t('locConflict.bringingToast', { peer: peerName, root: c.root }), 'info');
}
showDiff = false;
} catch (e) {
@@ -93,12 +94,29 @@
}
}
- const fmtMs = (ms) => (ms ? new Date(ms).toLocaleString() : 'unknown');
+ const fmtMs = (ms) => (ms ? new Date(ms).toLocaleString() : $t('conflict.unknown'));
const fmtSize = (n) =>
n < 0 ? '—' : n >= 1048576 ? (n / 1048576).toFixed(1) + ' MB' : n >= 1024 ? (n / 1024).toFixed(1) + ' KB' : n + ' B';
const diffIcon = (s) => (s === 'changed' ? '✱' : s === 'only-remote' ? '+' : '−');
const diffLabel = (s) =>
- s === 'changed' ? 'differs' : s === 'only-remote' ? `only on ${peerName}` : 'only on this device';
+ s === 'changed'
+ ? $t('conflict.differs')
+ : s === 'only-remote'
+ ? $t('conflict.onlyOnPeer', { peer: peerName })
+ : $t('conflict.onlyOnDevice');
+
+ // The hint paragraph reads as one sentence stream in every language; the
+ // option names arrive already quoted and are bolded in place.
+ const hintUndoParams = (peerName) => ({
+ mine: $t('conflict.keepMineQuoted'),
+ theirs: $t('locConflict.useTheirsQuoted', { peer: peerName }),
+ peer: peerName
+ });
+ $: hintUndoParts = segments(
+ $t('locConflict.hintUndo', hintUndoParams(peerName)),
+ hintUndoParams(peerName),
+ ['mine', 'theirs']
+ );
$: localMs = current?.localStats?.latestMtimeMs ?? 0;
$: remoteMs = current?.remoteStats?.latestMtimeMs ?? 0;
@@ -111,9 +129,9 @@
function sideSummary(stats) {
const files = stats?.files;
- if (files === 0) return 'folder is empty';
+ if (files === 0) return $t('locConflict.folderEmpty');
if (typeof files !== 'number') return '';
- return `whole folder: ${files} file${files === 1 ? '' : 's'} · ${fmtSize(stats?.totalBytes ?? -1)}`;
+ return $t('locConflict.wholeFolder', { n: files, size: fmtSize(stats?.totalBytes ?? -1) });
}
@@ -122,49 +140,45 @@
{#if current}
- This is one of {gameName}'s extra save folders, and it changed on both this device and
- {peerName}. The game's main save is unaffected and keeps syncing; only this
- folder is waiting on you.
+ {#each segments($t('locConflict.desc', { game: gameName, peer: peerName }), { game: gameName, peer: peerName }, ['peer']) as part}{#if part.bold}{part.text}{:else}{part.text}{/if}{/each}
- This device
- {#if newerSide === 'local'}changed more recently{/if}
+ {$t('conflict.thisDevice')}
+ {#if newerSide === 'local'}{$t('locConflict.changedRecently')}{/if}
- A snapshot of every one of this game's folders is taken before either choice is applied,
- so both are undoable from the Snapshots tab. “Keep mine” makes this
- device's copy the shared one and asks {peerName} to take it — {peerName} gets its own say if
- it has newer work. “Use {peerName}'s” brings their copy here.
+
+ {#each hintUndoParts as part}{#if part.bold}{part.text}{:else}{part.text}{/if}{/each}
- There is no “keep both” for a folder: that option puts the other copy on a branch, and
- branches cover the whole game rather than one of its folders.
+ {$t('locConflict.hintNoKeepBoth')}
diff --git a/cmd/opensave-app/frontend/src/locales/en.json b/cmd/opensave-app/frontend/src/locales/en.json
index bbdc2ddb..29586171 100644
--- a/cmd/opensave-app/frontend/src/locales/en.json
+++ b/cmd/opensave-app/frontend/src/locales/en.json
@@ -1,6 +1,172 @@
{
"settings.language": "Language",
"settings.systemDefault": "System default",
+ "settings.storage.spaceUsed": "Space used",
+ "settings.storage.canRestore": "Can they be restored?",
+ "settings.storage.snapshotStorage": "Snapshot storage",
+ "settings.storage.snapshotsFolder": "Snapshots folder",
+ "settings.storage.browse": "Browse",
+ "settings.storage.snapshotsFolderHint": "Where version-history snapshots (ZIP archives) are stored.",
+ "settings.storage.safetyFolder": "Pre-sync safety backups folder",
+ "settings.storage.safetyFolderPlaceholder": "Default: ~/.opensave/backups",
+ "settings.storage.safetyFolderHint": "A safety copy of your save is taken here before every incoming sync, so a bad sync is always reversible.",
+ "settings.storage.retention": "Retention",
+ "settings.storage.autoDelete": "Auto-delete old automatic snapshots",
+ "settings.storage.autoDeleteHint": "The snapshots OpenSave takes on its own — before a sync replaces files, when a game saves, at a conflict. Snapshots you took yourself are kept, and so is the newest one on every branch, whatever its age. Runs shortly after start and every few hours.",
+ "settings.storage.deleteOlderThan": "Delete when older than",
+ "settings.storage.days": {
+ "one": "{n} day",
+ "other": "{n} days"
+ },
+ "settings.storage.snapshotHistory": "Snapshot history",
+ "settings.storage.maxAuto": "Automatic snapshots to keep per game",
+ "settings.storage.maxAutoHint": "Default limit for newly tracked games (0 = keep everything). The oldest are pruned first, per branch. Change a single game's limit in its Configuration tab.",
+ "settings.storage.maxManual": "Manual snapshots to keep per game",
+ "settings.storage.maxManualHint": "Snapshots you take yourself have their own budget, so games that auto-save often (Elden Ring, Dragonsword) can't push them out. {forever}, which is the default.",
+ "settings.storage.keepForever": "0 = keep forever",
+ "settings.storage.applying": "Applying…",
+ "settings.storage.applyLimits": "Apply these limits to every game",
+ "settings.storage.applyLimitsHint": "Replaces each game's own limits with these, then deletes the snapshots beyond them on every branch. To clean up with each game's own limits, use Space used above.",
+ "settings.storage.scanner": "Game scanner",
+ "settings.storage.scanPaths": "Extra folders to scan",
+ "settings.storage.scanPathsHint": "Scanning already checks Steam and common emulators — add custom libraries here.",
+ "settings.remove": "Remove",
+ "settings.storage.addFolder": "Add folder",
+ "settings.storage.excludePaths": "Folders to exclude",
+ "settings.storage.excludePathsHint": "Scans skip these folders and everything inside them — handy for stale save locations (like an old GSE saves directory) you don't want offered again.",
+ "settings.storage.excludeFolder": "Exclude folder",
+ "settings.reset.title": "Reset tracking",
+ "settings.reset.hint": "Untrack every game at once, then scan again to add them back from the correct locations — useful after moving games between launchers or drives. This only clears the tracking list; your save snapshots on disk are kept.",
+ "settings.reset.inProgress": "Untracking…",
+ "settings.reset.none": "No games tracked",
+ "settings.reset.button": {
+ "one": "Untrack all {n} game",
+ "other": "Untrack all {n} games"
+ },
+ "settings.advanced.network": "Network",
+ "settings.advanced.daemonPort": "Daemon port",
+ "settings.advanced.daemonPortHint": "The port this device listens on, for the app and for your other devices on the network. Changing it requires a restart.",
+ "settings.advanced.pathTranslation": "Cross-platform path translation",
+ "settings.advanced.pathTranslationHint": "Rewrites another device's save paths to this one's conventions, e.g. \"C:\\Users\\me\\Saves\" → \"/home/deck/saves\".",
+ "settings.advanced.fromPattern": "From pattern",
+ "settings.advanced.toPattern": "To pattern",
+ "settings.advanced.addRule": "Add rule",
+ "settings.support.title": "Support OpenSave",
+ "settings.support.lede": "Free and open source, and it stays that way — no accounts, no ads, no telemetry, and nothing locked behind a payment.",
+ "settings.support.body": "It's built and maintained in spare time. If it's saved you the hassle of copying save folders between machines, you're welcome to chip in.",
+ "settings.support.point1": "Keeps the public relay online",
+ "settings.support.point2": "More games and emulators detected",
+ "settings.support.point3": "Time for fixes and new features",
+ "settings.support.openAgain": "Open again",
+ "settings.support.openDonate": "Open donation page",
+ "settings.support.openedToast": "Opened in your browser — thank you.",
+ "settings.support.foot": "Prefer not to donate? Reporting a bug or suggesting a feature helps just as much.",
+ "settings.support.scanToPay": "Scan to pay",
+ "settings.support.fromPhone": "from your phone",
+ "settings.support.note": "Payment is handled entirely by Gumroad — OpenSave never sees your card details.",
+ "settings.sync.unknownGameHint": "Tracking automatically works out a folder from where the game lives on the other device, which is why OpenSave usually needs no setup.",
+ "settings.title": "Settings",
+ "settings.saveState.saving": "Saving…",
+ "settings.saveState.notSaved": "Not saved: the {field} — {why}",
+ "settings.saveState.saveFailed": "Couldn't save: {error}",
+ "settings.saveState.saved": "Saved",
+ "settings.saveState.autosave": "Changes save as you make them",
+ "settings.tab.general": "General",
+ "settings.tab.sync": "Sync",
+ "settings.tab.storage": "Storage",
+ "settings.tab.advanced": "Advanced",
+ "settings.tab.support": "Support",
+ "settings.discord.title": "Open the OpenSave Discord in your browser",
+ "settings.field.relayUrl": "relay URL",
+ "settings.field.relayPort": "relay hosting port",
+ "settings.field.port": "daemon port",
+ "settings.field.deviceName": "device name",
+ "settings.field.backupsDir": "snapshots folder",
+ "settings.field.syncBackupsDir": "safety backups folder",
+ "settings.field.pathTranslations": "path rules",
+ "settings.cleanUp.saveFailed": "The limits couldn't be saved: {error}",
+ "settings.cleanUp.removed": {
+ "one": "Removed {n} old snapshot, freed {mb} MB",
+ "other": "Removed {n} old snapshots, freed {mb} MB"
+ },
+ "settings.cleanUp.none": "Nothing to clean up — all games are within their limit",
+ "settings.storage.pickDialog": "Select snapshots storage folder",
+ "settings.storage.pickSyncDialog": "Select pre-sync safety backups folder",
+ "settings.storage.scanAddDialog": "Add a folder to scan",
+ "settings.storage.excludeAddDialog": "Choose a folder to exclude from scans",
+ "settings.reset.confirmBody": {
+ "one": "Untrack all {n} game? They'll be removed from your library so you can re-add them from the correct locations. Your save snapshots on disk are kept — nothing is deleted.",
+ "other": "Untrack all {n} games? They'll be removed from your library so you can re-add them from the correct locations. Your save snapshots on disk are kept — nothing is deleted."
+ },
+ "settings.reset.confirmTitle": "Reset tracking?",
+ "settings.reset.confirmAction": "Untrack {n}",
+ "settings.reset.doneToast": {
+ "one": "Untracked {n} game — snapshots kept",
+ "other": "Untracked {n} games — snapshots kept"
+ },
+ "settings.general.deviceIdentity": "Device identity",
+ "settings.general.deviceName": "Device name — how other devices see you",
+ "settings.general.deviceType": "Device type",
+ "settings.general.type.desktop": "Desktop (Windows / macOS / Linux PC)",
+ "settings.general.type.deck": "Steam Deck (SteamOS handheld)",
+ "settings.general.type.handheld": "Handheld (ROG Ally / Legion Go / emulator)",
+ "settings.general.type.mobile": "Companion (mobile device)",
+ "settings.general.typeHint": "Shown to other devices when they discover you.",
+ "settings.general.deviceId": "Device ID",
+ "settings.general.deviceIdHint": "This device's unique network identifier (read-only).",
+ "settings.general.appearance": "Appearance",
+ "settings.general.controller": "Controller",
+ "settings.general.notifications": "Notifications",
+ "settings.general.library": "Library",
+ "settings.general.libraryHint": "How your games are laid out on Home. Changes apply straight away.",
+ "settings.general.setupGuide": "Setup guide",
+ "settings.general.setupGuideHint": "The getting-started checklist on Home: find your saves, add your other devices, back up to the cloud.",
+ "settings.general.showSetupAgain": "Show it again",
+ "settings.general.startup": "Startup",
+ "settings.general.startOnBoot": "Start OpenSave when the computer starts",
+ "settings.general.startOnBootHint": "Launches minimized to the system tray so syncing runs in the background.",
+ "settings.general.updates": "Updates",
+ "settings.general.offerBetas": "Offer me beta versions",
+ "settings.general.betasOnPreRelease": "You're running {version}, which is a beta, so you'll be offered newer betas whether or not this is ticked — otherwise there'd be no way forward until the final release caught up. Untick it and you'll move to the stable release as soon as it's newer than what you have.",
+ "settings.general.betasStable": "Betas ship early with the newest fixes and are less tested. You'll be offered the stable release whenever it's newer, so this isn't a one-way door.",
+ "settings.sync.behavior": "Sync behavior",
+ "settings.sync.autoSyncOnTrack": "Sync a game immediately when it's first tracked",
+ "settings.sync.detectNewGames": "Tell me when a game turns up with saves OpenSave isn't keeping",
+ "settings.sync.detectNewGamesHint": "OpenSave looks every hour, in the background, and only mentions games it hasn't seen before. Nothing is tracked until you choose it.",
+ "settings.sync.matchByAppId": "Match saves across PCs by Steam App ID",
+ "settings.sync.matchByAppIdHint": "Links the same game across devices even when it was tracked under different names or drives.",
+ "settings.sync.matchByAppIdMore": "For example a Steam copy on one PC and a standalone copy on another. Leave this off if you deliberately keep two separate copies of the same game that shouldn't merge. You can always link games by hand from a game's page.",
+ "settings.sync.unknownGameLabel": "When another device syncs a game this one doesn't have",
+ "settings.sync.unknownGame.track": "Start tracking it automatically (recommended)",
+ "settings.sync.unknownGame.ask": "Ask me where to keep it",
+ "settings.sync.unknownGameMore": "Choose {askMe} if your saves are somewhere that guess would get wrong — a second drive, a folder you moved, or a game that keeps saves in a folder named after your account. Games waiting for a folder appear on the Home page.",
+ "settings.sync.askShort": "Ask me",
+ "settings.sync.bandwidthLimit": "Internet bandwidth limit",
+ "settings.sync.speed.unlimited": "Unlimited (max speed)",
+ "settings.sync.speed.low": "100 KB/s (very low)",
+ "settings.sync.speed.medium": "500 KB/s (medium)",
+ "settings.sync.speed.high": "1 MB/s (high)",
+ "settings.sync.speed.veryHigh": "5 MB/s (very high)",
+ "settings.sync.speed.ultra": "10 MB/s (ultra)",
+ "settings.sync.speedHint": "Only applies to relay (internet) syncs — LAN is never throttled.",
+ "settings.sync.relay": "Internet relay",
+ "settings.sync.relayUrl": "WebSocket relay URL",
+ "settings.sync.relayUrlHint": "The relay that carries syncs across the internet. Join a room from {internetSync}.",
+ "settings.sync.internetSync": "Internet Sync",
+ "settings.sync.hostRelay": "Host a WAN relay server on this device",
+ "settings.sync.hostRelayHint": "Lets friends connect directly to you instead of the public relay.",
+ "settings.sync.relayPort": "Relay hosting port",
+ "settings.sync.relayPortHint": "Forward this TCP port on your router so friends on the internet can reach you.",
+ "settings.sync.lookingUp": "Looking up…",
+ "settings.sync.hideAddresses": "Hide my addresses",
+ "settings.sync.showAddresses": "Show my addresses to share",
+ "settings.sync.shareTitle": "Share these with your friend",
+ "settings.sync.lanIps": "LAN IPs:",
+ "settings.sync.publicIp": "Public IP:",
+ "settings.sync.unavailable": "unavailable",
+ "settings.sync.relayPortLabel": "Relay port:",
+ "settings.sync.cloudBackupHint": "Where backups go, whether every snapshot is sent there, and whether newer saves are brought from your other devices are all set on the Cloud Backup page.",
+ "settings.sync.openCloudBackup": "Open Cloud Backup",
"common.cancel": "Cancel",
"common.nowTracking": "Now tracking \"{name}\"",
"home.addGame.adding": "Adding…",
@@ -343,6 +509,84 @@
"pause.pauseTitle": "Stop syncing with your other devices for a while — snapshots are still taken",
"pause.resume": "Resume syncing",
"pause.resumeTitle": "Syncing is paused {length}. Snapshots are still taken. Resume now to catch up.",
+ "conflict.title": "Save conflict — {game}",
+ "conflict.desc": "Both this device and {peer} changed this save since the last sync. Pick which version to play from.",
+ "conflict.thisDevice": "This device",
+ "conflict.playedRecently": "played more recently",
+ "conflict.diffHere": {
+ "one": "{n} file differs here",
+ "other": "{n} files differ here"
+ },
+ "conflict.diffThere": {
+ "one": "{n} file differs there",
+ "other": "{n} files differ there"
+ },
+ "conflict.onlyHere": "{n} only on this device",
+ "conflict.onlyThere": "{n} only on {peer}",
+ "conflict.lastChange": "last change {time}",
+ "conflict.saveFolderEmpty": "save folder is empty",
+ "conflict.wholeSave": {
+ "one": "whole save: {n} file · {size}",
+ "other": "whole save: {n} files · {size}"
+ },
+ "conflict.diffCapped": "Counts above cover the first {shown} of {total} differing files.",
+ "conflict.keepMine": "Keep mine",
+ "conflict.keepTheirs": "Keep theirs",
+ "conflict.keepBoth": "Keep both (recommended)",
+ "conflict.keepBothName": "Keep both",
+ "conflict.consequenceKeepBoth": "{mine} / {both}: nothing is deleted.",
+ "conflict.broughtHere": {
+ "one": "The {n} file only on {peer} is brought here;",
+ "other": "The {n} files only on {peer} are brought here;"
+ },
+ "conflict.keptWhere": "where both have a file, yours is kept.",
+ "conflict.consequenceKeepTheirs": "{theirs}:",
+ "conflict.deletesFiles": {
+ "one": "deletes 1 file",
+ "other": "deletes {n} files"
+ },
+ "conflict.deletesTail": " that only this device has (snapshotted first).",
+ "conflict.deletesNothing": "nothing only this device has is lost.",
+ "conflict.diffToggle": {
+ "one": "What's different (1 file)",
+ "other": "What's different ({n} files)"
+ },
+ "conflict.diffMore": "…and {n} more",
+ "conflict.decideLater": "Decide later",
+ "conflict.decideLaterTitle": "Nothing of this game syncs until you decide. Open the game to decide.",
+ "conflict.keepTheirsTitle": {
+ "one": "Deletes 1 file only this device has",
+ "other": "Deletes {n} files only this device has"
+ },
+ "conflict.hintAll": "Nothing is lost whichever you pick. {both} (recommended) keeps playing yours — {peer} receives it too — and keeps {peer}'s version here on a branch you can switch to. {mine} makes your version the shared one — {peer} receives it (their old save is snapshotted first). {theirs} adopts {peer}'s version here, snapshotting yours first. Restore anything from the game's Snapshots / Branches tabs.",
+ "conflict.keepMineQuoted": "“Keep mine”",
+ "conflict.keepTheirsQuoted": "“Keep theirs”",
+ "conflict.keepBothQuoted": "“Keep both”",
+ "conflict.attentionBody": "Its save changed here and on another device at once — choose which to keep.",
+ "conflict.attentionToast": "Save conflict for “{name}” — choose which version to keep",
+ "conflict.applyingToast": "Applying your choice for “{name}” — transferring {peer}'s files…",
+ "conflict.differs": "differs",
+ "conflict.onlyOnPeer": "only on {peer}",
+ "conflict.onlyOnDevice": "only on this device",
+ "conflict.otherDevice": "the other device",
+ "conflict.aGame": "a game",
+ "conflict.unknown": "unknown",
+ "locConflict.title": "“{root}” folder — {game}",
+ "locConflict.desc": "This is one of {game}'s extra save folders, and it changed on both this device and {peer}. The game's main save is unaffected and keeps syncing; only this folder is waiting on you.",
+ "locConflict.changedRecently": "changed more recently",
+ "locConflict.folderEmpty": "folder is empty",
+ "locConflict.wholeFolder": {
+ "one": "whole folder: {n} file · {size}",
+ "other": "whole folder: {n} files · {size}"
+ },
+ "locConflict.attentionBody": "Its “{root}” folder differs on both devices — choose which to keep.",
+ "locConflict.attentionToast": "The “{root}” folder of “{game}” differs on both devices",
+ "locConflict.bringingToast": "Bringing {peer}'s “{root}” folder over…",
+ "locConflict.decideLaterTitle": "Nothing of this folder syncs until you decide. Open the game to decide.",
+ "locConflict.useTheirs": "Use {peer}'s",
+ "locConflict.useTheirsQuoted": "“Use {peer}'s”",
+ "locConflict.hintUndo": "A snapshot of every one of this game's folders is taken before either choice is applied, so both are undoable from the Snapshots tab. {mine} makes this device's copy the shared one and asks {peer} to take it — {peer} gets its own say if it has newer work. {theirs} brings their copy here.",
+ "locConflict.hintNoKeepBoth": "There is no “keep both” for a folder: that option puts the other copy on a branch, and branches cover the whole game rather than one of its folders.",
"common.open": "Open",
"home.trackGame": "Track game",
"home.trackGameHint": "Find a game by name, or choose its program or save folder",
@@ -393,5 +637,66 @@
"game.config.deviceSettingsHint": "The game database lists these as this game's settings, not its save, so each device keeps its own (graphics, resolution). They are still in every snapshot.",
"notifications.clearAll": "Clear all",
"notifications.clearAllTitle": "Take these out of the bell. Activity still has them.",
- "palette.renameGame": "Rename {game}"
+ "palette.renameGame": "Rename {game}",
+ "devices.title": "Devices",
+ "devices.paired": "Paired devices",
+ "devices.noPaired": "No paired devices",
+ "devices.noPairedHint": "Pair a device below — on your Wi-Fi it appears automatically, or connect over the internet with a room code.",
+ "devices.statusOnline": "Online",
+ "devices.statusOffline": "Offline",
+ "devices.internetRelay": "internet relay",
+ "devices.lastSynced": "last synced {time}",
+ "devices.never": "never",
+ "devices.opensaveVersion": "OpenSave {version}",
+ "devices.fixThis": "Fix this",
+ "devices.trustTooltip": "For your own devices: games it syncs go in the folder it names, even one this device doesn't recognise as a save, instead of waiting on Home for you.",
+ "devices.trustLabel": "Trust it to choose folders",
+ "devices.updateFromThis": "Update from this device",
+ "devices.unpair": "Unpair",
+ "devices.addDevice": "Add a device",
+ "devices.onThisNetwork": "On this network",
+ "devices.overInternet": "Over the internet",
+ "devices.lanIntro": "Devices running OpenSave on the same Wi-Fi/Ethernet discover each other automatically. No setup needed.",
+ "devices.foundOnNetwork": "Found on your network",
+ "devices.noLanFound": "No unpaired devices found on the local network. Make sure OpenSave is running on the other device.",
+ "devices.pair": "Pair",
+ "devices.addByIp": "Add by IP address",
+ "devices.sendPairing": "Send pairing request",
+ "devices.pairingSentTo": "Pairing request sent to {name}",
+ "devices.pairingSent": "Pairing request sent",
+ "devices.unpairConfirmTitle": "Unpair device?",
+ "devices.unpairConfirmBody": "Unpair \"{name}\"? Their games stay on both devices; syncing between you stops.",
+ "devices.unpairConfirmText": "Unpair",
+ "devices.unpaired": "Unpaired {name}",
+ "devices.trustConfirmTitle": "Trust \"{name}\" to choose folders?",
+ "devices.trustConfirmBody": "Only do this for a device that is yours. When \"{name}\" syncs a game this device doesn't recognise, its saves go in the folder \"{name}\" names, instead of waiting on Home for you to choose one.",
+ "devices.trustConfirmText": "Trust it",
+ "devices.canChooseFolders": "{name} can choose folders here",
+ "devices.noLongerChooses": "{name} no longer chooses folders here",
+ "devices.repairConfirmTitle": "Unpair, so you can pair again?",
+ "devices.repairConfirmBody": "Unpair \"{name}\", then pair the two devices again so they exchange an encryption key. Their games and saves stay where they are. Nothing syncs between these two devices until you pair them again.",
+ "devices.repairConfirmText": "Unpair now",
+ "devices.repairedToast": "Unpaired {name} — pair the two devices again to encrypt what you sync",
+ "devices.updateConfirmTitle": "Update OpenSave?",
+ "devices.updateConfirmBody": "{name} is running a newer OpenSave build ({version}). Download it from {name} and update this device? OpenSave restarts itself when done.",
+ "devices.updateConfirmText": "Update & restart",
+ "app.updatingDownloading": "Updating OpenSave — downloading {n}%…",
+ "app.installingUpdate": "Installing update…",
+ "app.restartingVersion": "Restarting with the new version…",
+ "app.restartsItself": "The app restarts itself when done — your games keep syncing.",
+ "app.updateAvailable": "OpenSave {latest} is available — you're on {current}.",
+ "app.hideNotes": "Hide notes",
+ "app.whatsNew": "What's new",
+ "app.starting": "Starting…",
+ "app.installRestart": "Install & restart",
+ "app.getFlatpak": "Get .flatpak",
+ "app.download": "Download",
+ "app.updatedTo": "OpenSave was updated to v{version}.",
+ "app.failedToStart": "OpenSave failed to start",
+ "app.retrying": "Retrying…",
+ "app.retry": "Retry",
+ "app.detailsSaved": "Details are saved to .opensave\\opensave.log in your user folder.",
+ "app.startingOpenSave": "Starting OpenSave…",
+ "app.emptiedBody": "Every save file of {name} was deleted here. Your other devices keep theirs until you choose.",
+ "app.choose": "Choose"
}
diff --git a/cmd/opensave-app/frontend/src/locales/zh-Hans.json b/cmd/opensave-app/frontend/src/locales/zh-Hans.json
index 82c5e045..52944a8c 100644
--- a/cmd/opensave-app/frontend/src/locales/zh-Hans.json
+++ b/cmd/opensave-app/frontend/src/locales/zh-Hans.json
@@ -1,6 +1,157 @@
{
"settings.language": "语言",
"settings.systemDefault": "跟随系统",
+ "settings.storage.spaceUsed": "已用空间",
+ "settings.storage.canRestore": "快照能否恢复?",
+ "settings.storage.snapshotStorage": "快照存储",
+ "settings.storage.snapshotsFolder": "快照文件夹",
+ "settings.storage.browse": "浏览",
+ "settings.storage.snapshotsFolderHint": "版本历史快照(ZIP 压缩包)的存储位置。",
+ "settings.storage.safetyFolder": "同步前安全备份文件夹",
+ "settings.storage.safetyFolderPlaceholder": "默认:~/.opensave/backups",
+ "settings.storage.safetyFolderHint": "每次接收同步之前都会在此保存一份存档的安全副本,因此糟糕的同步总是可以撤销。",
+ "settings.storage.retention": "保留策略",
+ "settings.storage.autoDelete": "自动删除旧的自动快照",
+ "settings.storage.autoDeleteHint": "OpenSave 自己拍摄的快照——在同步替换文件之前、游戏保存时、发生冲突时。您自己拍摄的快照会保留,每个分支上最新的一个也会保留,无论其存在多久。在启动后不久以及每隔几小时运行一次。",
+ "settings.storage.deleteOlderThan": "删除早于此时间的快照",
+ "settings.storage.days": "{n} 天",
+ "settings.storage.snapshotHistory": "快照历史",
+ "settings.storage.maxAuto": "每个游戏保留的自动快照数",
+ "settings.storage.maxAutoHint": "新跟踪游戏的默认上限(0 = 全部保留)。最先删除最旧的,按分支计算。单个游戏的上限可在其配置标签页中修改。",
+ "settings.storage.maxManual": "每个游戏保留的手动快照数",
+ "settings.storage.maxManualHint": "您自己拍摄的快照有独立的额度,因此频繁自动存档的游戏(如 Elden Ring、Dragonsword)无法把它们挤掉。{forever},这是默认值。",
+ "settings.storage.keepForever": "0 = 永久保留",
+ "settings.storage.applying": "正在应用…",
+ "settings.storage.applyLimits": "将这些上限应用到每个游戏",
+ "settings.storage.applyLimitsHint": "用这些上限替换每个游戏自己的上限,然后删除每个分支上超出上限的快照。要按每个游戏自己的上限清理,请使用上方的“已用空间”。",
+ "settings.storage.scanner": "游戏扫描器",
+ "settings.storage.scanPaths": "额外扫描的文件夹",
+ "settings.storage.scanPathsHint": "扫描已覆盖 Steam 和常见模拟器——在此添加自定义游戏库。",
+ "settings.remove": "移除",
+ "settings.storage.addFolder": "添加文件夹",
+ "settings.storage.excludePaths": "要排除的文件夹",
+ "settings.storage.excludePathsHint": "扫描会跳过这些文件夹及其中的所有内容——适合陈旧的存档位置(如旧的 GSE 存档目录),您不想再次看到它们。",
+ "settings.storage.excludeFolder": "排除文件夹",
+ "settings.reset.title": "重置跟踪",
+ "settings.reset.hint": "一次性取消跟踪所有游戏,然后重新扫描以从正确的位置添加回来——在启动器或硬盘之间移动游戏后很有用。这只会清除跟踪列表;磁盘上的存档快照会保留。",
+ "settings.reset.inProgress": "正在取消跟踪…",
+ "settings.reset.none": "未跟踪任何游戏",
+ "settings.reset.button": "取消跟踪全部 {n} 个游戏",
+ "settings.advanced.network": "网络",
+ "settings.advanced.daemonPort": "守护进程端口",
+ "settings.advanced.daemonPortHint": "此设备监听的端口,供应用和网络上您的其他设备使用。更改后需要重启。",
+ "settings.advanced.pathTranslation": "跨平台路径转换",
+ "settings.advanced.pathTranslationHint": "将其他设备的存档路径重写为本机的约定,例如 \"C:\\Users\\me\\Saves\" → \"/home/deck/saves\"。",
+ "settings.advanced.fromPattern": "来源模式",
+ "settings.advanced.toPattern": "目标模式",
+ "settings.advanced.addRule": "添加规则",
+ "settings.support.title": "支持 OpenSave",
+ "settings.support.lede": "免费且开源,并将一直如此——没有账号、没有广告、没有遥测,也没有任何内容锁在付费墙后。",
+ "settings.support.body": "它由业余时间构建和维护。如果它为您省去了在机器之间复制存档文件夹的麻烦,欢迎您出一份力。",
+ "settings.support.point1": "让公共中继保持在线",
+ "settings.support.point2": "检测到更多游戏和模拟器",
+ "settings.support.point3": "有时间修复问题、开发新功能",
+ "settings.support.openAgain": "再次打开",
+ "settings.support.openDonate": "打开捐赠页面",
+ "settings.support.openedToast": "已在您的浏览器中打开——谢谢。",
+ "settings.support.foot": "不想捐赠?提交错误报告或功能建议同样有帮助。",
+ "settings.support.scanToPay": "用手机扫码",
+ "settings.support.fromPhone": "完成支付",
+ "settings.support.note": "支付完全由 Gumroad 处理——OpenSave 永远不会看到您的银行卡信息。",
+ "settings.sync.unknownGameHint": "自动跟踪会根据游戏在其他设备上的位置推算出一个文件夹,这也是 OpenSave 通常无需设置的原因。",
+ "settings.title": "设置",
+ "settings.saveState.saving": "正在保存…",
+ "settings.saveState.notSaved": "未保存:{field} —— {why}",
+ "settings.saveState.saveFailed": "无法保存:{error}",
+ "settings.saveState.saved": "已保存",
+ "settings.saveState.autosave": "更改会随做随存",
+ "settings.tab.general": "常规",
+ "settings.tab.sync": "同步",
+ "settings.tab.storage": "存储",
+ "settings.tab.advanced": "高级",
+ "settings.tab.support": "支持",
+ "settings.discord.title": "在浏览器中打开 OpenSave Discord",
+ "settings.field.relayUrl": "中继 URL",
+ "settings.field.relayPort": "中继托管端口",
+ "settings.field.port": "守护进程端口",
+ "settings.field.deviceName": "设备名称",
+ "settings.field.backupsDir": "快照文件夹",
+ "settings.field.syncBackupsDir": "安全备份文件夹",
+ "settings.field.pathTranslations": "路径规则",
+ "settings.cleanUp.saveFailed": "上限未能保存:{error}",
+ "settings.cleanUp.removed": "已删除 {n} 个旧快照,释放了 {mb} MB",
+ "settings.cleanUp.none": "无可清理——所有游戏都在各自上限之内",
+ "settings.storage.pickDialog": "选择快照存储文件夹",
+ "settings.storage.pickSyncDialog": "选择同步前安全备份文件夹",
+ "settings.storage.scanAddDialog": "添加要扫描的文件夹",
+ "settings.storage.excludeAddDialog": "选择要从扫描中排除的文件夹",
+ "settings.reset.confirmBody": "取消跟踪全部 {n} 个游戏?它们将从您的游戏库中移除,以便您从正确的位置重新添加。磁盘上的存档快照会保留——不会删除任何内容。",
+ "settings.reset.confirmTitle": "重置跟踪?",
+ "settings.reset.confirmAction": "取消跟踪 {n}",
+ "settings.reset.doneToast": "已取消跟踪 {n} 个游戏——快照已保留",
+ "settings.general.deviceIdentity": "设备身份",
+ "settings.general.deviceName": "设备名称——其他设备看到您的名字",
+ "settings.general.deviceType": "设备类型",
+ "settings.general.type.desktop": "桌面电脑(Windows / macOS / Linux PC)",
+ "settings.general.type.deck": "Steam Deck(SteamOS 掌机)",
+ "settings.general.type.handheld": "掌机(ROG Ally / Legion Go / 模拟器)",
+ "settings.general.type.mobile": "伴侣设备(移动设备)",
+ "settings.general.typeHint": "其他设备发现您时会看到此信息。",
+ "settings.general.deviceId": "设备 ID",
+ "settings.general.deviceIdHint": "此设备的唯一网络标识符(只读)。",
+ "settings.general.appearance": "外观",
+ "settings.general.controller": "手柄",
+ "settings.general.notifications": "通知",
+ "settings.general.library": "游戏库",
+ "settings.general.libraryHint": "游戏在主页上的排布方式。更改立即生效。",
+ "settings.general.setupGuide": "设置向导",
+ "settings.general.setupGuideHint": "主页上的入门清单:找到您的存档、添加您的其他设备、备份到云端。",
+ "settings.general.showSetupAgain": "再次显示",
+ "settings.general.startup": "启动",
+ "settings.general.startOnBoot": "开机时启动 OpenSave",
+ "settings.general.startOnBootHint": "以最小化到系统托盘的方式启动,让同步在后台进行。",
+ "settings.general.updates": "更新",
+ "settings.general.offerBetas": "向我提供测试版",
+ "settings.general.betasOnPreRelease": "您正在运行 {version},它本身是测试版,因此无论是否勾选此项,您都会收到更新的测试版——否则在正式版赶上之前您将无路可走。取消勾选后,一旦正式版比您当前的版本更新,您就会切换到正式版。",
+ "settings.general.betasStable": "测试版发布更早、包含最新的修复,但测试程度较低。只要正式版更新,您就会收到正式版,所以这不是一条单行道。",
+ "settings.sync.behavior": "同步行为",
+ "settings.sync.autoSyncOnTrack": "游戏首次被跟踪时立即同步",
+ "settings.sync.detectNewGames": "当出现 OpenSave 未在跟踪其存档的游戏时提醒我",
+ "settings.sync.detectNewGamesHint": "OpenSave 每小时在后台检查一次,只提及它没见过的游戏。在您选择之前不会跟踪任何内容。",
+ "settings.sync.matchByAppId": "按 Steam App ID 跨 PC 匹配存档",
+ "settings.sync.matchByAppIdHint": "即使同一游戏在不同设备上以不同名称或盘符被跟踪,也能将它们关联起来。",
+ "settings.sync.matchByAppIdMore": "例如一台 PC 上的 Steam 版和另一台上的独立版。如果您有意保留同一款游戏互不合并的两份副本,请保持关闭。您随时可以在游戏页面手动关联游戏。",
+ "settings.sync.unknownGameLabel": "当其他设备同步了本机没有的游戏时",
+ "settings.sync.unknownGame.track": "自动开始跟踪(推荐)",
+ "settings.sync.unknownGame.ask": "询问我保存在哪里",
+ "settings.sync.unknownGameMore": "如果您的存档位置可能与自动猜测不符——第二块硬盘、移动过的文件夹,或把存档放在以您的账号命名的文件夹中的游戏——请选择“{askMe}”。等待指定文件夹的游戏会显示在主页上。",
+ "settings.sync.askShort": "询问我",
+ "settings.sync.bandwidthLimit": "网络带宽限制",
+ "settings.sync.speed.unlimited": "不限速(最高速度)",
+ "settings.sync.speed.low": "100 KB/s(很低)",
+ "settings.sync.speed.medium": "500 KB/s(中等)",
+ "settings.sync.speed.high": "1 MB/s(高)",
+ "settings.sync.speed.veryHigh": "5 MB/s(很高)",
+ "settings.sync.speed.ultra": "10 MB/s(极高)",
+ "settings.sync.speedHint": "仅适用于中继(互联网)同步——局域网永远不会被限速。",
+ "settings.sync.relay": "互联网中继",
+ "settings.sync.relayUrl": "WebSocket 中继 URL",
+ "settings.sync.relayUrlHint": "中继在互联网上承载同步。从{internetSync}加入房间。",
+ "settings.sync.internetSync": "联网同步",
+ "settings.sync.hostRelay": "在本设备上托管 WAN 中继服务器",
+ "settings.sync.hostRelayHint": "让朋友直接连接您,而不是经由公共中继。",
+ "settings.sync.relayPort": "中继托管端口",
+ "settings.sync.relayPortHint": "在路由器上转发此 TCP 端口,让互联网上的朋友能够连到您。",
+ "settings.sync.lookingUp": "查询中…",
+ "settings.sync.hideAddresses": "隐藏我的地址",
+ "settings.sync.showAddresses": "显示我的地址以便分享",
+ "settings.sync.shareTitle": "将这些分享给您的朋友",
+ "settings.sync.lanIps": "局域网 IP:",
+ "settings.sync.publicIp": "公网 IP:",
+ "settings.sync.unavailable": "不可用",
+ "settings.sync.relayPortLabel": "中继端口:",
+ "settings.sync.cloudBackupHint": "备份的去向、每个快照是否都发送到那里、以及是否从其他设备取回较新的存档,这些都在“云备份”页面设置。",
+ "settings.sync.openCloudBackup": "打开云备份",
"common.cancel": "取消",
"common.nowTracking": "已开始跟踪“{name}”",
"home.addGame.adding": "添加中…",
@@ -301,6 +452,60 @@
"pause.pauseTitle": "暂时停止与其他设备同步——快照仍会创建",
"pause.resume": "恢复同步",
"pause.resumeTitle": "同步已暂停({length})。快照仍会创建。立即恢复以补齐。",
+ "conflict.title": "存档冲突 — {game}",
+ "conflict.desc": "本设备与 {peer} 在上次同步之后都改动了这个存档。请选择要从哪个版本继续游玩。",
+ "conflict.thisDevice": "本设备",
+ "conflict.playedRecently": "最近游玩过",
+ "conflict.diffHere": "{n} 个文件在这里有差异",
+ "conflict.diffThere": "{n} 个文件在那里有差异",
+ "conflict.onlyHere": "{n} 个仅此设备有",
+ "conflict.onlyThere": "{n} 个仅 {peer} 有",
+ "conflict.lastChange": "最后改动于 {time}",
+ "conflict.saveFolderEmpty": "存档文件夹为空",
+ "conflict.wholeSave": "整个存档:{n} 个文件 · {size}",
+ "conflict.diffCapped": "上方的计数仅覆盖 {total} 个有差异文件中的前 {shown} 个。",
+ "conflict.keepMine": "保留我的",
+ "conflict.keepTheirs": "保留对方的",
+ "conflict.keepBoth": "两者都保留(推荐)",
+ "conflict.keepBothName": "两者都保留",
+ "conflict.consequenceKeepBoth": "{mine} / {both}:不会删除任何文件。",
+ "conflict.broughtHere": "{peer} 独有的 {n} 个文件会被带到这里;",
+ "conflict.keptWhere": "双方都有的文件则保留你的版本。",
+ "conflict.consequenceKeepTheirs": "{theirs}:",
+ "conflict.deletesFiles": "删除 {n} 个文件",
+ "conflict.deletesTail": ",这些文件只有此设备才有(会先快照)。",
+ "conflict.deletesNothing": "不会丢失此设备独有的任何文件。",
+ "conflict.diffToggle": "有什么不同({n} 个文件)",
+ "conflict.diffMore": "…还有 {n} 个",
+ "conflict.decideLater": "稍后决定",
+ "conflict.decideLaterTitle": "在你做出决定之前,这个游戏不会同步。打开该游戏即可做出决定。",
+ "conflict.keepTheirsTitle": "将删除 {n} 个仅此设备有的文件",
+ "conflict.hintAll": "无论选择哪一个都不会丢失数据。{both}(推荐)会继续使用你的版本——{peer} 也会收到它——同时会把 {peer} 的版本保留在这里的一个分支上,你可以切换过去。{mine} 会把你的版本设为共享版本——{peer} 会收到它(对方的旧存档会先快照)。{theirs} 会在这里采用 {peer} 的版本,你的版本会先快照。随时可以在游戏的“快照 / 分支”标签页恢复任何内容。",
+ "conflict.keepMineQuoted": "“保留我的”",
+ "conflict.keepTheirsQuoted": "“保留对方的”",
+ "conflict.keepBothQuoted": "“两者都保留”",
+ "conflict.attentionBody": "这个存档在本设备与另一台设备上同时发生了改动——请选择要保留哪个。",
+ "conflict.attentionToast": "“{name}”出现存档冲突——请选择要保留的版本",
+ "conflict.applyingToast": "正在应用你对“{name}”的选择——正在传输 {peer} 的文件…",
+ "conflict.differs": "有差异",
+ "conflict.onlyOnPeer": "仅 {peer} 有",
+ "conflict.onlyOnDevice": "仅此设备有",
+ "conflict.otherDevice": "另一台设备",
+ "conflict.aGame": "某个游戏",
+ "conflict.unknown": "未知",
+ "locConflict.title": "“{root}”文件夹 — {game}",
+ "locConflict.desc": "这是 {game} 的一个额外存档文件夹,本设备与 {peer} 都改动了它。游戏的主存档不受影响、会继续同步;只有这个文件夹在等你处理。",
+ "locConflict.changedRecently": "最近改动过",
+ "locConflict.folderEmpty": "文件夹为空",
+ "locConflict.wholeFolder": "整个文件夹:{n} 个文件 · {size}",
+ "locConflict.attentionBody": "它的“{root}”文件夹在两台设备上不一致——请选择要保留哪个。",
+ "locConflict.attentionToast": "“{game}”的“{root}”文件夹在两台设备上不一致",
+ "locConflict.bringingToast": "正在拉取 {peer} 的“{root}”文件夹…",
+ "locConflict.decideLaterTitle": "在你做出决定之前,这个文件夹不会同步。打开该游戏即可做出决定。",
+ "locConflict.useTheirs": "使用{peer}的",
+ "locConflict.useTheirsQuoted": "“使用{peer}的”",
+ "locConflict.hintUndo": "无论选择哪一项,都会先对这个游戏的每个文件夹拍快照,因此两个选择都可以在“快照”标签页撤销。{mine} 会把本设备的副本设为共享版本,并让 {peer} 接收它——如果 {peer} 有更新的进度,它会自行决定是否接受。{theirs} 会把对方的副本同步过来。",
+ "locConflict.hintNoKeepBoth": "文件夹没有“两者都保留”选项:该选项会把另一份副本放到分支上,而分支覆盖的是整个游戏,而不是其中某个文件夹。",
"common.open": "打开",
"home.trackGame": "跟踪游戏",
"home.trackGameHint": "按名称查找游戏,或选择其程序或存档文件夹",
@@ -345,5 +550,66 @@
"game.config.deviceSettingsHint": "游戏数据库将这些文件列为该游戏的设置而非存档,因此每台设备保留各自的设置(画质、分辨率)。它们仍包含在每个快照中。",
"notifications.clearAll": "清除全部",
"notifications.clearAllTitle": "将这些从铃铛移除,活动页仍保留",
- "palette.renameGame": "重命名 {game}"
+ "palette.renameGame": "重命名 {game}",
+ "devices.title": "设备",
+ "devices.paired": "已配对的设备",
+ "devices.noPaired": "没有已配对的设备",
+ "devices.noPairedHint": "在下方配对设备——它会自动出现在你的 Wi-Fi 上,或者通过互联网用房间码连接。",
+ "devices.statusOnline": "在线",
+ "devices.statusOffline": "离线",
+ "devices.internetRelay": "互联网中继",
+ "devices.lastSynced": "上次同步 {time}",
+ "devices.never": "从未",
+ "devices.opensaveVersion": "OpenSave {version}",
+ "devices.fixThis": "修复",
+ "devices.trustTooltip": "仅适用于你自己的设备:它同步的游戏会存入它指定的文件夹,即便是本设备未识别为存档的文件夹,而不是等待你在主页选择。",
+ "devices.trustLabel": "信任它来选择文件夹",
+ "devices.updateFromThis": "从此设备更新",
+ "devices.unpair": "取消配对",
+ "devices.addDevice": "添加设备",
+ "devices.onThisNetwork": "本网络",
+ "devices.overInternet": "通过互联网",
+ "devices.lanIntro": "在同一 Wi-Fi/以太网 上运行 OpenSave 的设备会自动互相发现,无需设置。",
+ "devices.foundOnNetwork": "在你的网络上找到",
+ "devices.noLanFound": "在本地网络上未找到未配对的设备。请确认另一台设备正在运行 OpenSave。",
+ "devices.pair": "配对",
+ "devices.addByIp": "通过 IP 地址添加",
+ "devices.sendPairing": "发送配对请求",
+ "devices.pairingSentTo": "已向 {name} 发送配对请求",
+ "devices.pairingSent": "配对请求已发送",
+ "devices.unpairConfirmTitle": "取消配对设备?",
+ "devices.unpairConfirmBody": "取消配对“{name}”?它的游戏会保留在两端设备上;你们之间的同步将停止。",
+ "devices.unpairConfirmText": "取消配对",
+ "devices.unpaired": "已取消配对 {name}",
+ "devices.trustConfirmTitle": "信任“{name}”来选择文件夹?",
+ "devices.trustConfirmBody": "只对你自己的设备这样做。当“{name}”同步本设备未识别为存档的游戏时,它的存档会放入“{name}”指定的文件夹,而不是等待你在主页选择。",
+ "devices.trustConfirmText": "信任它",
+ "devices.canChooseFolders": "{name} 可在此选择文件夹",
+ "devices.noLongerChooses": "{name} 不再在此选择文件夹",
+ "devices.repairConfirmTitle": "取消配对,以便重新配对?",
+ "devices.repairConfirmBody": "取消配对“{name}”,然后再次配对这两台设备,以便它们交换加密密钥。它的游戏与存档保留在原处。在你重新配对之前,这两台设备之间不会同步任何内容。",
+ "devices.repairConfirmText": "现在取消配对",
+ "devices.repairedToast": "已取消配对 {name}——再次配对这两台设备以加密你同步的内容",
+ "devices.updateConfirmTitle": "更新 OpenSave?",
+ "devices.updateConfirmBody": "{name} 正在运行较新的 OpenSave 构建({version})。从 {name} 下载并更新此设备?完成后 OpenSave 会自动重启。",
+ "devices.updateConfirmText": "更新并重启",
+ "app.updatingDownloading": "正在更新 OpenSave——下载 {n}%…",
+ "app.installingUpdate": "正在安装更新…",
+ "app.restartingVersion": "正在以新版本重启…",
+ "app.restartsItself": "完成后应用会自动重启——你的游戏会继续同步。",
+ "app.updateAvailable": "OpenSave {latest} 已可用——你当前为 {current}。",
+ "app.hideNotes": "隐藏说明",
+ "app.whatsNew": "新内容",
+ "app.starting": "正在启动…",
+ "app.installRestart": "安装并重启",
+ "app.getFlatpak": "获取 .flatpak",
+ "app.download": "下载",
+ "app.updatedTo": "OpenSave 已更新至 v{version}。",
+ "app.failedToStart": "OpenSave 启动失败",
+ "app.retrying": "正在重试…",
+ "app.retry": "重试",
+ "app.detailsSaved": "详细信息已保存到你的用户文件夹中的 .opensave\\opensave.log。",
+ "app.startingOpenSave": "正在启动 OpenSave…",
+ "app.emptiedBody": "{name} 的所有存档文件在此处都被删除了。你的其他设备会保留它们,直到你做出选择。",
+ "app.choose": "选择"
}
diff --git a/cmd/opensave-app/frontend/src/locales/zh-Hant.json b/cmd/opensave-app/frontend/src/locales/zh-Hant.json
index d16d969f..e0a467a8 100644
--- a/cmd/opensave-app/frontend/src/locales/zh-Hant.json
+++ b/cmd/opensave-app/frontend/src/locales/zh-Hant.json
@@ -1,6 +1,157 @@
{
"settings.language": "語言",
"settings.systemDefault": "跟隨系統",
+ "settings.storage.spaceUsed": "已用空間",
+ "settings.storage.canRestore": "快照能否恢復?",
+ "settings.storage.snapshotStorage": "快照儲存",
+ "settings.storage.snapshotsFolder": "快照資料夾",
+ "settings.storage.browse": "瀏覽",
+ "settings.storage.snapshotsFolderHint": "版本歷史快照(ZIP 壓縮包)的儲存位置。",
+ "settings.storage.safetyFolder": "同步前安全備份資料夾",
+ "settings.storage.safetyFolderPlaceholder": "預設:~/.opensave/backups",
+ "settings.storage.safetyFolderHint": "每次接收同步之前都會在此儲存一份存檔的安全副本,因此糟糕的同步總是可以撤銷。",
+ "settings.storage.retention": "保留策略",
+ "settings.storage.autoDelete": "自動刪除舊的自動快照",
+ "settings.storage.autoDeleteHint": "OpenSave 自己拍攝的快照——在同步替換檔案之前、遊戲儲存時、發生衝突時。您自己拍攝的快照會保留,每個分支上最新的一個也會保留,無論其存在多久。在啟動後不久以及每隔幾小時執行一次。",
+ "settings.storage.deleteOlderThan": "刪除早於此時間的快照",
+ "settings.storage.days": "{n} 天",
+ "settings.storage.snapshotHistory": "快照歷史",
+ "settings.storage.maxAuto": "每個遊戲保留的自動快照數",
+ "settings.storage.maxAutoHint": "新追蹤遊戲的預設上限(0 = 全部保留)。最先刪除最舊的,按分支計算。單個遊戲的上限可在其配置標籤頁中修改。",
+ "settings.storage.maxManual": "每個遊戲保留的手動快照數",
+ "settings.storage.maxManualHint": "您自己拍攝的快照有獨立的額度,因此頻繁自動存檔的遊戲(如 Elden Ring、Dragonsword)無法把它們擠掉。{forever},這是預設值。",
+ "settings.storage.keepForever": "0 = 永久保留",
+ "settings.storage.applying": "正在應用…",
+ "settings.storage.applyLimits": "將這些上限應用到每個遊戲",
+ "settings.storage.applyLimitsHint": "用這些上限替換每個遊戲自己的上限,然後刪除每個分支上超出上限的快照。要按每個遊戲自己的上限清理,請使用上方的“已用空間”。",
+ "settings.storage.scanner": "遊戲掃描器",
+ "settings.storage.scanPaths": "額外掃描的資料夾",
+ "settings.storage.scanPathsHint": "掃描已覆蓋 Steam 和常見模擬器——在此新增自定義遊戲庫。",
+ "settings.remove": "移除",
+ "settings.storage.addFolder": "新增資料夾",
+ "settings.storage.excludePaths": "要排除的資料夾",
+ "settings.storage.excludePathsHint": "掃描會跳過這些資料夾及其中的所有內容——適合陳舊的存檔位置(如舊的 GSE 存檔目錄),您不想再次看到它們。",
+ "settings.storage.excludeFolder": "排除資料夾",
+ "settings.reset.title": "重置追蹤",
+ "settings.reset.hint": "一次性取消追蹤所有遊戲,然後重新掃描以從正確的位置新增回來——在啟動器或硬碟之間移動遊戲後很有用。這隻會清除追蹤列表;磁碟上的存檔快照會保留。",
+ "settings.reset.inProgress": "正在取消追蹤…",
+ "settings.reset.none": "未追蹤任何遊戲",
+ "settings.reset.button": "取消追蹤全部 {n} 個遊戲",
+ "settings.advanced.network": "網路",
+ "settings.advanced.daemonPort": "守護程序埠",
+ "settings.advanced.daemonPortHint": "此裝置監聽的埠,供應用和網路上您的其他裝置使用。更改後需要重啟。",
+ "settings.advanced.pathTranslation": "跨平臺路徑轉換",
+ "settings.advanced.pathTranslationHint": "將其他裝置的存檔路徑重寫為本機的約定,例如 \"C:\\Users\\me\\Saves\" → \"/home/deck/saves\"。",
+ "settings.advanced.fromPattern": "來源模式",
+ "settings.advanced.toPattern": "目標模式",
+ "settings.advanced.addRule": "新增規則",
+ "settings.support.title": "支援 OpenSave",
+ "settings.support.lede": "免費且開源,並將一直如此——沒有帳號、沒有廣告、沒有遙測,也沒有任何內容鎖在付費牆後。",
+ "settings.support.body": "它由業餘時間構建和維護。如果它為您省去了在機器之間複製存檔資料夾的麻煩,歡迎您出一份力。",
+ "settings.support.point1": "讓公共中繼保持線上",
+ "settings.support.point2": "檢測到更多遊戲和模擬器",
+ "settings.support.point3": "有時間修復問題、開發新功能",
+ "settings.support.openAgain": "再次開啟",
+ "settings.support.openDonate": "開啟捐贈頁面",
+ "settings.support.openedToast": "已在您的瀏覽器中開啟——謝謝。",
+ "settings.support.foot": "不想捐贈?提交錯誤報告或功能建議同樣有幫助。",
+ "settings.support.scanToPay": "用手機掃碼",
+ "settings.support.fromPhone": "完成支付",
+ "settings.support.note": "支付完全由 Gumroad 處理——OpenSave 永遠不會看到您的銀行卡資訊。",
+ "settings.sync.unknownGameHint": "自動追蹤會根據遊戲在其他裝置上的位置推算出一個資料夾,這也是 OpenSave 通常無需設定的原因。",
+ "settings.title": "設定",
+ "settings.saveState.saving": "正在儲存…",
+ "settings.saveState.notSaved": "未儲存:{field} —— {why}",
+ "settings.saveState.saveFailed": "無法儲存:{error}",
+ "settings.saveState.saved": "已儲存",
+ "settings.saveState.autosave": "更改會隨做隨存",
+ "settings.tab.general": "常規",
+ "settings.tab.sync": "同步",
+ "settings.tab.storage": "儲存",
+ "settings.tab.advanced": "高階",
+ "settings.tab.support": "支援",
+ "settings.discord.title": "在瀏覽器中開啟 OpenSave Discord",
+ "settings.field.relayUrl": "中繼 URL",
+ "settings.field.relayPort": "中繼託管埠",
+ "settings.field.port": "守護程序埠",
+ "settings.field.deviceName": "裝置名稱",
+ "settings.field.backupsDir": "快照資料夾",
+ "settings.field.syncBackupsDir": "安全備份資料夾",
+ "settings.field.pathTranslations": "路徑規則",
+ "settings.cleanUp.saveFailed": "上限未能儲存:{error}",
+ "settings.cleanUp.removed": "已刪除 {n} 箇舊快照,釋放了 {mb} MB",
+ "settings.cleanUp.none": "無可清理——所有遊戲都在各自上限之內",
+ "settings.storage.pickDialog": "選擇快照儲存資料夾",
+ "settings.storage.pickSyncDialog": "選擇同步前安全備份資料夾",
+ "settings.storage.scanAddDialog": "新增要掃描的資料夾",
+ "settings.storage.excludeAddDialog": "選擇要從掃描中排除的資料夾",
+ "settings.reset.confirmBody": "取消追蹤全部 {n} 個遊戲?它們將從您的遊戲庫中移除,以便您從正確的位置重新新增。磁碟上的存檔快照會保留——不會刪除任何內容。",
+ "settings.reset.confirmTitle": "重置追蹤?",
+ "settings.reset.confirmAction": "取消追蹤 {n}",
+ "settings.reset.doneToast": "已取消追蹤 {n} 個遊戲——快照已保留",
+ "settings.general.deviceIdentity": "裝置身份",
+ "settings.general.deviceName": "裝置名稱——其他裝置看到您的名字",
+ "settings.general.deviceType": "裝置型別",
+ "settings.general.type.desktop": "桌面電腦(Windows / macOS / Linux PC)",
+ "settings.general.type.deck": "Steam Deck(SteamOS 掌機)",
+ "settings.general.type.handheld": "掌機(ROG Ally / Legion Go / 模擬器)",
+ "settings.general.type.mobile": "伴侶裝置(移動裝置)",
+ "settings.general.typeHint": "其他裝置發現您時會看到此資訊。",
+ "settings.general.deviceId": "裝置 ID",
+ "settings.general.deviceIdHint": "此裝置的唯一網路識別符號(只讀)。",
+ "settings.general.appearance": "外觀",
+ "settings.general.controller": "手柄",
+ "settings.general.notifications": "通知",
+ "settings.general.library": "遊戲庫",
+ "settings.general.libraryHint": "遊戲在主頁上的排布方式。更改立即生效。",
+ "settings.general.setupGuide": "設定嚮導",
+ "settings.general.setupGuideHint": "主頁上的入門清單:找到您的存檔、新增您的其他裝置、備份到雲端。",
+ "settings.general.showSetupAgain": "再次顯示",
+ "settings.general.startup": "啟動",
+ "settings.general.startOnBoot": "開機時啟動 OpenSave",
+ "settings.general.startOnBootHint": "以最小化到系統托盤的方式啟動,讓同步在後臺進行。",
+ "settings.general.updates": "更新",
+ "settings.general.offerBetas": "向我提供測試版",
+ "settings.general.betasOnPreRelease": "您正在執行 {version},它本身是測試版,因此無論是否勾選此項,您都會收到更新的測試版——否則在正式版趕上之前您將無路可走。取消勾選後,一旦正式版比您當前的版本更新,您就會切換到正式版。",
+ "settings.general.betasStable": "測試版釋出更早、包含最新的修復,但測試程度較低。只要正式版更新,您就會收到正式版,所以這不是一條單行道。",
+ "settings.sync.behavior": "同步行為",
+ "settings.sync.autoSyncOnTrack": "遊戲首次被追蹤時立即同步",
+ "settings.sync.detectNewGames": "當出現 OpenSave 未在追蹤其存檔的遊戲時提醒我",
+ "settings.sync.detectNewGamesHint": "OpenSave 每小時在後臺檢查一次,只提及它沒見過的遊戲。在您選擇之前不會追蹤任何內容。",
+ "settings.sync.matchByAppId": "按 Steam App ID 跨 PC 匹配存檔",
+ "settings.sync.matchByAppIdHint": "即使同一遊戲在不同裝置上以不同名稱或磁碟機代號被追蹤,也能將它們關聯起來。",
+ "settings.sync.matchByAppIdMore": "例如一臺 PC 上的 Steam 版和另一臺上的獨立版。如果您有意保留同一款遊戲互不合並的兩份副本,請保持關閉。您隨時可以在遊戲頁面手動關聯遊戲。",
+ "settings.sync.unknownGameLabel": "當其他裝置同步了本機沒有的遊戲時",
+ "settings.sync.unknownGame.track": "自動開始追蹤(推薦)",
+ "settings.sync.unknownGame.ask": "詢問我儲存在哪裡",
+ "settings.sync.unknownGameMore": "如果您的存檔位置可能與自動猜測不符——第二塊硬碟、移動過的資料夾,或把存檔放在以您的帳號命名的資料夾中的遊戲——請選擇“{askMe}”。等待指定資料夾的遊戲會顯示在主頁上。",
+ "settings.sync.askShort": "詢問我",
+ "settings.sync.bandwidthLimit": "網路頻寬限制",
+ "settings.sync.speed.unlimited": "不限速(最高速度)",
+ "settings.sync.speed.low": "100 KB/s(很低)",
+ "settings.sync.speed.medium": "500 KB/s(中等)",
+ "settings.sync.speed.high": "1 MB/s(高)",
+ "settings.sync.speed.veryHigh": "5 MB/s(很高)",
+ "settings.sync.speed.ultra": "10 MB/s(極高)",
+ "settings.sync.speedHint": "僅適用於中繼(網際網路)同步——區域網永遠不會被限速。",
+ "settings.sync.relay": "網際網路中繼",
+ "settings.sync.relayUrl": "WebSocket 中繼 URL",
+ "settings.sync.relayUrlHint": "中繼在網際網路上承載同步。從{internetSync}加入房間。",
+ "settings.sync.internetSync": "聯網同步",
+ "settings.sync.hostRelay": "在本裝置上託管 WAN 中繼伺服器",
+ "settings.sync.hostRelayHint": "讓朋友直接連線您,而不是經由公共中繼。",
+ "settings.sync.relayPort": "中繼託管埠",
+ "settings.sync.relayPortHint": "在路由器上轉發此 TCP 埠,讓網際網路上的朋友能夠連到您。",
+ "settings.sync.lookingUp": "查詢中…",
+ "settings.sync.hideAddresses": "隱藏我的地址",
+ "settings.sync.showAddresses": "顯示我的地址以便分享",
+ "settings.sync.shareTitle": "將這些分享給您的朋友",
+ "settings.sync.lanIps": "區域網 IP:",
+ "settings.sync.publicIp": "公網 IP:",
+ "settings.sync.unavailable": "不可用",
+ "settings.sync.relayPortLabel": "中繼埠:",
+ "settings.sync.cloudBackupHint": "備份的去向、每個快照是否都傳送到那裡、以及是否從其他裝置取回較新的存檔,這些都在“雲備份”頁面設定。",
+ "settings.sync.openCloudBackup": "開啟雲備份",
"common.cancel": "取消",
"common.nowTracking": "已開始跟蹤“{name}”",
"home.addGame.adding": "新增中…",
@@ -301,6 +452,60 @@
"pause.pauseTitle": "暫時停止與其他裝置同步——快照仍會建立",
"pause.resume": "恢復同步",
"pause.resumeTitle": "同步已暫停({length})。快照仍會建立。立即恢復以補齊。",
+ "conflict.title": "存檔衝突 — {game}",
+ "conflict.desc": "本裝置與 {peer} 在上次同步之後都改動了這個存檔。請選擇要從哪個版本繼續遊玩。",
+ "conflict.thisDevice": "本裝置",
+ "conflict.playedRecently": "最近遊玩過",
+ "conflict.diffHere": "{n} 個檔案在這裡有差異",
+ "conflict.diffThere": "{n} 個檔案在那裡有差異",
+ "conflict.onlyHere": "{n} 個僅此裝置有",
+ "conflict.onlyThere": "{n} 個僅 {peer} 有",
+ "conflict.lastChange": "最後改動於 {time}",
+ "conflict.saveFolderEmpty": "存檔資料夾為空",
+ "conflict.wholeSave": "整個存檔:{n} 個檔案 · {size}",
+ "conflict.diffCapped": "上方的計數僅覆蓋 {total} 個有差異檔案中的前 {shown} 個。",
+ "conflict.keepMine": "保留我的",
+ "conflict.keepTheirs": "保留對方的",
+ "conflict.keepBoth": "兩者都保留(推薦)",
+ "conflict.keepBothName": "兩者都保留",
+ "conflict.consequenceKeepBoth": "{mine} / {both}:不會刪除任何檔案。",
+ "conflict.broughtHere": "{peer} 獨有的 {n} 個檔案會被帶到這裡;",
+ "conflict.keptWhere": "雙方都有的檔案則保留你的版本。",
+ "conflict.consequenceKeepTheirs": "{theirs}:",
+ "conflict.deletesFiles": "刪除 {n} 個檔案",
+ "conflict.deletesTail": ",這些檔案只有此裝置才有(會先快照)。",
+ "conflict.deletesNothing": "不會丟失此裝置獨有的任何檔案。",
+ "conflict.diffToggle": "有什麼不同({n} 個檔案)",
+ "conflict.diffMore": "…還有 {n} 個",
+ "conflict.decideLater": "稍後決定",
+ "conflict.decideLaterTitle": "在你做出決定之前,這個遊戲不會同步。開啟該遊戲即可做出決定。",
+ "conflict.keepTheirsTitle": "將刪除 {n} 個僅此裝置有的檔案",
+ "conflict.hintAll": "無論選擇哪一個都不會丟失資料。{both}(推薦)會繼續使用你的版本——{peer} 也會收到它——同時會把 {peer} 的版本保留在這裡的一個分支上,你可以切換過去。{mine} 會把你的版本設為共享版本——{peer} 會收到它(對方的舊存檔會先快照)。{theirs} 會在這裡採用 {peer} 的版本,你的版本會先快照。隨時可以在遊戲的“快照 / 分支”標籤頁恢復任何內容。",
+ "conflict.keepMineQuoted": "“保留我的”",
+ "conflict.keepTheirsQuoted": "“保留對方的”",
+ "conflict.keepBothQuoted": "“兩者都保留”",
+ "conflict.attentionBody": "這個存檔在本裝置與另一臺裝置上同時發生了改動——請選擇要保留哪個。",
+ "conflict.attentionToast": "“{name}”出現存檔衝突——請選擇要保留的版本",
+ "conflict.applyingToast": "正在應用你對“{name}”的選擇——正在傳輸 {peer} 的檔案…",
+ "conflict.differs": "有差異",
+ "conflict.onlyOnPeer": "僅 {peer} 有",
+ "conflict.onlyOnDevice": "僅此裝置有",
+ "conflict.otherDevice": "另一臺裝置",
+ "conflict.aGame": "某個遊戲",
+ "conflict.unknown": "未知",
+ "locConflict.title": "“{root}”資料夾 — {game}",
+ "locConflict.desc": "這是 {game} 的一個額外存檔資料夾,本裝置與 {peer} 都改動了它。遊戲的主存檔不受影響、會繼續同步;只有這個資料夾在等你處理。",
+ "locConflict.changedRecently": "最近改動過",
+ "locConflict.folderEmpty": "資料夾為空",
+ "locConflict.wholeFolder": "整個資料夾:{n} 個檔案 · {size}",
+ "locConflict.attentionBody": "它的“{root}”資料夾在兩臺裝置上不一致——請選擇要保留哪個。",
+ "locConflict.attentionToast": "“{game}”的“{root}”資料夾在兩臺裝置上不一致",
+ "locConflict.bringingToast": "正在拉取 {peer} 的“{root}”資料夾…",
+ "locConflict.decideLaterTitle": "在你做出決定之前,這個資料夾不會同步。開啟該遊戲即可做出決定。",
+ "locConflict.useTheirs": "使用{peer}的",
+ "locConflict.useTheirsQuoted": "“使用{peer}的”",
+ "locConflict.hintUndo": "無論選擇哪一項,都會先對這個遊戲的每個資料夾拍快照,因此兩個選擇都可以在“快照”標籤頁撤銷。{mine} 會把本裝置的副本設為共享版本,並讓 {peer} 接收它——如果 {peer} 有更新的進度,它會自行決定是否接受。{theirs} 會把對方的副本同步過來。",
+ "locConflict.hintNoKeepBoth": "資料夾沒有“兩者都保留”選項:該選項會把另一份副本放到分支上,而分支覆蓋的是整個遊戲,而不是其中某個資料夾。",
"common.open": "開啟",
"home.trackGame": "跟蹤遊戲",
"home.trackGameHint": "按名稱查詢遊戲,或選擇其程式或存檔資料夾",
@@ -345,5 +550,66 @@
"game.config.deviceSettingsHint": "遊戲資料庫將這些檔案列為該遊戲的設定而非存檔,因此每臺裝置保留各自的設定(畫質、解析度)。它們仍包含在每個快照中。",
"notifications.clearAll": "清除全部",
"notifications.clearAllTitle": "將這些從鈴鐺移除,活動頁仍保留",
- "palette.renameGame": "重新命名 {game}"
+ "palette.renameGame": "重新命名 {game}",
+ "devices.title": "裝置",
+ "devices.paired": "已配對的裝置",
+ "devices.noPaired": "沒有已配對的裝置",
+ "devices.noPairedHint": "在下方配對裝置——它會自動出現在你的 Wi-Fi 上,或者透過網際網路使用房間碼連線。",
+ "devices.statusOnline": "線上",
+ "devices.statusOffline": "離線",
+ "devices.internetRelay": "網際網路中繼",
+ "devices.lastSynced": "上次同步 {time}",
+ "devices.never": "從未",
+ "devices.opensaveVersion": "OpenSave {version}",
+ "devices.fixThis": "修復",
+ "devices.trustTooltip": "僅適用於你自己的裝置:它同步的遊戲會存入它指定的資料夾,即便是本裝置未識別為存檔的資料夾,而不是等待你在主頁選擇。",
+ "devices.trustLabel": "信任它來選擇資料夾",
+ "devices.updateFromThis": "從此裝置更新",
+ "devices.unpair": "取消配對",
+ "devices.addDevice": "新增裝置",
+ "devices.onThisNetwork": "本網路",
+ "devices.overInternet": "透過網際網路",
+ "devices.lanIntro": "在同一 Wi-Fi/乙太網路上執行 OpenSave 的裝置會自動互相發現,無需設定。",
+ "devices.foundOnNetwork": "在你的網路上找到",
+ "devices.noLanFound": "在本地網路上未找到未配對的裝置。請確認另一台裝置正在執行 OpenSave。",
+ "devices.pair": "配對",
+ "devices.addByIp": "透過 IP 位址新增",
+ "devices.sendPairing": "傳送配對請求",
+ "devices.pairingSentTo": "已向 {name} 傳送配對請求",
+ "devices.pairingSent": "配對請求已傳送",
+ "devices.unpairConfirmTitle": "取消配對裝置?",
+ "devices.unpairConfirmBody": "取消配對“{name}”?它的遊戲會保留在兩端裝置上;你們之間的同步將停止。",
+ "devices.unpairConfirmText": "取消配對",
+ "devices.unpaired": "已取消配對 {name}",
+ "devices.trustConfirmTitle": "信任“{name}”來選擇資料夾?",
+ "devices.trustConfirmBody": "只對你自己的裝置這樣做。當“{name}”同步本裝置未識別為存檔的遊戲時,它的存檔會放入“{name}”指定的資料夾,而不是等待你在主頁選擇。",
+ "devices.trustConfirmText": "信任它",
+ "devices.canChooseFolders": "{name} 可在此選擇資料夾",
+ "devices.noLongerChooses": "{name} 不再在此選擇資料夾",
+ "devices.repairConfirmTitle": "取消配對,以便重新配對?",
+ "devices.repairConfirmBody": "取消配對“{name}”,然後再次配對這兩台裝置,以便它們交換加密金鑰。它的遊戲與存檔保留在原處。在你重新配對之前,這兩台裝置之間不會同步任何內容。",
+ "devices.repairConfirmText": "現在取消配對",
+ "devices.repairedToast": "已取消配對 {name}——再次配對這兩台裝置以加密你同步的內容",
+ "devices.updateConfirmTitle": "更新 OpenSave?",
+ "devices.updateConfirmBody": "{name} 正在執行較新的 OpenSave 建置({version})。從 {name} 下載並更新此裝置?完成後 OpenSave 會自動重新啟動。",
+ "devices.updateConfirmText": "更新並重新啟動",
+ "app.updatingDownloading": "正在更新 OpenSave——下載 {n}%…",
+ "app.installingUpdate": "正在安裝更新…",
+ "app.restartingVersion": "正在以新版本重新啟動…",
+ "app.restartsItself": "完成後應用程式會自動重新啟動——你的遊戲會繼續同步。",
+ "app.updateAvailable": "OpenSave {latest} 已可用——你目前為 {current}。",
+ "app.hideNotes": "隱藏說明",
+ "app.whatsNew": "新內容",
+ "app.starting": "正在啟動…",
+ "app.installRestart": "安裝並重新啟動",
+ "app.getFlatpak": "取得 .flatpak",
+ "app.download": "下載",
+ "app.updatedTo": "OpenSave 已更新至 v{version}。",
+ "app.failedToStart": "OpenSave 啟動失敗",
+ "app.retrying": "正在重試…",
+ "app.retry": "重試",
+ "app.detailsSaved": "詳細資訊已儲存到你的使用者資料夾中的 .opensave\\opensave.log。",
+ "app.startingOpenSave": "正在啟動 OpenSave…",
+ "app.emptiedBody": "{name} 的所有存檔檔案在此處都被刪除了。你的其他裝置會保留它們,直到你做出選擇。",
+ "app.choose": "選擇"
}
diff --git a/cmd/opensave-app/frontend/src/views/Devices.svelte b/cmd/opensave-app/frontend/src/views/Devices.svelte
index 28aa2405..18e1fe73 100644
--- a/cmd/opensave-app/frontend/src/views/Devices.svelte
+++ b/cmd/opensave-app/frontend/src/views/Devices.svelte
@@ -1,5 +1,6 @@
-
Devices
+
{$t('devices.title')}
-
Paired devices
+
{$t('devices.paired')}
{#if pairedList.length === 0}
-
No paired devices
-
Pair a device below — on your Wi-Fi it appears automatically, or connect over the internet with a room code.
{/if}
diff --git a/internal/api/root_topology_admission_test.go b/internal/api/root_topology_admission_test.go
new file mode 100644
index 00000000..d964a926
--- /dev/null
+++ b/internal/api/root_topology_admission_test.go
@@ -0,0 +1,55 @@
+package api
+
+import (
+ "net/http"
+ "os"
+ "path/filepath"
+ "testing"
+ "time"
+)
+
+// Root API mutations must observe native admission for the duration of the
+// Store write, not merely sample an active-writer count.
+func TestRootTopologyRefusesActiveNativeWriter(t *testing.T) {
+ ts := startTestServer(t)
+ ts.server.topologyWaitFor = 25 * time.Millisecond
+ id := trackProbeGame(t, ts)
+ dir := filepath.Join(t.TempDir(), "config")
+ if err := os.MkdirAll(dir, 0700); err != nil {
+ t.Fatal(err)
+ }
+ resp, body := ts.do(t, http.MethodPost, "/api/games/"+id+"/roots",
+ map[string]string{"name": "config", "path": dir})
+ if resp.StatusCode != http.StatusOK {
+ t.Fatalf("cannot establish mapped root: HTTP %d %v", resp.StatusCode, body)
+ }
+
+ releaseWriter := ts.daemon.P2P.Sync.Writing(id)
+ resp, _ = ts.do(t, http.MethodDelete, "/api/games/"+id+"/roots/config", nil)
+ if resp.StatusCode != http.StatusConflict {
+ t.Errorf("RemoveRoot during native write: got HTTP %d, want 409", resp.StatusCode)
+ }
+ other := filepath.Join(t.TempDir(), "other")
+ if err := os.MkdirAll(other, 0700); err != nil {
+ t.Fatal(err)
+ }
+ resp, _ = ts.do(t, http.MethodPost, "/api/games/"+id+"/roots",
+ map[string]string{"name": "config", "path": other})
+ if resp.StatusCode != http.StatusConflict {
+ t.Errorf("AddRoot remap during native write: got HTTP %d, want 409", resp.StatusCode)
+ }
+ roots, err := ts.daemon.Store.GameRootPaths(id)
+ if err != nil || roots["config"] != dir {
+ t.Fatalf("mapping changed during writer: roots=%v err=%v", roots, err)
+ }
+ releaseWriter()
+
+ resp, body = ts.do(t, http.MethodDelete, "/api/games/"+id+"/roots/config", nil)
+ if resp.StatusCode != http.StatusOK {
+ t.Fatalf("safe removal after writer drained: HTTP %d %v", resp.StatusCode, body)
+ }
+ roots, err = ts.daemon.Store.GameRootPaths(id)
+ if err != nil || roots["config"] != "" {
+ t.Fatalf("root still mapped after successful removal: %v err=%v", roots, err)
+ }
+}
diff --git a/internal/api/root_topology_wait_test.go b/internal/api/root_topology_wait_test.go
new file mode 100644
index 00000000..5a4a8498
--- /dev/null
+++ b/internal/api/root_topology_wait_test.go
@@ -0,0 +1,57 @@
+package api
+
+import (
+ "net/http"
+ "os"
+ "path/filepath"
+ "testing"
+ "time"
+)
+
+// One actual request waits for the in-flight writer and then succeeds.
+// This does not rely on an E2E helper repeatedly retrying a refused request.
+func TestRootTopologySingleRequestWaitsForWriterAndPreservesFiles(t *testing.T) {
+ ts := startTestServer(t)
+ ts.server.topologyWaitFor = time.Second
+ id := trackProbeGame(t, ts)
+ dir := filepath.Join(t.TempDir(), "config")
+ if err := os.Mkdir(dir, 0700); err != nil {
+ t.Fatal(err)
+ }
+ path := filepath.Join(dir, "slot.sav")
+ if err := os.WriteFile(path, []byte("ORIGINAL"), 0600); err != nil {
+ t.Fatal(err)
+ }
+ resp, body := ts.do(t, http.MethodPost, "/api/games/"+id+"/roots", map[string]string{"name": "config", "path": dir})
+ if resp.StatusCode != http.StatusOK {
+ t.Fatalf("setup failed HTTP %d: %v", resp.StatusCode, body)
+ }
+ writer := ts.daemon.P2P.Sync.Writing(id)
+ result := make(chan int, 1)
+ go func() {
+ response, _ := ts.do(t, http.MethodDelete, "/api/games/"+id+"/roots/config", nil)
+ result <- response.StatusCode
+ }()
+ select {
+ case status := <-result:
+ t.Fatalf("mutated while writer active: HTTP %d", status)
+ case <-time.After(60 * time.Millisecond):
+ }
+ roots, err := ts.daemon.Store.GameRootPaths(id)
+ if err != nil || roots["config"] != dir {
+ t.Fatalf("mapping moved during writer: %v %v", roots, err)
+ }
+ writer()
+ select {
+ case status := <-result:
+ if status != http.StatusOK {
+ t.Fatalf("after drain HTTP %d", status)
+ }
+ case <-time.After(3 * time.Second):
+ t.Fatal("single API request never resumed")
+ }
+ bytes, err := os.ReadFile(path)
+ if err != nil || string(bytes) != "ORIGINAL" {
+ t.Fatalf("physical save modified: %s %v", bytes, err)
+ }
+}
diff --git a/internal/api/routes.go b/internal/api/routes.go
index e0521d99..e43192a1 100644
--- a/internal/api/routes.go
+++ b/internal/api/routes.go
@@ -441,6 +441,13 @@ func (s *Server) handleUpdateGame(w http.ResponseWriter, r *http.Request) {
}
game.SavePath = abs
}
+ // A combined path+exclusion change would rebase agreement from a new
+ // path before admission. Refuse rather than claim old lineage for new
+ // save bytes; a safe combined transition needs a separate explicit design.
+ if game.SavePath != oldSavePath && s.Daemon.IgnoreText(game) != oldIgnore {
+ writeError(w, http.StatusConflict, "Change save location and sync exclusions separately.")
+ return
+ }
// Cover art: a user-set custom URL is always kept. An empty cover, or
// a previously auto-generated Steam cover, is (re)derived from the
// AppID — so changing the AppID refreshes the art.
@@ -489,6 +496,13 @@ func (s *Server) handleUpdateGame(w http.ResponseWriter, r *http.Request) {
game.LastManifestHash = s.Daemon.LastSnapshotHashUnder(game, oldIgnore)
}
+ if game.SavePath != oldSavePath {
+ done, ok := s.acquireRootTopology(w, r, gameID)
+ if !ok {
+ return
+ }
+ defer done()
+ }
if err := s.Daemon.Store.UpdateGameContext(r.Context(), game); err != nil {
status := notFoundToStatus(err)
if errors.Is(err, store.ErrPathClaimBusy) || errors.Is(err, store.ErrOwnershipClaimsChanged) || errors.Is(err, store.ErrGamePathOwned) {
diff --git a/internal/api/routes_roots.go b/internal/api/routes_roots.go
index 36085e42..716c9be4 100644
--- a/internal/api/routes_roots.go
+++ b/internal/api/routes_roots.go
@@ -1,10 +1,12 @@
package api
import (
+ "context"
"errors"
"net/http"
"net/url"
"strings"
+ "time"
"github.com/go-chi/chi/v5"
"github.com/opensave/opensave/internal/store"
@@ -71,6 +73,13 @@ func (s *Server) handleAddGameRoot(w http.ResponseWriter, r *http.Request) {
}
path = abs
}
+ // A root that is currently being written by an in-flight transfer must
+ // not be remapped out from under that transfer (issue #60).
+ done, ok := s.acquireRootTopology(w, r, gameID)
+ if !ok {
+ return
+ }
+ defer done()
// Rejections here are the overlap and naming rules, which are the user's
// to hear about rather than a server fault: "that folder is already
// covered by the main save" is a sentence, not a 500.
@@ -98,6 +107,13 @@ func (s *Server) handleRemoveGameRoot(w http.ResponseWriter, r *http.Request) {
writeError(w, http.StatusBadRequest, "invalid location name")
return
}
+ // Refuse while any transfer still holds a captured path for this game
+ // (issue #60). The mapping must stay until the last write finishes.
+ done, ok := s.acquireRootTopology(w, r, gameID)
+ if !ok {
+ return
+ }
+ defer done()
oldRoots, _ := s.Daemon.Store.GameRootPaths(gameID)
if err := s.Daemon.Store.RemoveGameRoot(gameID, name); err != nil {
writeError(w, http.StatusInternalServerError, err.Error())
@@ -110,3 +126,28 @@ func (s *Server) handleRemoveGameRoot(w http.ResponseWriter, r *http.Request) {
s.BroadcastGamesUpdate()
writeJSON(w, http.StatusOK, map[string]any{"ok": true})
}
+
+// acquireRootTopology waits for interactive edits only. The 30-second bound
+// covers acquiring the reservation; the database/watcher phase may take longer.
+func (s *Server) acquireRootTopology(w http.ResponseWriter, r *http.Request, gameID string) (func(), bool) {
+ if s.Daemon == nil || s.Daemon.P2P == nil || s.Daemon.P2P.Sync == nil {
+ writeError(w, http.StatusServiceUnavailable, "Save-location admission is unavailable.")
+ return nil, false
+ }
+ limit := s.topologyWaitFor
+ if limit <= 0 {
+ limit = 30 * time.Second
+ }
+ ctx, cancel := context.WithTimeout(r.Context(), limit)
+ defer cancel()
+ done, err := s.Daemon.P2P.Sync.WaitTopologyMutation(ctx, gameID, 100*time.Millisecond)
+ if err == nil {
+ return done, true
+ }
+ if errors.Is(err, context.DeadlineExceeded) && r.Context().Err() == nil {
+ writeError(w, http.StatusConflict, "A sync of this game is in progress. Try again in a moment.")
+ } else if r.Context().Err() == nil {
+ writeError(w, http.StatusServiceUnavailable, "Save-location admission was cancelled or is unavailable.")
+ }
+ return nil, false
+}
diff --git a/internal/api/server.go b/internal/api/server.go
index 5b2ab922..94663ed7 100644
--- a/internal/api/server.go
+++ b/internal/api/server.go
@@ -35,8 +35,9 @@ type Server struct {
Daemon *daemon.Daemon
Hub *Hub
- httpServer *http.Server
- listener net.Listener
+ httpServer *http.Server
+ listener net.Listener
+ topologyWaitFor time.Duration // test-injectable admission limit; defaults to 30s
// instance marks every response from this process (instanceHeader), so
// Start can tell whether 127.0.0.1 at its port is really answered by it.
instance string
@@ -98,6 +99,10 @@ func (s *Server) peersPayload() map[string]any {
// "update from this device" when a peer runs a newer build.
entry := struct {
store.Peer
+ // Whether this device may choose the folders of games it syncs
+ // here (Devices; migration 0044).
+ ChoosesFolders bool `json:"choosesFolders"`
+
AppVersion string `json:"appVersion,omitempty"`
BuildTimeMs int64 `json:"buildTimeMs,omitempty"`
HasNewerBuild bool `json:"hasNewerBuild,omitempty"`
@@ -106,15 +111,13 @@ func (s *Server) peersPayload() map[string]any {
// differs per pairing and the reader cannot work out which case
// they are in from a general statement.
p2p.PeerProtection
- // Whether this device may choose the folders of games it syncs
- // here (Devices; migration 0038).
- ChoosesFolders bool `json:"choosesFolders"`
- }{Peer: p, PeerProtection: s.Daemon.P2P.PeerProtection(p), ChoosesFolders: s.Daemon.Store.PeerChoosesFolders(p.ID)}
+ }{Peer: p, PeerProtection: s.Daemon.P2P.PeerProtection(p)}
if b, ok := builds[p.ID]; ok {
entry.AppVersion = b.AppVersion
entry.BuildTimeMs = b.BuildTimeMs
entry.HasNewerBuild = version.NewerThanLocal(b.AppVersion, b.BuildTimeMs)
}
+ entry.ChoosesFolders = s.Daemon.Store.PeerChoosesFolders(p.ID)
peerMap[p.ID] = entry
}
discovered := []any{}
diff --git a/internal/daemon/daemon.go b/internal/daemon/daemon.go
index ec76a05f..7df1545a 100644
--- a/internal/daemon/daemon.go
+++ b/internal/daemon/daemon.go
@@ -799,6 +799,21 @@ func isDuplicateGameID(err error) bool {
return err != nil && strings.Contains(err.Error(), "UNIQUE constraint failed: games.id")
}
+// withRootTopology holds this process's mapping reservation across a path write.
+// A second process cannot see the reservation; the CLI must use the running
+// daemon's HTTP API instead of opening its own store.
+func (d *Daemon) withRootTopology(gameID string, fn func() error) error {
+ if d.P2P == nil || d.P2P.Sync == nil {
+ return fmt.Errorf("root topology admission unavailable")
+ }
+ done, ok := d.P2P.Sync.TryTopologyMutation(gameID)
+ if !ok {
+ return fmt.Errorf("cannot change save locations while a sync is active")
+ }
+ defer done()
+ return fn()
+}
+
// TrackGame adds a new game, takes its initial snapshot (when the save
// location already has content), and starts watching it.
func (d *Daemon) TrackGame(game store.Game) (store.Game, error) {
@@ -1290,7 +1305,9 @@ func (d *Daemon) LinkGames(canonicalID, aliasID string) error {
}
var addErr error
if root.Mapped() {
- addErr = d.Store.AddGameRoot(canonicalID, root.Name, root.Path)
+ addErr = d.withRootTopology(canonicalID, func() error {
+ return d.Store.AddGameRoot(canonicalID, root.Name, root.Path)
+ })
} else {
addErr = d.Store.NoteGameRoot(canonicalID, root.Name)
}
diff --git a/internal/daemon/missing.go b/internal/daemon/missing.go
index e9aa0690..ce38d8f1 100644
--- a/internal/daemon/missing.go
+++ b/internal/daemon/missing.go
@@ -71,6 +71,25 @@ func SaveDriveMissing(savePath string) bool {
// folders constantly.
const relocateRecheck = time.Hour
+// statSaveFolder is os.Stat, replaced by a test that needs a drive that is not
+// ready.
+var statSaveFolder = os.Stat
+
+// saveFolderThere reports whether a save path's folder can be seen to exist.
+// It is not the opposite of SaveFolderMissing, which says "missing" only of a
+// folder plainly not there. A drive with no disk in it, an empty card reader
+// or an unreachable share answers with another error: not missing, and not
+// there either. Taken as there, an empty card reader made a second match for
+// every folder found on another drive, and nothing was ever offered.
+func saveFolderThere(savePath string) bool {
+ folder := savePath
+ if isFile, err := delta.ResolveLocalSaveFilePath(savePath); err == nil && isFile {
+ folder = filepath.Dir(savePath)
+ }
+ _, err := statSaveFolder(folder)
+ return err == nil
+}
+
// relocateCandidates lists the folders at savePath's exact path under the other
// drive letters that exist here. Windows drive letters only.
func relocateCandidates(savePath string) []string {
@@ -87,7 +106,7 @@ func relocateCandidates(savePath string) []string {
continue
}
candidate := letter + ":" + rest
- if !SaveFolderMissing(candidate) {
+ if saveFolderThere(candidate) {
found = append(found, candidate)
}
}
diff --git a/internal/daemon/registry_setup.go b/internal/daemon/registry_setup.go
index 14a3f570..96366193 100644
--- a/internal/daemon/registry_setup.go
+++ b/internal/daemon/registry_setup.go
@@ -48,7 +48,9 @@ func (d *Daemon) setUpRegistryCapture(game store.Game) {
"could not prepare the registry location for %q: %v", game.Name, err))
return
}
- if err := d.Store.AddGameRoot(game.ID, winreg.LocationName, dir); err != nil {
+ if err := d.withRootTopology(game.ID, func() error {
+ return d.Store.AddGameRoot(game.ID, winreg.LocationName, dir)
+ }); err != nil {
d.Log.Log("warn", fmt.Sprintf(
"could not add the registry save location for %q: %v", game.Name, err))
return
diff --git a/internal/daemon/relocate_test.go b/internal/daemon/relocate_test.go
index 603d2fc5..403f81ec 100644
--- a/internal/daemon/relocate_test.go
+++ b/internal/daemon/relocate_test.go
@@ -1,6 +1,7 @@
package daemon
import (
+ "errors"
"os"
"path/filepath"
"runtime"
@@ -178,3 +179,52 @@ func TestRelocateToOtherDrive_AnOfferIsStaleOnceTheFolderIsSetByHand(t *testing.
t.Error("the stale offer is still offered")
}
}
+
+// A drive that is there but not ready, an empty card reader, does not hold the
+// folder. It read as holding it: a second match, so nothing was ever offered.
+func TestRelocateToOtherDrive_ADriveNotReadyIsNoMatch(t *testing.T) {
+ if runtime.GOOS != "windows" {
+ t.Skip("drive letters are a Windows thing")
+ }
+ free := freeDriveLetter()
+ if free == "" {
+ t.Skip("no free drive letter")
+ }
+ real := filepath.Join(t.TempDir(), "SteamLibrary", "save")
+ if err := os.MkdirAll(real, 0o777); err != nil {
+ t.Fatal(err)
+ }
+ statSaveFolder = func(p string) (os.FileInfo, error) {
+ if strings.HasPrefix(strings.ToUpper(p), free+":") {
+ return nil, errors.New("The device is not ready.")
+ }
+ return os.Stat(p)
+ }
+ t.Cleanup(func() { statSaveFolder = os.Stat })
+
+ // Looked for from a third letter, as a peer's path arrives.
+ gone := "?"
+ for c := 'Y'; c >= 'D'; c-- {
+ l := string(c)
+ if l == free || strings.EqualFold(l, real[:1]) {
+ continue
+ }
+ if _, err := os.Stat(l + ":" + string(filepath.Separator)); err != nil {
+ gone = l
+ break
+ }
+ }
+ if gone == "?" {
+ t.Skip("no second free drive letter")
+ }
+ found := relocateCandidates(gone + ":" + real[2:])
+ var mine []string
+ for _, f := range found {
+ if strings.EqualFold(f, real) || strings.EqualFold(f[:1], free) {
+ mine = append(mine, f)
+ }
+ }
+ if len(mine) != 1 || !strings.EqualFold(mine[0], real) {
+ t.Errorf("found %v, want only %s", mine, real)
+ }
+}
diff --git a/internal/fsx/readdirshared.go b/internal/fsx/readdirshared.go
new file mode 100644
index 00000000..3f9dcf60
--- /dev/null
+++ b/internal/fsx/readdirshared.go
@@ -0,0 +1,16 @@
+package fsx
+
+import "os"
+
+// ReadDirShared is os.ReadDir that lets another program delete the folder, or
+// anything in it, while it is being listed.
+//
+// The same default as OpenShared's, for folders: on Windows os.ReadDir opens
+// the folder without FILE_SHARE_DELETE, and while it is open the folder cannot
+// be removed — "being used by another process". The watcher lists a folder
+// whenever something inside it changes (checkFolders), so it was listing the
+// folders a restore was emptying, and the restore failed; a game deleting a
+// folder of its own saves at that moment fails the same way.
+func ReadDirShared(path string) ([]os.DirEntry, error) {
+ return readDirShared(path)
+}
diff --git a/internal/fsx/readdirshared_other.go b/internal/fsx/readdirshared_other.go
new file mode 100644
index 00000000..b38aea0f
--- /dev/null
+++ b/internal/fsx/readdirshared_other.go
@@ -0,0 +1,10 @@
+//go:build !windows
+
+package fsx
+
+import "os"
+
+// On Unix an open folder never blocks removing it or anything in it.
+func readDirShared(path string) ([]os.DirEntry, error) {
+ return os.ReadDir(path)
+}
diff --git a/internal/fsx/readdirshared_windows.go b/internal/fsx/readdirshared_windows.go
new file mode 100644
index 00000000..43942b5b
--- /dev/null
+++ b/internal/fsx/readdirshared_windows.go
@@ -0,0 +1,39 @@
+package fsx
+
+import (
+ "os"
+ "syscall"
+)
+
+// readDirShared lists the folder through a handle opened with
+// FILE_SHARE_DELETE (FILE_FLAG_BACKUP_SEMANTICS is what opens a folder). Any
+// failure to open it so falls back to os.ReadDir, as openShared does, and for
+// the same reason: os.ReadDir's path handling is not to be second-guessed.
+func readDirShared(path string) ([]os.DirEntry, error) {
+ f, err := openDirShared(path)
+ if err != nil {
+ return os.ReadDir(path)
+ }
+ defer f.Close()
+ return f.ReadDir(-1)
+}
+
+func openDirShared(path string) (*os.File, error) {
+ p, err := syscall.UTF16PtrFromString(path)
+ if err != nil {
+ return nil, err
+ }
+ h, err := syscall.CreateFile(
+ p,
+ syscall.GENERIC_READ,
+ syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE|syscall.FILE_SHARE_DELETE,
+ nil,
+ syscall.OPEN_EXISTING,
+ syscall.FILE_FLAG_BACKUP_SEMANTICS,
+ 0,
+ )
+ if err != nil {
+ return nil, err
+ }
+ return os.NewFile(uintptr(h), path), nil
+}
diff --git a/internal/fsx/readdirshared_windows_test.go b/internal/fsx/readdirshared_windows_test.go
new file mode 100644
index 00000000..17f9a976
--- /dev/null
+++ b/internal/fsx/readdirshared_windows_test.go
@@ -0,0 +1,67 @@
+package fsx
+
+import (
+ "os"
+ "path/filepath"
+ "sort"
+ "testing"
+)
+
+func folderWithSaves(t *testing.T) string {
+ t.Helper()
+ dir := filepath.Join(t.TempDir(), "slot1")
+ if err := os.MkdirAll(filepath.Join(dir, "sub"), 0o777); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(filepath.Join(dir, "a.sav"), []byte("x"), 0o666); err != nil {
+ t.Fatal(err)
+ }
+ return dir
+}
+
+// A folder being listed can still be removed: what a restore emptying the save
+// folder, or a game deleting a folder of its own, does while the watcher looks
+// inside it. The same with os.Open is refused, which is why this exists.
+func TestReadDirShared_TheFolderCanBeRemovedWhileListed(t *testing.T) {
+ dir := folderWithSaves(t)
+ f, err := openDirShared(dir)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := os.RemoveAll(dir); err != nil {
+ t.Errorf("a folder being listed could not be removed: %v", err)
+ }
+ f.Close()
+
+ dir = folderWithSaves(t)
+ plain, err := os.Open(dir)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer plain.Close()
+ if err := os.RemoveAll(dir); err == nil {
+ t.Log("NOTE: a folder held open by os.Open can now be removed on this Windows build")
+ }
+}
+
+func TestReadDirShared_ListsAsReadDirDoes(t *testing.T) {
+ dir := folderWithSaves(t)
+ got, err := ReadDirShared(dir)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var names []string
+ for _, e := range got {
+ names = append(names, e.Name())
+ if (e.Name() == "sub") != e.IsDir() {
+ t.Errorf("%s: IsDir %v", e.Name(), e.IsDir())
+ }
+ }
+ sort.Strings(names)
+ if len(names) != 2 || names[0] != "a.sav" || names[1] != "sub" {
+ t.Errorf("listed %v, want [a.sav sub]", names)
+ }
+ if _, err := ReadDirShared(filepath.Join(dir, "missing")); !os.IsNotExist(err) {
+ t.Errorf("a missing folder: %v, want not-exist", err)
+ }
+}
diff --git a/internal/p2p/cve_2026_103398_test.go b/internal/p2p/cve_2026_103398_test.go
index d9da824e..73502b17 100644
--- a/internal/p2p/cve_2026_103398_test.go
+++ b/internal/p2p/cve_2026_103398_test.go
@@ -1,17 +1,21 @@
package p2p
import (
+ "fmt"
"io"
"net/http"
"net/http/httptest"
"net/url"
"os"
"path/filepath"
+ "strconv"
"strings"
"testing"
+ "time"
"github.com/go-chi/chi/v5"
+ "github.com/opensave/opensave/internal/e2ee"
"github.com/opensave/opensave/internal/store"
)
@@ -244,3 +248,43 @@ func TestTrustNeedsTheProvenDevice(t *testing.T) {
t.Fatal("a folder was trusted for a request no signature proved")
}
}
+
+// A folder this device cannot vouch for is offered, and said so once: the
+// other device asks at every sync, and the log was one warning every few
+// seconds for as long as the offer stood.
+func TestAnOfferIsLoggedOnce(t *testing.T) {
+ c := newCVEFixture(t)
+ var warned int
+ c.engine.Log = func(level, msg string) {
+ if strings.Contains(msg, "offered on Home instead") {
+ warned++
+ }
+ }
+ // Three syncs from the other device, each a request of its own: signed
+ // afresh, as a device signs every request (askManifest reuses a nonce).
+ local, err := c.store.GetSettings()
+ if err != nil {
+ t.Fatal(err)
+ }
+ for i := 0; i < 3; i++ {
+ q := url.Values{"name": {"Totally A Game"}, "savePath": {c.secret}}
+ req := httptest.NewRequest(http.MethodGet, "/api/p2p/manifest/offered-once?"+q.Encode(), nil)
+ nonce, at := fmt.Sprintf("offer-nonce-%d", i), time.Now().UnixMilli()
+ req.Header.Set(lanAuthPeerHeader, c.peer.ID)
+ req.Header.Set(lanAuthNonceHeader, nonce)
+ req.Header.Set(lanAuthTimeHeader, strconv.FormatInt(at, 10))
+ req.Header.Set(lanAuthHeader, e2ee.RequestMAC(c.authKey, c.peer.ID, local.NodeID, req.URL.RequestURI(), http.MethodGet, nil, nonce, at))
+ req.RemoteAddr = "192.0.2.10:40000"
+ rec := httptest.NewRecorder()
+ c.router.ServeHTTP(rec, req)
+ if rec.Code != http.StatusNotFound {
+ t.Fatalf("request %d: %d %s, want the 404 an offer answers", i, rec.Code, rec.Body.String())
+ }
+ }
+ if warned != 1 {
+ t.Errorf("the offer was logged %d times over three requests, want once", warned)
+ }
+ if offered, _ := c.store.ListOfferedGames(); len(offered) != 1 {
+ t.Errorf("offers: %+v, want the one", offered)
+ }
+}
diff --git a/internal/p2p/routes.go b/internal/p2p/routes.go
index 8f5ada63..690fa50b 100644
--- a/internal/p2p/routes.go
+++ b/internal/p2p/routes.go
@@ -497,7 +497,7 @@ func (e *Engine) backfillCover(game store.Game, q manifestGameQuery) store.Game
// set to ask before tracking, to record who is waiting; empty is tolerated
// (an unidentified caller simply produces an offer with no named device).
// chooser is the device a signature proved made the request, or "": the only
-// one whose naming of a folder may be trusted (Devices, migration 0038).
+// one whose naming of a folder may be trusted (Devices, migration 0044).
func (e *Engine) ensureManifestGame(gameID string, q manifestGameQuery, peerID, chooser string) (store.Game, error) {
if game, err := e.Store.GetGame(gameID); err == nil {
return e.backfillCover(game, q), nil
@@ -615,9 +615,13 @@ func (e *Engine) ensureManifestGame(gameID string, q manifestGameQuery, peerID,
e.Log("info", fmt.Sprintf("tracking %q at %s, the folder a device you let choose folders named", q.Name, logging.Quote(localPath)))
}
if !known {
- e.Log("warn", fmt.Sprintf(
- "a paired device asked to sync %q at %s, which this device does not know as a save folder — "+
- "it is offered on Home instead, for you to place", q.Name, logging.Quote(localPath)))
+ // Said once, when the offer is new: the other device asks again at
+ // every sync, every few seconds, for as long as the offer stands.
+ if !e.alreadyOffered(gameID, peerID) {
+ e.Log("warn", fmt.Sprintf(
+ "a paired device asked to sync %q at %s, which this device does not know as a save folder — "+
+ "it is offered on Home instead, for you to place", q.Name, logging.Quote(localPath)))
+ }
return e.offerGame(gameID, peerID, q)
}
@@ -665,6 +669,21 @@ func (e *Engine) ensureManifestGame(gameID string, q manifestGameQuery, peerID,
// this device, and tells the peer this device is waiting rather than that the
// game does not exist: the same answer, which the peer cannot see past, is
// given for a game deliberately untracked.
+// alreadyOffered reports whether this device already offers the game as one
+// that device syncs.
+func (e *Engine) alreadyOffered(gameID, peerID string) bool {
+ offers, err := e.Store.OfferedGame(gameID)
+ if err != nil {
+ return false
+ }
+ for _, o := range offers {
+ if o.PeerID == peerID {
+ return true
+ }
+ }
+ return false
+}
+
func (e *Engine) offerGame(gameID, peerID string, q manifestGameQuery) (store.Game, error) {
if err := e.Store.RecordOfferedGame(store.OfferedGame{
GameID: gameID, PeerID: peerID, Name: q.Name,
diff --git a/internal/p2p/syncengine/engine.go b/internal/p2p/syncengine/engine.go
index 28bf6e0c..17c710c3 100644
--- a/internal/p2p/syncengine/engine.go
+++ b/internal/p2p/syncengine/engine.go
@@ -130,6 +130,8 @@ type Engine struct {
// on this device right now (settle.go).
settleMu sync.Mutex
gates map[string]*saveGate
+ // Protected by mu, alongside activeSyncs/pendingSyncs/followUps.
+ topologyMutations map[string]bool
// writtenAt is when a sync last stopped writing each game (BeingWritten).
writtenAt map[string]time.Time
// servedMu guards served: the save states this device recently handed
@@ -263,6 +265,33 @@ func (e *Engine) SyncBusy(gameID string) bool {
return e.activeSyncs[gameID] || e.pendingSyncs[gameID] || e.followUps[gameID] > 0
}
+func (e *Engine) launchQueuedSync(gameID string, peers []Peer) {
+ e.Log("info", fmt.Sprintf("running queued follow-up sync for %s", gameID))
+ go func() {
+ defer func() {
+ e.mu.Lock()
+ if e.followUps[gameID]--; e.followUps[gameID] <= 0 {
+ delete(e.followUps, gameID)
+ }
+ e.mu.Unlock()
+ }()
+ ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
+ defer cancel()
+ if e.OnlinePeers != nil {
+ peers = e.OnlinePeers()
+ }
+ if len(peers) == 0 {
+ e.Log("warn", fmt.Sprintf(
+ "queued follow-up sync for %s found no reachable devices — "+
+ "it will go out on the next sync", gameID))
+ return
+ }
+ if _, err := e.SyncGame(ctx, gameID, peers); err != nil {
+ e.Log("warn", fmt.Sprintf("queued follow-up sync for %s: %v", gameID, err))
+ }
+ }()
+}
+
func (e *Engine) SyncGame(ctx context.Context, gameID string, onlinePeers []Peer) (map[string]Result, error) {
// Every sync this device starts comes through here — a watched change, a
// peer coming online, the periodic reconcile, a sync asked for by hand or
@@ -270,6 +299,20 @@ func (e *Engine) SyncGame(ctx context.Context, gameID string, onlinePeers []Peer
if e.Paused != nil && e.Paused() {
return nil, ErrPaused
}
+ // A topology reservation excludes new syncs; queue their intent
+ // before checking hold state to avoid waiting behind the write gate.
+ e.mu.Lock()
+ topologyChanging := e.topologyMutations[gameID]
+ if topologyChanging {
+ if e.pendingSyncs == nil {
+ e.pendingSyncs = make(map[string]bool)
+ }
+ e.pendingSyncs[gameID] = true
+ }
+ e.mu.Unlock()
+ if topologyChanging {
+ return nil, ErrSyncQueued
+ }
// A game being played here is synced when the session ends (playing.go).
if e.PlayingHere(gameID) {
return nil, ErrPlayingHere
@@ -278,12 +321,34 @@ func (e *Engine) SyncGame(ctx context.Context, gameID string, onlinePeers []Peer
// meant (hold.go).
held, err := e.checkHoldSettled(ctx, gameID)
if err != nil && errors.Is(err, ErrSettling) {
+ // Topology may have started AFTER the early admission check and
+ // blocked the hold reader. Preserve the sync request for replay.
+ e.mu.Lock()
+ changing := e.topologyMutations[gameID]
+ if changing {
+ if e.pendingSyncs == nil {
+ e.pendingSyncs = make(map[string]bool)
+ }
+ e.pendingSyncs[gameID] = true
+ }
+ e.mu.Unlock()
+ if changing {
+ return nil, ErrSyncQueued
+ }
return nil, err
}
if err == nil && held {
return nil, ErrHeld
}
e.mu.Lock()
+ if e.topologyMutations[gameID] {
+ if e.pendingSyncs == nil {
+ e.pendingSyncs = make(map[string]bool)
+ }
+ e.pendingSyncs[gameID] = true
+ e.mu.Unlock()
+ return nil, ErrSyncQueued
+ }
if e.activeSyncs[gameID] {
e.pendingSyncs[gameID] = true
e.mu.Unlock()
@@ -305,42 +370,7 @@ func (e *Engine) SyncGame(ctx context.Context, gameID string, onlinePeers []Peer
}
e.mu.Unlock()
if rerun {
- e.Log("info", fmt.Sprintf("running queued follow-up sync for %s", gameID))
- // Fresh context: the queued requester's may already be gone.
- go func() {
- defer func() {
- e.mu.Lock()
- if e.followUps[gameID]--; e.followUps[gameID] <= 0 {
- delete(e.followUps, gameID)
- }
- e.mu.Unlock()
- }()
- ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
- defer cancel()
-
- // Resolve peers now rather than reusing the list the earlier
- // sync started with. That list describes the moment this
- // follow-up was queued behind, which can be minutes old: a
- // device may have dropped, come back on a different address,
- // or moved between LAN and relay. Syncing a queued change to
- // the wrong address fails in a goroutine nobody is watching,
- // and the caller was told "queued and will sync right after".
- peers := onlinePeers
- if e.OnlinePeers != nil {
- peers = e.OnlinePeers()
- }
- if len(peers) == 0 {
- // Say so. Returning quietly here is indistinguishable from
- // a completed sync, and the change simply never left.
- e.Log("warn", fmt.Sprintf(
- "queued follow-up sync for %s found no reachable devices — "+
- "it will go out on the next sync", gameID))
- return
- }
- if _, err := e.SyncGame(ctx, gameID, peers); err != nil {
- e.Log("warn", fmt.Sprintf("queued follow-up sync for %s: %v", gameID, err))
- }
- }()
+ e.launchQueuedSync(gameID, onlinePeers)
}
}()
diff --git a/internal/p2p/syncengine/settle.go b/internal/p2p/syncengine/settle.go
index a66c1c8d..fb4f987f 100644
--- a/internal/p2p/syncengine/settle.go
+++ b/internal/p2p/syncengine/settle.go
@@ -71,6 +71,9 @@ func isSettling(err error) bool {
// saveGate is one game's readers and writers.
type saveGate struct {
writers, waitingWriters, readers int
+ // topology excludes writers, readers and new sync admissions while a
+ // root mapping is changed; the reservation survives the Store commit.
+ topology bool
// changed is closed, and replaced, whenever any count falls: the moment a
// waiter's condition may have come true.
changed chan struct{}
@@ -93,7 +96,7 @@ func (e *Engine) gateLocked(gameID string) *saveGate {
func (e *Engine) wakeLocked(gameID string, g *saveGate) {
close(g.changed)
g.changed = make(chan struct{})
- if g.writers == 0 && g.waitingWriters == 0 && g.readers == 0 {
+ if g.writers == 0 && g.waitingWriters == 0 && g.readers == 0 && !g.topology {
delete(e.gates, gameID)
}
}
@@ -105,6 +108,13 @@ func (e *Engine) wakeLocked(gameID string, g *saveGate) {
func (e *Engine) Writing(gameID string) (done func()) {
e.settleMu.Lock()
g := e.gateLocked(gameID)
+ for g.topology {
+ ch := g.changed
+ e.settleMu.Unlock()
+ <-ch
+ e.settleMu.Lock()
+ g = e.gateLocked(gameID)
+ }
if g.writers == 0 {
// Readers are short — a walk of the folder — so this waits for them
// without a deadline. New ones queue behind it meanwhile.
@@ -177,7 +187,7 @@ func (e *Engine) Reading(ctx context.Context, gameID string) (done func(), err e
e.settleMu.Lock()
for {
g := e.gateLocked(gameID)
- if g.writers == 0 && g.waitingWriters == 0 {
+ if g.writers == 0 && g.waitingWriters == 0 && !g.topology {
g.readers++
break
}
@@ -214,7 +224,7 @@ func (e *Engine) Reading(ctx context.Context, gameID string) (done func(), err e
func (e *Engine) TryReading(gameID string) (done func(), ok bool) {
e.settleMu.Lock()
g := e.gateLocked(gameID)
- if g.writers > 0 || g.waitingWriters > 0 {
+ if g.writers > 0 || g.waitingWriters > 0 || g.topology {
e.settleMu.Unlock()
return func() {}, false
}
@@ -252,3 +262,98 @@ func (e *Engine) ReadManifest(ctx context.Context, gameID, path string) (delta.M
// out on the next ordinary sync, and a device that never finishes cannot keep
// this one asking forever.
const maxBusyFollowUps = 12
+
+// TryTopologyMutation reserves a game's root mapping against already-running
+// or queued sync passes and against new readers/writers until release. It is
+// nonblocking: a busy game must leave its mapping unchanged.
+//
+// Both mutexes are acquired before inspecting activity, so the decision and
+// reservation are atomic with SyncGame admission and Writing/Reading gates.
+// Lock order is always mu then settleMu.
+func (e *Engine) TryTopologyMutation(gameID string) (done func(), ok bool) {
+ e.mu.Lock()
+ defer e.mu.Unlock()
+ if e.activeSyncs[gameID] || e.pendingSyncs[gameID] || e.followUps[gameID] > 0 || e.topologyMutations[gameID] {
+ return nil, false
+ }
+ e.settleMu.Lock()
+ g := e.gateLocked(gameID)
+ if g.writers > 0 || g.waitingWriters > 0 || g.readers > 0 || g.topology {
+ e.settleMu.Unlock()
+ return nil, false
+ }
+ g.topology = true
+ if e.topologyMutations == nil {
+ e.topologyMutations = make(map[string]bool)
+ }
+ e.topologyMutations[gameID] = true
+ e.settleMu.Unlock()
+
+ var released bool
+ return func() {
+ e.mu.Lock()
+ if released {
+ e.mu.Unlock()
+ return
+ }
+ released = true
+ e.settleMu.Lock()
+ g := e.gateLocked(gameID)
+ g.topology = false
+ delete(e.topologyMutations, gameID)
+ e.wakeLocked(gameID, g)
+ e.settleMu.Unlock()
+ rerun := e.pendingSyncs[gameID]
+ delete(e.pendingSyncs, gameID)
+ if rerun {
+ if e.followUps == nil {
+ e.followUps = map[string]int{}
+ }
+ e.followUps[gameID]++
+ }
+ e.mu.Unlock()
+ if rerun {
+ e.launchQueuedSync(gameID, nil)
+ }
+ }, true
+}
+
+// WaitTopologyMutation waits for per-game admission, without holding either
+// sync mutex while polling. The caller supplies a single overall deadline.
+func (e *Engine) WaitTopologyMutation(ctx context.Context, gameID string, interval time.Duration) (release func(), err error) {
+ if interval <= 0 {
+ interval = 100 * time.Millisecond
+ }
+ for {
+ if err := ctx.Err(); err != nil {
+ return nil, err
+ }
+ done, ok := e.TryTopologyMutation(gameID)
+ if ok {
+ if err := ctx.Err(); err != nil {
+ done()
+ return nil, err
+ }
+ return done, nil
+ }
+ timer := time.NewTimer(interval)
+ select {
+ case <-ctx.Done():
+ // Private timer: do not drain an already-consumed channel.
+ timer.Stop()
+ return nil, ctx.Err()
+ case <-timer.C:
+ }
+ }
+}
+
+// IsWriting reports whether any native writer currently holds this game's
+// save locations. Root topology mutations (AddRoot / RemoveRoot) must refuse
+// while true so an in-flight pull cannot write into a path that has already
+// been unmapped.
+func (e *Engine) IsWriting(gameID string) bool {
+ e.settleMu.Lock()
+ defer e.settleMu.Unlock()
+ g := e.gates[gameID]
+ return g != nil && g.writers > 0
+}
diff --git a/internal/p2p/syncengine/topology_mutation_test.go b/internal/p2p/syncengine/topology_mutation_test.go
new file mode 100644
index 00000000..aec52695
--- /dev/null
+++ b/internal/p2p/syncengine/topology_mutation_test.go
@@ -0,0 +1,98 @@
+package syncengine
+
+import (
+ "context"
+ "errors"
+ "testing"
+ "time"
+)
+
+func TestTopologyMutationExcludesActiveWritersAndReaders(t *testing.T) {
+ e := &Engine{}
+ releaseWriter := e.Writing("game")
+ if _, ok := e.TryTopologyMutation("game"); ok {
+ t.Fatal("topology admitted while writer was active")
+ }
+ releaseWriter()
+ releaseReader, ok := e.TryReading("game")
+ if !ok {
+ t.Fatal("could not establish reader fixture")
+ }
+ if _, ok := e.TryTopologyMutation("game"); ok {
+ t.Fatal("topology admitted while reader was active")
+ }
+ releaseReader()
+ releaseTopology, ok := e.TryTopologyMutation("game")
+ if !ok {
+ t.Fatal("topology reservation should be available after drain")
+ }
+ if _, ok := e.TryTopologyMutation("game"); ok {
+ t.Fatal("competing topology mutation was admitted")
+ }
+ if done, ok := e.TryReading("game"); ok {
+ done()
+ t.Fatal("reader entered during topology mutation")
+ }
+ releaseTopology()
+ releaseTopology()
+ if done, ok := e.TryReading("game"); !ok {
+ t.Fatal("reader remained blocked after topology release")
+ } else {
+ done()
+ }
+}
+
+func TestTopologyMutationKeepsNewWriterOutUntilRelease(t *testing.T) {
+ e := &Engine{}
+ releaseTopology, ok := e.TryTopologyMutation("game")
+ if !ok {
+ t.Fatal("cannot reserve idle game")
+ }
+ acquired := make(chan struct{})
+ go func() {
+ releaseWrite := e.Writing("game")
+ close(acquired)
+ releaseWrite()
+ }()
+ select {
+ case <-acquired:
+ t.Fatal("native writer entered during topology mutation")
+ case <-time.After(25 * time.Millisecond):
+ }
+ releaseTopology()
+ select {
+ case <-acquired:
+ case <-time.After(2 * time.Second):
+ t.Fatal("writer never resumed after topology release")
+ }
+}
+
+func TestTopologyMutationQueuesSyncForRetry(t *testing.T) {
+ e := &Engine{Log: func(string, string) {}}
+ release, ok := e.TryTopologyMutation("game")
+ if !ok {
+ t.Fatal("cannot reserve idle game")
+ }
+ _, err := e.SyncGame(context.Background(), "game", nil)
+ if !errors.Is(err, ErrSyncQueued) {
+ t.Fatalf("sync during topology = %v, want queued", err)
+ }
+ e.mu.Lock()
+ queued := e.pendingSyncs["game"]
+ e.mu.Unlock()
+ if !queued {
+ t.Fatal("topology-refused sync intent was lost")
+ }
+ release()
+ deadline := time.Now().Add(2 * time.Second)
+ for time.Now().Before(deadline) {
+ e.mu.Lock()
+ pending := e.pendingSyncs["game"] || e.followUps["game"] > 0
+ e.mu.Unlock()
+ if !pending {
+ return
+ }
+ time.Sleep(time.Millisecond)
+ }
+ t.Fatal("queued follow-up was not drained after topology release")
+}
diff --git a/internal/presets/presets.go b/internal/presets/presets.go
index b11f6d50..93729a6e 100644
--- a/internal/presets/presets.go
+++ b/internal/presets/presets.go
@@ -87,7 +87,7 @@ var presetDefs = []preset{
LinuxPath: []string{"~/.config/PCSX2/memcards", "~/.var/app/net.pcsx2.PCSX2/config/PCSX2/memcards"}},
{ID: "rpcs3", Name: "RPCS3 PS3 Emulator", Type: "emulator", Path: "%APPDATA%/rpcs3/dev_hdd0/home/00000001/savedata",
LinuxPath: []string{"~/.config/rpcs3/dev_hdd0/home/00000001/savedata", "~/.var/app/net.rpcs3.RPCS3/config/rpcs3/dev_hdd0/home/00000001/savedata"}},
- {ID: "cemu", Name: "Cemu Wii U Emulator", Type: "emulator", Path: "%USERPROFILE%/Documents/Cemu/mlc01/usr/save",
+ {ID: "cemu", Name: "Cemu Wii U Emulator", Type: "emulator", Path: "%APPDATA%/Cemu/mlc01/usr/save",
LinuxPath: []string{"~/.local/share/Cemu/mlc01/usr/save", "~/.var/app/info.cemu.Cemu/data/Cemu/mlc01/usr/save"}},
{ID: "ppsspp", Name: "PPSSPP PSP Emulator", Type: "emulator", Path: "%USERPROFILE%/Documents/PPSSPP/PSP/SAVEDATA",
LinuxPath: []string{"~/.config/ppsspp/PSP/SAVEDATA", "~/.var/app/org.ppsspp.PPSSPP/config/ppsspp/PSP/SAVEDATA"}},
diff --git a/internal/presets/retro_emulators_test.go b/internal/presets/retro_emulators_test.go
index 0ad6e0f1..a45ba35d 100644
--- a/internal/presets/retro_emulators_test.go
+++ b/internal/presets/retro_emulators_test.go
@@ -30,6 +30,7 @@ func TestRetroEmulatorPresetsResolveOnLinux(t *testing.T) {
"fceux": ".fceux/sav",
"mesen": ".local/share/Mesen2/Saves",
"blastem": ".local/share/blastem",
+ "cemu": ".local/share/Cemu/mlc01/usr/save",
}
for id, rel := range cases {
@@ -54,14 +55,29 @@ func TestRetroEmulatorPresetsResolveOnLinux(t *testing.T) {
}
}
+// Cemu's own default on Windows is %APPDATA%\Cemu\mlc01 (CemuApp::DeterminePaths,
+// ActiveSettings::GetDefaultMLCPath). The preset named Documents\Cemu, a folder
+// Cemu never picks, so a default install was not found at all.
+func TestCemuWindowsPathIsCemusDefault(t *testing.T) {
+ for _, p := range presetDefs {
+ if p.ID == "cemu" {
+ if want := "%APPDATA%/Cemu/mlc01/usr/save"; p.Path != want {
+ t.Errorf("cemu Windows path = %q, want %q", p.Path, want)
+ }
+ return
+ }
+ }
+ t.Fatal("no cemu preset")
+}
+
// Every preset must carry a Linux path unless the emulator genuinely is
-// Windows-only. A Windows-only entry is a real choice (Cemu, Xenia, Project64);
+// Windows-only. A Windows-only entry is a real choice (Xenia, Project64);
// an accidentally Windows-only one silently excludes every Deck user, which is
// the audience most likely to be running these.
func TestRetroEmulatorPresetsCoverLinuxExceptWindowsOnlyOnes(t *testing.T) {
// Emulators with no Linux build worth detecting.
windowsOnly := map[string]bool{
- "xenia": true, "cemu": true, "project64": true,
+ "xenia": true, "project64": true,
}
for _, p := range presetDefs {
diff --git a/internal/store/games.go b/internal/store/games.go
index 7abfe98f..f8344d36 100644
--- a/internal/store/games.go
+++ b/internal/store/games.go
@@ -182,11 +182,6 @@ func (s *Store) UpdateGame(g Game) error {
// UpdateGameContext stops waiting for ownership admission when the caller cancels.
func (s *Store) UpdateGameContext(ctx context.Context, g Game) error {
- done, err := s.claimLockContext(ctx)
- if err != nil {
- return err
- }
- defer done()
// Avoid filesystem work for ordinary metadata-only updates. A concurrent
// relocation detected inside the transaction must fail closed instead.
var observedPath string
@@ -198,6 +193,11 @@ func (s *Store) UpdateGameContext(ctx context.Context, g Game) error {
}
var prepared *preparedNativePaths
if observedPath != g.SavePath {
+ done, err := s.claimLockContext(ctx)
+ if err != nil {
+ return err
+ }
+ defer done()
prepared, err = s.prepareNativePaths(g.SavePath)
if err != nil {
return err
diff --git a/internal/store/metadata_import_claim_test.go b/internal/store/metadata_import_claim_test.go
new file mode 100644
index 00000000..c50656a8
--- /dev/null
+++ b/internal/store/metadata_import_claim_test.go
@@ -0,0 +1,52 @@
+package store
+
+import (
+ "context"
+ "errors"
+ "path/filepath"
+ "testing"
+ "time"
+)
+
+// Metadata must remain writable while an unrelated import owns admission.
+// Relocation must still refuse without changing the stored path.
+func TestMetadataUpdatesBypassHeldImportClaim(t *testing.T) {
+ s := openTestStore(t)
+ g := Game{ID: "existing", Name: "Existing", SavePath: t.TempDir()}
+ if err := s.CreateGame(g); err != nil {
+ t.Fatal(err)
+ }
+ g, err := s.GetGame(g.ID)
+ if err != nil {
+ t.Fatal(err)
+ }
+ a, err := s.BeginImportPath(filepath.Join(t.TempDir(), "incoming"), "incoming")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer a.Release()
+ s.claimWaitFor = 20 * time.Millisecond
+ g.CoverURL = "https://example.invalid/cover.png"
+ g.ExePath = "synthetic-game"
+ g.MaxSnapshots = 7
+ if err := s.UpdateGame(g); err != nil {
+ t.Fatalf("metadata blocked by import: %v", err)
+ }
+ got, err := s.GetGame(g.ID)
+ if err != nil || got.CoverURL != g.CoverURL || got.ExePath != g.ExePath || got.MaxSnapshots != 7 {
+ t.Fatalf("metadata not committed: %+v %v", got, err)
+ }
+ g.SavePath = t.TempDir()
+ if err := s.UpdateGame(g); !errors.Is(err, ErrPathClaimBusy) {
+ t.Fatalf("relocation escaped claim: %v", err)
+ }
+ ctx, cancel := context.WithCancel(context.Background())
+ cancel()
+ if err := s.UpdateGameContext(ctx, g); !errors.Is(err, context.Canceled) {
+ t.Fatalf("relocation cancellation: %v", err)
+ }
+ got, err = s.GetGame(g.ID)
+ if err != nil || got.SavePath == g.SavePath {
+ t.Fatalf("refused relocation mutated path: %+v %v", got, err)
+ }
+}
diff --git a/internal/store/migrations/0038_peer_folder_trust.sql b/internal/store/migrations/0044_peer_folder_trust.sql
similarity index 75%
rename from internal/store/migrations/0038_peer_folder_trust.sql
rename to internal/store/migrations/0044_peer_folder_trust.sql
index c918a139..7686aff3 100644
--- a/internal/store/migrations/0038_peer_folder_trust.sql
+++ b/internal/store/migrations/0044_peer_folder_trust.sql
@@ -6,8 +6,9 @@
-- (CVE-2026-103398).
--
-- A table of its own rather than a column on peers, so an older version,
--- which reads peers rows strictly, still opens the database.
-CREATE TABLE peer_folder_trust (
+-- which reads peers rows strictly, still opens the database. IF NOT EXISTS:
+-- dev builds made it as 0038_peer_folder_trust.
+CREATE TABLE IF NOT EXISTS peer_folder_trust (
peer_id TEXT PRIMARY KEY,
since_ms INTEGER NOT NULL
);
diff --git a/internal/store/peer_folder_trust.go b/internal/store/peer_folder_trust.go
index ae6c813d..024b22f2 100644
--- a/internal/store/peer_folder_trust.go
+++ b/internal/store/peer_folder_trust.go
@@ -6,7 +6,7 @@ import (
)
// SetPeerChoosesFolders lets a paired device choose the folders of games it
-// syncs to this one, or stops it. See migration 0038.
+// syncs to this one, or stops it. See migration 0044.
func (s *Store) SetPeerChoosesFolders(peerID string, allowed bool) error {
if !allowed {
if _, err := s.db.Exec(`DELETE FROM peer_folder_trust WHERE peer_id = ?`, peerID); err != nil {
diff --git a/internal/store/peer_folder_trust_migration_test.go b/internal/store/peer_folder_trust_migration_test.go
new file mode 100644
index 00000000..34af779f
--- /dev/null
+++ b/internal/store/peer_folder_trust_migration_test.go
@@ -0,0 +1,34 @@
+package store
+
+import (
+ "path/filepath"
+ "testing"
+)
+
+// A database from a build that made the folder-trust table as migration 0038
+// opens, keeping what it holds, now that the table is migration 0044.
+func TestFolderTrustTableFromAnEarlierBuildOpens(t *testing.T) {
+ path := filepath.Join(t.TempDir(), "opensave.db")
+ s, err := Open(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, err := s.db.Exec(`INSERT INTO peer_folder_trust (peer_id, since_ms) VALUES ('peer-1', 1)`); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := s.db.Exec(`UPDATE schema_migrations SET name = '0038_peer_folder_trust.sql' WHERE name = '0044_peer_folder_trust.sql'`); err != nil {
+ t.Fatal(err)
+ }
+ if err := s.Close(); err != nil {
+ t.Fatal(err)
+ }
+
+ s, err = Open(path)
+ if err != nil {
+ t.Fatalf("a database from such a build no longer opens: %v", err)
+ }
+ defer s.Close()
+ if !s.PeerChoosesFolders("peer-1") {
+ t.Error("the trust it held was lost")
+ }
+}
diff --git a/internal/watcher/watcher.go b/internal/watcher/watcher.go
index e4ad729f..c9726f68 100644
--- a/internal/watcher/watcher.go
+++ b/internal/watcher/watcher.go
@@ -31,6 +31,7 @@ import (
"github.com/fsnotify/fsnotify"
"github.com/opensave/opensave/internal/delta"
+ "github.com/opensave/opensave/internal/fsx"
"github.com/opensave/opensave/internal/ignore"
"github.com/opensave/opensave/internal/logging"
"github.com/opensave/opensave/internal/owntouch"
@@ -1137,7 +1138,10 @@ func (e *Engine) registerFolders(ctx context.Context, gw *gameWatch) {
// looked up once per check, only when there are subfolders to look up. A
// burst of Writes to one folder is one check (queueCheck).
func (e *Engine) checkFolders(ctx context.Context, gw *gameWatch, dir string) bool {
- entries, err := os.ReadDir(dir)
+ // Listed so that it can still be removed meanwhile: the Write that brought
+ // this here may be a restore, or the game, emptying the folder
+ // (fsx.ReadDirShared).
+ entries, err := fsx.ReadDirShared(dir)
if err != nil {
return false // gone again, or unreadable: its own events will tell
}