"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
rc: add NeedsRequest to call.
Chaitanyad0de39ebcd2c
diff --git a/fs/operations/rc.go b/fs/operations/rc.goindex 6482612bc..5bc0c7033 100644--- a/fs/operations/rc.go+++ b/fs/operations/rc.go@@ -138,10 +138,11 @@ func rcMoveOrCopyFile(ctx context.Context, in rc.Params, cp bool) (out rc.Paramsfunc init() {for _, op := range []struct {- name string- title string- help string- noRemote bool+ name string+ title string+ help string+ noRemote bool+ needsRequest bool}{{name: "mkdir", title: "Make a destination directory or container"},{name: "rmdir", title: "Remove an empty directory or container"},@@ -160,6 +161,7 @@ func init() {rc.Add(rc.Call{Path: "operations/" + op.name,AuthRequired: true,+ NeedsRequest: op.needsRequest,Fn: func(ctx context.Context, in rc.Params) (rc.Params, error) {return rcSingleCommand(ctx, in, op.name, op.noRemote)},diff --git a/fs/rc/rcserver/rcserver.go b/fs/rc/rcserver/rcserver.goindex 0bfff0c7b..7f324c21b 100644--- a/fs/rc/rcserver/rcserver.go+++ b/fs/rc/rcserver/rcserver.go@@ -248,7 +248,6 @@ func (s *Server) handlePost(w http.ResponseWriter, r *http.Request, path string)return}}-// Find the callcall := rc.Calls.Get(path)if call == nil {@@ -261,6 +260,10 @@ func (s *Server) handlePost(w http.ResponseWriter, r *http.Request, path string)writeError(path, in, w, errors.Errorf("authentication must be set up on the rc server to use %q or the --rc-no-auth flag must be in use", path), http.StatusForbidden)return}+ if call.NeedsRequest {+ // Add the request to RC+ in["_request"] = r+ }// Check to see if it is async or notisAsync, err := in.GetBool("_async")diff --git a/fs/rc/registry.go b/fs/rc/registry.goindex eb452ce60..f2f5a1fb8 100644--- a/fs/rc/registry.go+++ b/fs/rc/registry.go@@ -22,6 +22,7 @@ type Call struct {Title string // help for the functionAuthRequired bool // if set then this call requires authorisation to be setHelp string // multi-line markdown formatted help+ NeedsRequest bool // if set then this call will be passed the original request object as _request}// Registry holds the list of all the registered remote control functions