65 lines
1.7 KiB
Markdown
65 lines
1.7 KiB
Markdown
# proton-backup
|
|
|
|
A Go CLI tool for backing up local directories to Proton Drive with rate limiting, retry logic, and resume support.
|
|
|
|
## Build
|
|
|
|
```bash
|
|
go build
|
|
```
|
|
|
|
## Install
|
|
|
|
```bash
|
|
cp proton-backup ~/bin/
|
|
```
|
|
|
|
## Run
|
|
|
|
```bash
|
|
proton-backup -source /path/to/backup -remote /proton/drive/path
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
- `main.go` - Single-file implementation containing:
|
|
- CLI argument parsing
|
|
- Proton Drive authentication (username/password or env vars)
|
|
- Credential caching (`~/.config/proton-backup/credentials.json`)
|
|
- Directory walking and file upload
|
|
- SQLite state tracking for resume (`~/.config/proton-backup/state.db`)
|
|
- Rate limiting and exponential backoff on errors
|
|
|
|
## Dependencies
|
|
|
|
- `github.com/henrybear327/Proton-API-Bridge` - Proton Drive API with client-side encryption
|
|
- `github.com/mattn/go-sqlite3` - State tracking
|
|
- `golang.org/x/term` - Secure password input
|
|
|
|
## Key Configuration
|
|
|
|
The `AppVersion` header is required by Proton's API. Current value: `web-drive@5.2.0` (from Proton WebClients repo). If authentication fails with "Invalid app version", check https://github.com/ProtonMail/WebClients/blob/main/applications/drive/package.json for the current version.
|
|
|
|
## Authentication
|
|
|
|
First run prompts for credentials interactively. Alternatively, set environment variables:
|
|
- `PROTON_USERNAME`
|
|
- `PROTON_PASSWORD`
|
|
|
|
## Systemd Integration
|
|
|
|
Timer and service files are in `~/.config/systemd/user/`:
|
|
- `backup-immich-proton.service`
|
|
- `backup-immich-proton.timer`
|
|
|
|
## Testing
|
|
|
|
No automated tests yet. Manual testing:
|
|
```bash
|
|
# Dry run (still requires auth)
|
|
proton-backup -source /tank/immich/library -remote /backups/immich -dry-run
|
|
|
|
# Verbose output
|
|
proton-backup -source /tank/immich/library -remote /backups/immich -verbose
|
|
```
|