diff --git a/backend/protondrive/protondrive.go b/backend/protondrive/protondrive.go index e19edc75b..0aa24d306 100644 --- a/backend/protondrive/protondrive.go +++ b/backend/protondrive/protondrive.go @@ -61,13 +61,23 @@ func init() { NewFs: NewFs, Options: []fs.Option{{ Name: "username", - Help: `The username of your proton drive account`, + Help: `The username of your proton account`, Required: true, }, { Name: "password", - Help: "The password of your proton drive account.", + Help: "The password of your proton account.", Required: true, IsPassword: true, + }, { + Name: "mailboxPassword", + Help: `The mailbox password of your two-password proton account. + +For more information regarding the mailbox password, please check the +following official knowledge base article: +https://proton.me/support/the-difference-between-the-mailbox-password-and-login-password +`, + IsPassword: true, + Advanced: true, }, { Name: "2fa", Help: `The 2FA code @@ -149,9 +159,10 @@ then we might have a problem with caching the stale data.`, // Options defines the configuration for this backend type Options struct { - Username string `config:"username"` - Password string `config:"password"` - TwoFA string `config:"2fa"` + Username string `config:"username"` + Password string `config:"password"` + MailboxPassword string `config:"mailboxPassword"` + TwoFA string `config:"2fa"` // advanced Enc encoder.MultiEncoder `config:"encoding"` @@ -313,6 +324,7 @@ func newProtonDrive(ctx context.Context, f *Fs, opt *Options, m configmap.Mapper config.UseReusableLogin = false config.FirstLoginCredential.Username = opt.Username config.FirstLoginCredential.Password = opt.Password + config.FirstLoginCredential.MailboxPassword = opt.MailboxPassword config.FirstLoginCredential.TwoFA = opt.TwoFA protonDrive, auth, err := protonDriveAPI.NewProtonDrive(ctx, config, authHandler, deAuthHandler) if err != nil { @@ -344,6 +356,14 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e } } + if opt.MailboxPassword != "" { + var err error + opt.MailboxPassword, err = obscure.Reveal(opt.MailboxPassword) + if err != nil { + return nil, fmt.Errorf("couldn't decrypt mailbox password: %w", err) + } + } + ci := fs.GetConfig(ctx) root = strings.Trim(root, "/") diff --git a/docs/content/protondrive.md b/docs/content/protondrive.md index 315b8a7fb..96554352a 100644 --- a/docs/content/protondrive.md +++ b/docs/content/protondrive.md @@ -90,7 +90,7 @@ To copy a local directory to an Proton Drive directory called backup ### Modified time -Proton Drive Bridge does not support modification times yet. +Proton Drive Bridge does not support updating modification times yet. ### Restricted filename characters @@ -103,6 +103,10 @@ Proton Drive can not have two files with exactly the same name and path. If the conflict occurs, depending on the advanced config, the file might or might not be overwritten. +### [Mailbox password](https://proton.me/support/the-difference-between-the-mailbox-password-and-login-password) + +Please set your mailbox password in the advanced config section. + ### Caching The cache is currently built for the case when the rclone is the only instance