Skip to content

Add Google Drive as a cloud save provider - #228

Draft
innateessence wants to merge 8 commits into
elripalda:mainfrom
innateessence:feat/google-drive-saves
Draft

innateessence wants to merge 8 commits into
elripalda:mainfrom
innateessence:feat/google-drive-saves

Conversation

@innateessence

@innateessence innateessence commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer summary

Adds Google Drive as an optional cloud-save destination without requiring a RecompStore account. RecompStore remains the default, and existing save declarations are reused.

  • Desktop and Big Picture support connecting Google, choosing a provider, enabling individual games, syncing, and resolving conflicts.
  • Saves go directly to the player's Drive. The implementation covers interrupted uploads, offline retries, account isolation, conflict history, and validation before restoring files.
  • Main review areas: provider selection in save_provider.rs, OAuth and storage in drive.rs, and sync/restore safety in cloud.rs and saves.rs. Release configuration is documented in docs/GOOGLE-DRIVE.md.
  • Validation: 689 Rust tests passed, one ignored; 271 JavaScript tests passed; browser smoke checks passed with simulated backend responses.

Before release, production Google OAuth configuration and a live two-installation save round trip still need validation.

What this changes

Players can connect their own Google Drive account and choose it as their cloud-save destination without a RecompStore account. Desktop and Big Picture share provider selection, per-game consent, sync controls, and save history. Drive storage uses resumable uploads, immutable snapshots with conflict ancestry, and archive validation before restore. Sync baselines and pending uploads are isolated by provider and account. Cleanup removes discarded ancestors oldest-first so interrupted pruning preserves the current head set. Choosing a cloud branch resolves from the selected archive, even when restoration retains extra local save slots; interrupted resolution can retry using that same snapshot.

Drive archive validation applies file-count and total-size limits separately to each save location. Its manifest budget scales with archive entries, path lengths, and locations, allowing full multi-location backups while rejecting disproportionate manifest padding. Resumable upload probes and data PUTs discard persisted session URLs after terminal 4xx responses while preserving quota, authorization, and retry reporting; server errors retain sessions for resuming. All Drive and OAuth requests honor the launcher’s dynamic Off, System, and Custom proxy settings.

Drive restores validate every archive entry against the local save template and save-file exclusions before making backups or changing live files. Installed release files, selected launch programs, and managed inputs are protected, even when modified archives have matching hashes. File and glob mismatches, linked destination or staging paths, and Windows trailing-dot/space filename aliases are rejected.

Save operations retain the launch fast path for games without cloud consent or a connected provider, then recheck eligibility after acquiring the save mutex. Initial cloud sync releases that mutex before starting the session backup/upload path. Disconnect waits for any token refresh before deleting credentials so a late refresh cannot recreate the connection.

Sign-in completion reads the current provider and consent state without changing providers. Refreshing that state preserves individual games from shared installations, and errors from later sign-in polls close the dialog and report the failure. Google OAuth client credentials are supplied at build time; setup and storage behavior are documented in docs/GOOGLE-DRIVE.md. Existing manifest save paths are reused.

How you tested it

Linux:

  • cargo test --manifest-path src-tauri/Cargo.toml: 689 passed, 1 ignored. An existing test creates and removes a temporary directory under the home folder, so the full suite ran outside the workspace filesystem sandbox.
  • node --test tests/*.test.cjs: 271 passed.
  • node tools/check-google-drive-ui.cjs: desktop settings, connected-account controls, missing OAuth configuration, connection cancellation, and Big Picture keyboard navigation passed without JavaScript exceptions.
  • JavaScript syntax checks and git diff --check.
  • Native launcher check (npm run dev) and live Google authorization.

New regression tests validate a launcher-created backup with 20,000 files in each of two save folders, with 100-character filenames and a manifest larger than 8 MiB, independent location size budgets, persisted session invalidation after rejected uploads, preserved sessions after server errors, and proxy changes without rebuilding the Drive client.

Restore regression tests exercise the production restore entry point: executable replacement with matching hashes, installed data and selected launch programs, managed inputs, file/glob mismatches, linked destinations and staging paths, and Windows filename aliases. A mixed archive with a later invalid entry leaves both the existing program and earlier save data untouched. Valid single-file, glob, and nested-folder restores still succeed.

Additional regressions verify that every interrupted pruning prefix preserves the current head set, unresolved branches remain unpruned, and cloud selection and retry use the chosen archive despite retained local slots. A compressed archive with excessive manifest padding is rejected.

Regression tests cover local-only launches during other save operations, consent/provider changes while a sync waits for the save mutex, disconnect during token refresh, consent refresh after sign-in, individual games from shared installations, and errors on subsequent sign-in polls. Drive tests also cover concurrent snapshot branches, revisions, OAuth callbacks, upload resume offsets, account isolation, and archive validation.

The browser check loads the shipped UI with simulated Tauri responses and never signs into Google or touches existing launcher data. It writes screenshots and a results JSON file to a temporary directory. Cross-platform builds are covered by the PR checks. Production OAuth configuration and a live two-device save round trip remain required before release.

Screenshots

Captured by the browser smoke check with simulated backend state; the connected-account address is an example.

Desktop save destination settings:

Desktop save destination settings

Google Drive selected in Big Picture:

Google Drive selected in Big Picture

Checklist

  • One feature per pull request.
  • No version bump or patch notes.
  • No developer-facing manifest changes; existing saves declarations and exclusions apply.

@innateessence
innateessence force-pushed the feat/google-drive-saves branch 2 times, most recently from 819f411 to 50b12bf Compare November 16, 2026 02:15
@innateessence

Copy link
Copy Markdown
Contributor Author

Vibed out with GPT Sol 6.1

@Xarishark

Copy link
Copy Markdown
Collaborator

hey I have already started working on this please talk with us on discord before starting to work on new features as its a shame to waste tokens and most of all time. Also this needs a backend change as you said and we have to talk abou that first even tho I agree that this feature is good. Instead of drive only tho i want to add the big 3 providers in one go and keep everything properly protected for the user.

@innateessence
innateessence marked this pull request as ready for review November 16, 2026 18:26
@innateessence

Copy link
Copy Markdown
Contributor Author

@Xarishark Feel free to close this if you wish

@Xarishark

Xarishark commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

@innateessence no need to close this at all as there are many usefull additions here. Any chance you are on discord and can join our server if not joined already? if yes do tell me your discord nick

Edit: Converted to draft because this will be added on a later update and I could add my work there so the PR can stay yours while we work on it.

@Xarishark

Copy link
Copy Markdown
Collaborator

I pushed two commits to this branch so Google Drive works with the cloud save status in #289 (the backend for a save status badge on each game's page).

1. A merge of main and #289. This branch was on Beta 55, so it brings in main up to today as well. It also means this PR now builds on #289: until #289 is merged, its commits show up in this diff too, so #289 needs to go in first. The conflicts were in cloud.rs (take_cloud, upload_current, check_saves, the tests) and the command list in lib.rs. I kept both sides: your provider branches, with the status hooks around them.

2. Save status follows the chosen cloud. #289 only knew RecompStore. With Drive:

  • saves_status uses save_provider::ready for "connected", not the RecompStore sign-in, so a Drive player without a RecompStore account doesn't see "Not signed in". It also reports provider / providerName.
  • The Drive branch of upload_copy records the sync time and PC (mark_synced) and sends the save-sync "up" event, like the website upload.
  • A conflict is remembered until the player picks, in both places Drive reports one: top.conflict in upload_one, and the SYNC_CONFLICT error from drive::upload.
  • "Google Drive storage is full" is recorded as a full problem. RecompStore's pause and 150 MB flags only count when RecompStore is the cloud.
  • When cloud_scope changes (another cloud or account), saves::state now also forgets the old cloud's conflict, problem and sync time, not only the synced hash and the queue (State::forget_cloud).
  • provider_changes_discard_the_sync_baseline_and_queue builds a State with ..Default::default() now, since State has more fields.

Nothing changed in drive.rs or save_provider.rs.

Tested on Fedora 43 (bazzite-kde), on the pushed head: cargo test --lib 797 passed, 0 failed, 1 ignored (4 new: a full Drive, a Drive conflict error kept as a conflict, a known conflict version kept, a provider switch forgetting the old status); node --test tests/*.test.cjs 348 passed, 0 failed. Not tried against a real Google account.

innateessence and others added 8 commits November 25, 2026 17:52
saves_status says connected when the picked cloud is ready (not only when signed in to
RecompStore) and names it. A Drive upload records its sync and sends the "up" event, Drive
conflicts are remembered until the player picks, and a full Drive is a full problem.
RecompStore's pause and 150 MB only count when it's the cloud, and switching cloud or account
forgets the old one's conflict, problem and sync time.
@innateessence
innateessence force-pushed the feat/google-drive-saves branch from 91bd8c2 to 0bf5773 Compare November 26, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants