"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: implemented about functionality
Gourav Tee9684e60fc6
diff --git a/backend/fichier/fichier.go b/backend/fichier/fichier.goindex 3dcac4d5d..1af73bdc2 100644--- a/backend/fichier/fichier.go+++ b/backend/fichier/fichier.go@@ -514,6 +514,32 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,return dstObj, nil}+// About gets quota information+func (f *Fs) About(ctx context.Context) (usage *fs.Usage, err error) {+ opts := rest.Opts{+ Method: "POST",+ Path: "/user/info.cgi",+ ContentType: "application/json",+ }+ var account_info AccountInfo+ var resp *http.Response+ err = f.pacer.Call(func() (bool, error) {+ resp, err = f.rest.CallJSON(ctx, &opts, nil, &account_info)+ return shouldRetry(ctx, resp, err)+ })+ if err != nil {+ return nil, fmt.Errorf("failed to read user info: %w", err)+ }++ // FIXME max upload size would be useful to use in Update+ usage = &fs.Usage{+ Used: fs.NewUsageValue(account_info.ColdStorage), // bytes in use+ Total: fs.NewUsageValue(account_info.AvailableColdStorage), // bytes total+ Free: fs.NewUsageValue(account_info.AvailableColdStorage - account_info.ColdStorage), // bytes free+ }+ return usage, nil+}+// PublicLink adds a "readable by anyone with link" permission on the given file or folder.func (f *Fs) PublicLink(ctx context.Context, remote string, expire fs.Duration, unlink bool) (string, error) {o, err := f.NewObject(ctx, remote)diff --git a/backend/fichier/structs.go b/backend/fichier/structs.goindex ab40fb25a..7868066e8 100644--- a/backend/fichier/structs.go+++ b/backend/fichier/structs.go@@ -182,3 +182,33 @@ type FoldersList struct {Status string `json:"Status"`SubFolders []Folder `json:"sub_folders"`}++type AccountInfo struct {+ StatsDate string `json:"stats_date"`+ MailRM string `json:"mail_rm"`+ DefaultQuota int64 `json:"default_quota"`+ UploadForbidden string `json:"upload_forbidden"`+ PageLimit int `json:"page_limit"`+ ColdStorage int64 `json:"cold_storage"`+ Status string `json:"status"`+ UseCDN string `json:"use_cdn"`+ AvailableColdStorage int64 `json:"available_cold_storage"`+ DefaultPort string `json:"default_port"`+ DefaultDomain int `json:"default_domain"`+ Email string `json:"email"`+ DownloadMenu string `json:"download_menu"`+ FTPDID int `json:"ftp_did"`+ DefaultPortFiles string `json:"default_port_files"`+ FTPReport string `json:"ftp_report"`+ OverQuota int64 `json:"overquota"`+ AvailableStorage int64 `json:"available_storage"`+ CDN string `json:"cdn"`+ Offer string `json:"offer"`+ SubscriptionEnd string `json:"subscription_end"`+ TFA string `json:"2fa"`+ AllowedColdStorage int64 `json:"allowed_cold_storage"`+ HotStorage int64 `json:"hot_storage"`+ DefaultColdStorageQuota int64 `json:"default_cold_storage_quota"`+ FTPMode string `json:"ftp_mode"`+ RUReport string `json:"ru_report"`+}