"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
plugins: Add reverse proxy pluginsHandler for serving plugins
Chaitanya Bankanhal22674d114603
diff --git a/fs/rc/rcserver/rcserver.go b/fs/rc/rcserver/rcserver.goindex 4b2958d50..6dd030ad0 100644--- a/fs/rc/rcserver/rcserver.go+++ b/fs/rc/rcserver/rcserver.go@@ -61,12 +61,14 @@ func Start(opt *rc.Options) (*Server, error) {// Server contains everything to run the rc servertype Server struct {*httplib.Server- files http.Handler- opt *rc.Options+ files http.Handler+ pluginsHandler http.Handler+ opt *rc.Options}func newServer(opt *rc.Options, mux *http.ServeMux) *Server {fileHandler := http.Handler(nil)+ pluginsHandler := http.Handler(nil)// Add some more mime types which are often missing_ = mime.AddExtensionType(".wasm", "application/wasm")_ = mime.AddExtensionType(".js", "application/javascript")@@ -104,12 +106,15 @@ func newServer(opt *rc.Options, mux *http.ServeMux) *Server {fs.Logf(nil, "Serving Web GUI")fileHandler = http.FileServer(http.Dir(extractPath))++ pluginsHandler = http.FileServer(http.Dir(webgui.PluginsPath))}s := &Server{- Server: httplib.NewServer(mux, &opt.HTTPOptions),- opt: opt,- files: fileHandler,+ Server: httplib.NewServer(mux, &opt.HTTPOptions),+ opt: opt,+ files: fileHandler,+ pluginsHandler: pluginsHandler,}mux.HandleFunc("/", s.handler)@@ -366,11 +371,13 @@ var fsMatch = regexp.MustCompile(`^\[(.*?)\](.*)$`)func (s *Server) handleGet(w http.ResponseWriter, r *http.Request, path string) {// Look to see if this has an fs in the path- match := fsMatch.FindStringSubmatch(path)+ fsMatchResult := fsMatch.FindStringSubmatch(path)+ pluginsMatchResult := webgui.PluginsMatch.FindStringSubmatch(path)+switch {- case match != nil && s.opt.Serve:+ case fsMatchResult != nil && s.opt.Serve:// Serve /[fs]/remote files- s.serveRemote(w, r, match[2], match[1])+ s.serveRemote(w, r, fsMatchResult[2], fsMatchResult[1])returncase path == "metrics" && s.opt.EnableMetrics:promHandler.ServeHTTP(w, r)@@ -380,6 +387,15 @@ func (s *Server) handleGet(w http.ResponseWriter, r *http.Request, path string)s.serveRoot(w, r)returncase s.files != nil:+ if s.opt.WebUI && pluginsMatchResult != nil {+ ok := webgui.ServePluginOK(w, r, pluginsMatchResult)+ if !ok {+ r.URL.Path = fmt.Sprintf("/%s/%s/app/build/%s", pluginsMatchResult[1], pluginsMatchResult[2], pluginsMatchResult[3])+ s.pluginsHandler.ServeHTTP(w, r)+ return+ }+ return+ }// Serve the filesr.URL.Path = "/" + paths.files.ServeHTTP(w, r)