mirror of
https://github.com/rclone/rclone.git
synced 2025-04-19 18:31:10 +08:00
rc: add config/unlock
This commit is contained in:
parent
894ef3b375
commit
ce57103d46
@ -9,6 +9,37 @@ import (
|
||||
"github.com/rclone/rclone/fs/rc"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rc.Add(rc.Call{
|
||||
Path: "config/unlock",
|
||||
Fn: rcConfigPassword,
|
||||
Title: "Unlock the config file.",
|
||||
AuthRequired: true,
|
||||
Help: `
|
||||
Unlocks the config file if it is locked.
|
||||
|
||||
Parameters:
|
||||
|
||||
- 'config_password' - password to unlock the config file
|
||||
|
||||
A good idea is to disable AskPassword before making this call
|
||||
`,
|
||||
})
|
||||
}
|
||||
|
||||
// Unlock the config file
|
||||
// A good idea is to disable AskPassword before making this call
|
||||
func rcConfigPassword(ctx context.Context, in rc.Params) (out rc.Params, err error) {
|
||||
configPass, err := in.GetString("config_password")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if SetConfigPassword(configPass) != nil {
|
||||
return nil, errors.New("failed to set config password")
|
||||
}
|
||||
return DumpRcBlob(), nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
rc.Add(rc.Call{
|
||||
Path: "config/dump",
|
||||
|
Loading…
x
Reference in New Issue
Block a user