ulozto: make password config item be obscured

This commit is contained in:
Nick Craig-Wood 2024-03-30 08:48:23 +00:00
parent 7c828ffe09
commit 679f4fdfa9
2 changed files with 48 additions and 19 deletions

View File

@ -22,6 +22,7 @@ import (
"github.com/rclone/rclone/fs/config"
"github.com/rclone/rclone/fs/config/configmap"
"github.com/rclone/rclone/fs/config/configstruct"
"github.com/rclone/rclone/fs/config/obscure"
"github.com/rclone/rclone/fs/fserrors"
"github.com/rclone/rclone/fs/fshttp"
"github.com/rclone/rclone/fs/hash"
@ -59,8 +60,8 @@ func init() {
{
Name: "app_token",
Default: "",
Help: "The application token identifying the app. An app API key can be either found in the API " +
"doc https://uloz.to/upload-resumable-api-beta or obtained from customer service.",
Help: `The application token identifying the app. An app API key can be either found in the API
doc https://uloz.to/upload-resumable-api-beta or obtained from customer service.`,
Sensitive: true,
},
{
@ -73,13 +74,13 @@ func init() {
Name: "password",
Default: "",
Help: "The password for the user.",
Sensitive: true,
IsPassword: true,
},
{
Name: "root_folder_slug",
Help: "If set, rclone will use this folder as the root folder for all operations. For example, " +
"if the slug identifies 'foo/bar/', 'ulozto:baz' is equivalent to 'ulozto:foo/bar/baz' without " +
"any root slug set.",
Help: `If set, rclone will use this folder as the root folder for all operations. For example,
if the slug identifies 'foo/bar/', 'ulozto:baz' is equivalent to 'ulozto:foo/bar/baz' without
any root slug set.`,
Default: "",
Advanced: true,
Sensitive: true,
@ -237,9 +238,13 @@ func (f *Fs) authenticate(ctx context.Context) (response *api.AuthenticateRespon
Path: "/v6/session",
}
clearPassword, err := obscure.Reveal(f.opt.Password)
if err != nil {
return nil, err
}
authRequest := api.AuthenticateRequest{
Login: f.opt.Username,
Password: f.opt.Password,
Password: clearPassword,
}
err = f.pacer.Call(func() (bool, error) {

View File

@ -10,7 +10,7 @@ Paths are specified as `remote:path`
Paths may be as deep as required, e.g. `remote:directory/subdirectory`.
The initial setup for Box involves filling in the user credentials.
The initial setup for Uloz.to involves filling in the user credentials.
`rclone config` walks you through it.
## Configuration
@ -49,8 +49,15 @@ username> user
Option password.
The password for the user.
Enter a value. Press Enter to leave empty.
password> secretPassword
Choose an alternative below. Press Enter for the default (n).
y) Yes, type in my own password
g) Generate random password
n) No, leave this optional password blank (default)
y/g/n> y
Enter the password:
password:
Confirm the password:
password:
Edit advanced config?
y) Yes
@ -79,8 +86,9 @@ To copy a local folder to a Uloz.to folder called backup:
rclone copy /home/source remote:backup
### User credentials
The only reliable method is to authenticate the user using
username and password. Uloz.to offers anb API key as well, but
username and password. Uloz.to offers an API key as well, but
it's reserved for the use of Uloz.to's in-house application
and using it in different circumstances is unreliable.
@ -136,7 +144,7 @@ to a specific folder hierarchy.
In order to do this you will have to find the `Folder slug` of the
folder you wish to use as root. This will be the last segment
of the URL when you open the relevant folder in the Box web
of the URL when you open the relevant folder in the Uloz.to web
interface.
For example, for exploring a folder with URL
@ -154,7 +162,8 @@ Here are the Standard options specific to ulozto (Uloz.to).
#### --ulozto-app-token
The application token identifying the app. An app API key can be either found in the API doc https://uloz.to/upload-resumable-api-beta or obtained from customer service.
The application token identifying the app. An app API key can be either found in the API
doc https://uloz.to/upload-resumable-api-beta or obtained from customer service.
Properties:
@ -178,6 +187,8 @@ Properties:
The password for the user.
**NB** Input to this must be obscured - see [rclone obscure](/commands/rclone_obscure/).
Properties:
- Config: password
@ -191,7 +202,9 @@ Here are the Advanced options specific to ulozto (Uloz.to).
#### --ulozto-root-folder-slug
If set, rclone will use this folder as the root folder for all operations. For example, if the slug identifies 'foo/bar/', 'ulozto:baz' is equivalent to 'ulozto:foo/bar/baz' without any root slug set.
If set, rclone will use this folder as the root folder for all operations. For example,
if the slug identifies 'foo/bar/', 'ulozto:baz' is equivalent to 'ulozto:foo/bar/baz' without
any root slug set.
Properties:
@ -224,6 +237,17 @@ Properties:
- Type: Encoding
- Default: Slash,BackSlash,Del,Ctl,InvalidUtf8,Dot
#### --ulozto-description
Description of the remote
Properties:
- Config: description
- Env Var: RCLONE_ULOZTO_DESCRIPTION
- Type: string
- Required: false
{{< rem autogenerated options stop >}}
## Limitations