"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
fichier: support downloading password protected files and folders
Florian Penzkofer92b3518c7884
diff --git a/backend/fichier/api.go b/backend/fichier/api.goindex 991ad621a..3558e5661 100644--- a/backend/fichier/api.go+++ b/backend/fichier/api.go@@ -4,6 +4,7 @@ import ("context""io""net/http"+ "net/url""regexp""strconv""strings"@@ -90,6 +91,7 @@ func (f *Fs) getDownloadToken(ctx context.Context, url string) (*GetTokenResponsrequest := DownloadRequest{URL: url,Single: 1,+ Pass: f.opt.FilePassword,}opts := rest.Opts{Method: "POST",@@ -118,10 +120,16 @@ func fileFromSharedFile(file *SharedFile) File {func (f *Fs) listSharedFiles(ctx context.Context, id string) (entries fs.DirEntries, err error) {opts := rest.Opts{- Method: "GET",- RootURL: "https://1fichier.com/dir/",- Path: id,- Parameters: map[string][]string{"json": {"1"}},+ Method: "GET",+ RootURL: "https://1fichier.com/dir/",+ Path: id,+ Parameters: map[string][]string{"json": {"1"}},+ ContentType: "application/x-www-form-urlencoded",+ }+ if f.opt.FolderPassword != "" {+ opts.Method = "POST"+ opts.Parameters = nil+ opts.Body = strings.NewReader("json=1&pass=" + url.QueryEscape(f.opt.FolderPassword))}var sharedFiles SharedFolderResponsediff --git a/backend/fichier/fichier.go b/backend/fichier/fichier.goindex 5a5800b90..c46f45c24 100644--- a/backend/fichier/fichier.go+++ b/backend/fichier/fichier.go@@ -44,6 +44,18 @@ func init() {Name: "shared_folder",Required: false,Advanced: true,+ }, {+ Help: "If you want to download a shared file that is password protected, add this parameter",+ Name: "file_password",+ Required: false,+ Advanced: true,+ IsPassword: true,+ }, {+ Help: "If you want to list the files in a shared folder that is password protected, add this parameter",+ Name: "folder_password",+ Required: false,+ Advanced: true,+ IsPassword: true,}, {Name: config.ConfigEncoding,Help: config.ConfigEncodingHelp,@@ -75,9 +87,11 @@ func init() {// Options defines the configuration for this backendtype Options struct {- APIKey string `config:"api_key"`- SharedFolder string `config:"shared_folder"`- Enc encoder.MultiEncoder `config:"encoding"`+ APIKey string `config:"api_key"`+ SharedFolder string `config:"shared_folder"`+ FilePassword string `config:"file_password"`+ FolderPassword string `config:"folder_password"`+ Enc encoder.MultiEncoder `config:"encoding"`}// Fs is the interface a cloud storage system must providediff --git a/backend/fichier/structs.go b/backend/fichier/structs.goindex c20e459f1..40efd0032 100644--- a/backend/fichier/structs.go+++ b/backend/fichier/structs.go@@ -19,6 +19,7 @@ type ListFilesRequest struct {type DownloadRequest struct {URL string `json:"url"`Single int `json:"single"`+ Pass string `json:"pass,omitempty"`}// RemoveFolderRequest is the request structure of the corresponding request