Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

fichier: add cdn option to use CDN for download - Fixes #6943

Nick Craig-Wood04d2781fdae0
diff --git a/backend/fichier/api.go b/backend/fichier/api.go
index 60b5c7f97..d75869a25 100644
--- a/backend/fichier/api.go
+++ b/backend/fichier/api.go
@@ -118,6 +118,9 @@ func (f *Fs) getDownloadToken(ctx context.Context, url string) (*GetTokenRespons
Single: 1,
Pass: f.opt.FilePassword,
}
+ if f.opt.CDN {
+ request.CDN = 1
+ }
opts := rest.Opts{
Method: "POST",
Path: "/download/get_token.cgi",
diff --git a/backend/fichier/fichier.go b/backend/fichier/fichier.go
index f42e5a341..c7ff25f52 100644
--- a/backend/fichier/fichier.go
+++ b/backend/fichier/fichier.go
@@ -54,6 +54,11 @@ func init() {
Name: "folder_password",
Advanced: true,
IsPassword: true,
+ }, {
+ Help: "Set if you wish to use CDN download links.",
+ Name: "cdn",
+ Default: false,
+ Advanced: true,
}, {
Name: config.ConfigEncoding,
Help: config.ConfigEncodingHelp,
@@ -89,6 +94,7 @@ type Options struct {
SharedFolder string `config:"shared_folder"`
FilePassword string `config:"file_password"`
FolderPassword string `config:"folder_password"`
+ CDN bool `config:"cdn"`
Enc encoder.MultiEncoder `config:"encoding"`
}
diff --git a/backend/fichier/structs.go b/backend/fichier/structs.go
index 02e50a632..aed910576 100644
--- a/backend/fichier/structs.go
+++ b/backend/fichier/structs.go
@@ -20,6 +20,7 @@ type DownloadRequest struct {
URL string `json:"url"`
Single int `json:"single"`
Pass string `json:"pass,omitempty"`
+ CDN int `json:"cdn,omitempty"`
}
// RemoveFolderRequest is the request structure of the corresponding request