mirror of
https://github.com/rclone/rclone.git
synced 2025-02-17 02:22:46 +08:00
protondrive: implement two-password mode (#7279)
This commit is contained in:
parent
071c3f28e5
commit
ed755bf04f
|
@ -61,13 +61,23 @@ func init() {
|
||||||
NewFs: NewFs,
|
NewFs: NewFs,
|
||||||
Options: []fs.Option{{
|
Options: []fs.Option{{
|
||||||
Name: "username",
|
Name: "username",
|
||||||
Help: `The username of your proton drive account`,
|
Help: `The username of your proton account`,
|
||||||
Required: true,
|
Required: true,
|
||||||
}, {
|
}, {
|
||||||
Name: "password",
|
Name: "password",
|
||||||
Help: "The password of your proton drive account.",
|
Help: "The password of your proton account.",
|
||||||
Required: true,
|
Required: true,
|
||||||
IsPassword: 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",
|
Name: "2fa",
|
||||||
Help: `The 2FA code
|
Help: `The 2FA code
|
||||||
|
@ -151,6 +161,7 @@ then we might have a problem with caching the stale data.`,
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Username string `config:"username"`
|
Username string `config:"username"`
|
||||||
Password string `config:"password"`
|
Password string `config:"password"`
|
||||||
|
MailboxPassword string `config:"mailboxPassword"`
|
||||||
TwoFA string `config:"2fa"`
|
TwoFA string `config:"2fa"`
|
||||||
|
|
||||||
// advanced
|
// advanced
|
||||||
|
@ -313,6 +324,7 @@ func newProtonDrive(ctx context.Context, f *Fs, opt *Options, m configmap.Mapper
|
||||||
config.UseReusableLogin = false
|
config.UseReusableLogin = false
|
||||||
config.FirstLoginCredential.Username = opt.Username
|
config.FirstLoginCredential.Username = opt.Username
|
||||||
config.FirstLoginCredential.Password = opt.Password
|
config.FirstLoginCredential.Password = opt.Password
|
||||||
|
config.FirstLoginCredential.MailboxPassword = opt.MailboxPassword
|
||||||
config.FirstLoginCredential.TwoFA = opt.TwoFA
|
config.FirstLoginCredential.TwoFA = opt.TwoFA
|
||||||
protonDrive, auth, err := protonDriveAPI.NewProtonDrive(ctx, config, authHandler, deAuthHandler)
|
protonDrive, auth, err := protonDriveAPI.NewProtonDrive(ctx, config, authHandler, deAuthHandler)
|
||||||
if err != nil {
|
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)
|
ci := fs.GetConfig(ctx)
|
||||||
|
|
||||||
root = strings.Trim(root, "/")
|
root = strings.Trim(root, "/")
|
||||||
|
|
|
@ -90,7 +90,7 @@ To copy a local directory to an Proton Drive directory called backup
|
||||||
|
|
||||||
### Modified time
|
### Modified time
|
||||||
|
|
||||||
Proton Drive Bridge does not support modification times yet.
|
Proton Drive Bridge does not support updating modification times yet.
|
||||||
|
|
||||||
### Restricted filename characters
|
### 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
|
conflict occurs, depending on the advanced config, the file might or might not
|
||||||
be overwritten.
|
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
|
### Caching
|
||||||
|
|
||||||
The cache is currently built for the case when the rclone is the only instance
|
The cache is currently built for the case when the rclone is the only instance
|
||||||
|
|
Loading…
Reference in New Issue
Block a user