koofr: add digistorage service as a koofr provider.

This commit is contained in:
jaKa 2022-03-07 14:43:29 +01:00 committed by Nick Craig-Wood
parent 847868b4ba
commit 5d06a82c5d
7 changed files with 326 additions and 49 deletions

View File

@ -29,6 +29,7 @@ Rclone *("rsync for cloud storage")* is a command-line program to sync files and
* Ceph [:page_facing_up:](https://rclone.org/s3/#ceph)
* Citrix ShareFile [:page_facing_up:](https://rclone.org/sharefile/)
* DigitalOcean Spaces [:page_facing_up:](https://rclone.org/s3/#digitalocean-spaces)
* Digi Storage România [:page_facing_up:](https://rclone.org/koofr/#digi-storage-românia)
* Dreamhost [:page_facing_up:](https://rclone.org/s3/#dreamhost)
* Dropbox [:page_facing_up:](https://rclone.org/dropbox/)
* Enterprise File Fabric [:page_facing_up:](https://rclone.org/filefabric/)

View File

@ -28,13 +28,28 @@ import (
func init() {
fs.Register(&fs.RegInfo{
Name: "koofr",
Description: "Koofr",
Description: "Koofr, Digi Storage and other Koofr-compatible storage providers",
NewFs: NewFs,
Options: []fs.Option{{
Name: fs.ConfigProvider,
Help: "Choose your storage provider.",
// NOTE if you add a new provider here, then add it in the
// setProviderDefaults() function and update options accordingly
Examples: []fs.OptionExample{{
Value: "koofr",
Help: "Koofr, https://app.koofr.net/",
}, {
Value: "digistoragero",
Help: "Digi Storage Romania, https://storage.rcs-rds.ro/",
}, {
Value: "other",
Help: "Any other Koofr API compatible storage service",
}},
}, {
Name: "endpoint",
Help: "The Koofr API endpoint to use.",
Default: "https://app.koofr.net",
Advanced: true,
Provider: "other",
Required: true,
}, {
Name: "mountid",
Help: "Mount ID of the mount to use.\n\nIf omitted, the primary mount is used.",
@ -46,11 +61,24 @@ func init() {
Advanced: true,
}, {
Name: "user",
Help: "Your Koofr user name.",
Help: "Your user name.",
Required: true,
}, {
Name: "password",
Help: "Your Koofr password for rclone (generate one at https://app.koofr.net/app/admin/preferences/password).",
Help: "Your password for rclone (generate one at https://app.koofr.net/app/admin/preferences/password).",
Provider: "koofr",
IsPassword: true,
Required: true,
}, {
Name: "password",
Help: "Your password for rclone (generate one at https://storage.rcs-rds.ro/app/admin/preferences/password).",
Provider: "digistoragero",
IsPassword: true,
Required: true,
}, {
Name: "password",
Help: "Your password for rclone (generate one at your service's settings page).",
Provider: "other",
IsPassword: true,
Required: true,
}, {
@ -67,6 +95,7 @@ func init() {
// Options represent the configuration of the Koofr backend
type Options struct {
Provider string `config:"provider"`
Endpoint string `config:"endpoint"`
MountID string `config:"mountid"`
User string `config:"user"`
@ -251,13 +280,38 @@ func (f *Fs) fullPath(part string) string {
return f.opt.Enc.FromStandardPath(path.Join("/", f.root, part))
}
// NewFs constructs a new filesystem given a root path and configuration options
func setProviderDefaults(opt *Options) {
// handle old, provider-less configs
if opt.Provider == "" {
if opt.Endpoint == "" || strings.HasPrefix(opt.Endpoint, "https://app.koofr.net") {
opt.Provider = "koofr"
} else if strings.HasPrefix(opt.Endpoint, "https://storage.rcs-rds.ro") {
opt.Provider = "digistoragero"
} else {
opt.Provider = "other"
}
}
// now assign an endpoint
if opt.Provider == "koofr" {
opt.Endpoint = "https://app.koofr.net"
} else if opt.Provider == "digistoragero" {
opt.Endpoint = "https://storage.rcs-rds.ro"
}
}
// NewFs constructs a new filesystem given a root path and rclone configuration options
func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (ff fs.Fs, err error) {
opt := new(Options)
err = configstruct.Set(m, opt)
if err != nil {
return nil, err
}
setProviderDefaults(opt)
return NewFsFromOptions(ctx, name, root, opt)
}
// NewFsFromOptions constructs a new filesystem given a root path and internal configuration options
func NewFsFromOptions(ctx context.Context, name, root string, opt *Options) (ff fs.Fs, err error) {
pass, err := obscure.Reveal(opt.Password)
if err != nil {
return nil, err

View File

@ -114,6 +114,7 @@ WebDAV or S3, that work out of the box.)
{{< provider name="Citrix ShareFile" home="http://sharefile.com/" config="/sharefile/" >}}
{{< provider name="C14" home="https://www.online.net/en/storage/c14-cold-storage" config="/sftp/#c14" >}}
{{< provider name="DigitalOcean Spaces" home="https://www.digitalocean.com/products/object-storage/" config="/s3/#digitalocean-spaces" >}}
{{< provider name="Digi Storage România" home="https://storage.rcs-rds.ro/" config="/koofr/#digi-storage-românia" >}}
{{< provider name="Dreamhost" home="https://www.dreamhost.com/cloud/storage/" config="/s3/#dreamhost" >}}
{{< provider name="Dropbox" home="https://www.dropbox.com/" config="/dropbox/" >}}
{{< provider name="Enterprise File Fabric" home="https://storagemadeeasy.com/about/" config="/filefabric/" >}}

View File

@ -38,6 +38,7 @@ See the following for detailed instructions for
* [Compress](/compress/)
* [Crypt](/crypt/) - to encrypt other remotes
* [DigitalOcean Spaces](/s3/#digitalocean-spaces)
* [Digi Storage România](/koofr/#digi-storage-românia)
* [Dropbox](/dropbox/)
* [Enterprise File Fabric](/filefabric/)
* [FTP](/ftp/)

View File

@ -29,40 +29,51 @@ s) Set configuration password
q) Quit config
n/s/q> n
name> koofr
Option Storage.
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
Choose a number from below, or type in your own value.
[snip]
XX / Koofr
\ "koofr"
22 / Koofr, Digi Storage and other Koofr-compatible storage providers
\ (koofr)
[snip]
Storage> koofr
** See help for koofr backend at: https://rclone.org/koofr/ **
Your Koofr user name
Enter a string value. Press Enter for the default ("").
user> USER@NAME
Your Koofr password for rclone (generate one at https://app.koofr.net/app/admin/preferences/password)
y) Yes type in my own password
Option provider.
Choose your storage provider.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
1 / Koofr, https://app.koofr.net/
\ (koofr)
2 / Digi Storage Romania, https://storage.rcs-rds.ro/
\ (digistoragero)
3 / Any other Koofr API compatible storage service
\ (other)
provider> 1
Option user.
Your user name.
Enter a value.
user> USERNAME
Option password.
Your password for rclone (generate one at https://app.koofr.net/app/admin/preferences/password).
Choose an alternative below.
y) Yes, type in my own password
g) Generate random password
y/g> y
Enter the password:
password:
Confirm the password:
password:
Edit advanced config? (y/n)
Edit advanced config?
y) Yes
n) No
n) No (default)
y/n> n
Remote config
--------------------
[koofr]
type = koofr
baseurl = https://app.koofr.net
user = USER@NAME
provider = koofr
user = USERNAME
password = *** ENCRYPTED ***
--------------------
y) Yes this is OK
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
@ -84,7 +95,7 @@ List all the files in your Koofr
To copy a local directory to an Koofr directory called backup
rclone copy /home/source remote:backup
rclone copy /home/source koofr:backup
### Restricted filename characters
@ -101,40 +112,94 @@ as they can't be used in XML strings.
{{< rem autogenerated options start" - DO NOT EDIT - instead edit fs.RegInfo in backend/koofr/koofr.go then run make backenddocs" >}}
### Standard options
Here are the standard options specific to koofr (Koofr).
Here are the standard options specific to koofr (Koofr, Digi Storage and other Koofr-compatible storage providers).
#### --koofr-user
#### --koofr-provider
Your Koofr user name.
Choose your storage provider.
- Config: user
- Env Var: RCLONE_KOOFR_USER
Properties:
- Config: provider
- Env Var: RCLONE_KOOFR_PROVIDER
- Type: string
- Default: ""
#### --koofr-password
Your Koofr password for rclone (generate one at https://app.koofr.net/app/admin/preferences/password).
**NB** Input to this must be obscured - see [rclone obscure](/commands/rclone_obscure/).
- Config: password
- Env Var: RCLONE_KOOFR_PASSWORD
- Type: string
- Default: ""
### Advanced options
Here are the advanced options specific to koofr (Koofr).
- Required: false
- Examples:
- "koofr"
- Koofr, https://app.koofr.net/
- "digistoragero"
- Digi Storage Romania, https://storage.rcs-rds.ro/
- "other"
- Any other Koofr API compatible storage service
#### --koofr-endpoint
The Koofr API endpoint to use.
Properties:
- Config: endpoint
- Env Var: RCLONE_KOOFR_ENDPOINT
- Provider: other
- Type: string
- Default: "https://app.koofr.net"
- Required: true
#### --koofr-user
Your user name.
Properties:
- Config: user
- Env Var: RCLONE_KOOFR_USER
- Type: string
- Required: true
#### --koofr-password
Your password for rclone (generate one at https://app.koofr.net/app/admin/preferences/password).
**NB** Input to this must be obscured - see [rclone obscure](/commands/rclone_obscure/).
Properties:
- Config: password
- Env Var: RCLONE_KOOFR_PASSWORD
- Provider: koofr
- Type: string
- Required: true
#### --koofr-password
Your password for rclone (generate one at https://storage.rcs-rds.ro/app/admin/preferences/password).
**NB** Input to this must be obscured - see [rclone obscure](/commands/rclone_obscure/).
Properties:
- Config: password
- Env Var: RCLONE_KOOFR_PASSWORD
- Provider: digistoragero
- Type: string
- Required: true
#### --koofr-password
Your password for rclone (generate one at your service's settings page).
**NB** Input to this must be obscured - see [rclone obscure](/commands/rclone_obscure/).
Properties:
- Config: password
- Env Var: RCLONE_KOOFR_PASSWORD
- Provider: other
- Type: string
- Required: true
### Advanced options
Here are the advanced options specific to koofr (Koofr, Digi Storage and other Koofr-compatible storage providers).
#### --koofr-mountid
@ -142,10 +207,12 @@ Mount ID of the mount to use.
If omitted, the primary mount is used.
Properties:
- Config: mountid
- Env Var: RCLONE_KOOFR_MOUNTID
- Type: string
- Default: ""
- Required: false
#### --koofr-setmtime
@ -153,6 +220,8 @@ Does the backend support setting modification time.
Set this to false if you use a mount ID that points to a Dropbox or Amazon Drive backend.
Properties:
- Config: setmtime
- Env Var: RCLONE_KOOFR_SETMTIME
- Type: bool
@ -160,10 +229,12 @@ Set this to false if you use a mount ID that points to a Dropbox or Amazon Drive
#### --koofr-encoding
This sets the encoding for the backend.
The encoding for the backend.
See the [encoding section in the overview](/overview/#encoding) for more info.
Properties:
- Config: encoding
- Env Var: RCLONE_KOOFR_ENCODING
- Type: MultiEncoder
@ -175,3 +246,148 @@ See the [encoding section in the overview](/overview/#encoding) for more info.
Note that Koofr is case insensitive so you can't have a file called
"Hello.doc" and one called "hello.doc".
## Providers
### Koofr
This is the original [Koofr](https://koofr.eu) storage provider used as main example and described in the [configuration](#configuration) section above.
### Digi Storage România
[Digi Storage România](https://www.digi.ro/servicii/online/digi-storage) is a cloud storage service run by [Digi.ro](https://www.digi.ro/) that
provides a Koofr API.
Here is an example of how to make a remote called `ds`. First run:
rclone config
This will guide you through an interactive setup process:
```
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> ds
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
[snip]
22 / Koofr, Digi Storage and other Koofr-compatible storage providers
\ (koofr)
[snip]
Storage> koofr
Option provider.
Choose your storage provider.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
1 / Koofr, https://app.koofr.net/
\ (koofr)
2 / Digi Storage Romania, https://storage.rcs-rds.ro/
\ (digistoragero)
3 / Any other Koofr API compatible storage service
\ (other)
provider> 2
Option user.
Your user name.
Enter a value.
user> USERNAME
Option password.
Your password for rclone (generate one at https://storage.rcs-rds.ro/app/admin/preferences/password).
Choose an alternative below.
y) Yes, type in my own password
g) Generate random password
y/g> y
Enter the password:
password:
Confirm the password:
password:
Edit advanced config?
y) Yes
n) No (default)
y/n> n
--------------------
[ds]
type = koofr
provider = digistoragero
user = USERNAME
password = *** ENCRYPTED ***
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
```
### Other
You may also want to use another, public or private storage provider that runs a Koofr API compatible service, by simply providing the base URL to connect to.
Here is an example of how to make a remote called `other`. First run:
rclone config
This will guide you through an interactive setup process:
```
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> other
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
[snip]
22 / Koofr, Digi Storage and other Koofr-compatible storage providers
\ (koofr)
[snip]
Storage> koofr
Option provider.
Choose your storage provider.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
1 / Koofr, https://app.koofr.net/
\ (koofr)
2 / Digi Storage Romania, https://storage.rcs-rds.ro/
\ (digistoragero)
3 / Any other Koofr API compatible storage service
\ (other)
provider> 3
Option endpoint.
The Koofr API endpoint to use.
Enter a value.
endpoint> https://koofr.other.org
Option user.
Your user name.
Enter a value.
user> USERNAME
Option password.
Your password for rclone (generate one at your service's settings page).
Choose an alternative below.
y) Yes, type in my own password
g) Generate random password
y/g> y
Enter the password:
password:
Confirm the password:
password:
Edit advanced config?
y) Yes
n) No (default)
y/n> n
--------------------
[other]
type = koofr
provider = other
endpoint = https://koofr.other.org
user = USERNAME
password = *** ENCRYPTED ***
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
```

View File

@ -61,6 +61,7 @@
<a class="dropdown-item" href="/compress/"><i class="fas fa-compress"></i> Compress (transparent gzip compression)</a>
<a class="dropdown-item" href="/sharefile/"><i class="fas fa-share-square"></i> Citrix ShareFile</a>
<a class="dropdown-item" href="/crypt/"><i class="fa fa-lock"></i> Crypt (encrypts the others)</a>
<a class="dropdown-item" href="/koofr/#digi-storage-românia"><i class="fa fa-cloud"></i> Digi Storage România</a>
<a class="dropdown-item" href="/dropbox/"><i class="fab fa-dropbox"></i> Dropbox</a>
<a class="dropdown-item" href="/filefabric/"><i class="fa fa-cloud"></i> Enterprise File Fabric</a>
<a class="dropdown-item" href="/ftp/"><i class="fa fa-file"></i> FTP</a>

View File

@ -304,6 +304,9 @@ backends:
- backend: "koofr"
remote: "TestKoofr:"
fastlist: false
- backend: "koofr"
remote: "TestDigiStorageRo:"
fastlist: false
- backend: "premiumizeme"
remote: "TestPremiumizeMe:"
fastlist: false