Repository navigation
Add Backup & Restore page with Google Drive integration - #3
Merged
Merged
Conversation
- Add BackupData DTO model for serializing user account data - Add GoogleDriveOptions configuration model - Add IBackupService/BackupService for creating and restoring backups - Add IGoogleDriveService/GoogleDriveService for Google Drive OAuth - Add GoogleDriveCallbackController for OAuth callback - Add Backup.razor page at /backup with full UI - Add backup link to NavMenu - Register services in Program.cs - Add Google Drive config to appsettings.json - Add Google.Apis.Drive.v3 NuGet package - Add DownloadFile JS interop method Co-authored-by: Undermozes <58026189+Undermozes@users.noreply.github.com>
…ests - Make RestoreBackup async (RestoreBackupAsync) to prevent deadlocks - Use DateTimeOffset.Now instead of DateTime.Now for consistency - Add TODO comment about in-memory token storage - Add 9 unit tests for BackupService - Register logging in test IoCActivator Co-authored-by: Undermozes <58026189+Undermozes@users.noreply.github.com>
… limits - Add cryptographic state token validation for OAuth callback (CSRF protection) - Use LocalRedirect instead of Redirect to prevent open redirect - Add backup ownership verification before restore - Add 10MB download size limit for Google Drive files - ValidateOAuthState method for one-time use state tokens Co-authored-by: Undermozes <58026189+Undermozes@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add backup functionality for user accounts to Google Drive
Add Backup & Restore page with Google Drive integration
Mar 11, 2026
Undermozes
marked this pull request as ready for review
March 11, 2026 20:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Users had no way to back up their account data (devices, device groups). This adds a
/backuppage enabling local JSON backup/restore and cloud storage via Google Drive OAuth.Core changes
Shared/Dtos/BackupData.cs— DTO models (BackupData,DeviceBackupDto,DeviceGroupBackupDto) for serializing user account dataServer/Services/BackupService.cs—IBackupServicefor creating, serializing, deserializing, and restoring backups. Restore only updates device metadata (alias, tags, notes, group) for devices that still exist in the orgServer/Services/GoogleDriveService.cs—IGoogleDriveServicewrapping Google Drive v3 API: OAuth flow, upload/list/download to aRemotely BackupsfolderServer/API/GoogleDriveCallbackController.cs— OAuth callback endpoint with cryptographic state token validationServer/Components/Pages/Backup.razor— Full page UI: download backup, upload restore file, connect Google Drive, list/restore cloud backupsServer/Components/Layout/NavMenu.razor— Added "Backup" nav link for authenticated usersSecurity
LocalRedirect("/backup")instead ofRedirectuserNameverified against current user before restoreRestoreBackupAsyncavoids.Wait()deadlocksConfiguration
Google Drive is optional. Server admins add credentials to
appsettings.json:When unconfigured, the UI shows an informational message instead of the connect button.
Tests
9 new tests in
BackupServiceTests.cscovering creation, round-trip serialization, restore behavior, and edge cases. All 27 tests (18 existing + 9 new) pass.Please read the following. Do not delete below this line.
Thank you for your contribution to the Remotely project. It is required that contributors assign copyright to Immense Networks so we retain full ownership of the project.
This makes it easier for other entities to use the software because they only have to deal with one copyright holder. It also gives me assurance that we'll be able to make decisions in the future without gathering and consulting all contributors.
While this may seem odd, many open source maintainers practice this. Here are a couple well-known examples:
A nice article on the topic can be found here: https://haacked.com/archive/2006/01/26/WhoOwnstheCopyrightforAnOpenSourceProject.aspx/
By submitting this PR, you agree to the following:
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
api.cdnjs.com/usr/bin/dotnet dotnet build Server/Server.csproj ely uppo��(dns block)/usr/bin/dotnet dotnet build Server/Server.csproj /p:ResolveLibManAssets=false ptsP��(dns block)/usr/bin/dotnet dotnet build Server/Server.csproj /p:LibManRestore=false /p:DisableLibManRestore=true --no-restore(dns block)unpkg.com/usr/bin/dotnet dotnet build Server/Server.csproj ely uppo��(dns block)/usr/bin/dotnet dotnet build Server/Server.csproj /p:ResolveLibManAssets=false ptsP��(dns block)/usr/bin/dotnet dotnet build Server/Server.csproj /p:LibManRestore=false /p:DisableLibManRestore=true --no-restore(dns block)www.myget.org/opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/csharp/tools/linux64/Semmle.Autobuild.CSharp /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/csharp/tools/linux64/Semmle.Autobuild.CSharp(dns block)/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Remotely/Remotely/Remotely.sln --packages /tmp/codeql-scratch-308cdbf2ab4d8643/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-308cdbf2ab4d8643/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-308cdbf2ab4d8643/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true /hom��(dns block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.