diff --git a/README.md b/README.md index 419c0b67..b5c0b654 100644 --- a/README.md +++ b/README.md @@ -1501,7 +1501,6 @@ the same arguments can be set as volflags, in addition to `d2d`, `d2ds`, `d2t`, note: * upload-times can be displayed in the file listing by enabling the `.up_at` metadata key, either globally with `-e2d -mte +.up_at` or per-volume with volflags `e2d,mte=+.up_at` (will have a ~17% performance impact on directory listings) * `e2tsr` is probably always overkill, since `e2ds`/`e2dsa` would pick up any file modifications and `e2ts` would then reindex those, unless there is a new copyparty version with new parsers and the release note says otherwise -* the rescan button in the admin panel has no effect unless the volume has `-e2ds` or higher config file example (these options are recommended btw): diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 589e2bcf..733f2eb4 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -5100,15 +5100,24 @@ class HttpCli(object): return "" # unhandled / fallthrough def scanvol(self) -> bool: - if not self.can_admin: - raise Pebkac(403, "'scanvol' not allowed for user " + self.uname) - if self.args.no_rescan: raise Pebkac(403, "the rescan feature is disabled in server config") - vn, _ = self.asrv.vfs.get(self.vpath, self.uname, True, True) + vpaths = self.uparam["scan"].split(",/") + if vpaths == [""]: + vpaths = [self.vpath] - args = [self.asrv.vfs.all_vols, [vn.vpath], False, True] + vols = [] + for vpath in vpaths: + vn, _ = self.asrv.vfs.get(vpath, self.uname, True, True) + vols.append(vn.vpath) + if self.uname not in vn.axs.uadmin: + self.log("rejected scanning [%s] => [%s];" % (vpath, vn.vpath), 3) + raise Pebkac(403, "'scanvol' not allowed for user " + self.uname) + + self.log("trying to rescan %d volumes: %r" % (len(vols), vols)) + + args = [self.asrv.vfs.all_vols, vols, False, True] x = self.conn.hsrv.broker.ask("up2k.rescan", *args) err = x.get() diff --git a/docs/devnotes.md b/docs/devnotes.md index b86213ad..b4355f4c 100644 --- a/docs/devnotes.md +++ b/docs/devnotes.md @@ -261,6 +261,7 @@ upload modifiers: |--|--|--| | GET | `?reload=cfg` | reload config files and rescan volumes | | GET | `?scan` | initiate a rescan of the volume which provides URL | +| GET | `?scan=/a,/b` | initiate a rescan of volumes `/a` and `/b` | | GET | `?stack` | show a stacktrace of all threads | ## general