add volflag to hide volume from controlpanel listing

This commit is contained in:
ed 2025-07-07 14:15:58 +00:00
parent fad2268566
commit fd7c71d6a3
4 changed files with 13 additions and 0 deletions

View file

@ -1535,6 +1535,7 @@ def add_ui(ap, retry):
ap2.add_argument("--lg-sba", metavar="TXT", type=u, default="", help="the value of the iframe 'allow' attribute for prologue/epilogue docs (volflag=lg_sba); see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy#iframes")
ap2.add_argument("--no-sb-md", action="store_true", help="don't sandbox README/PREADME.md documents (volflags: no_sb_md | sb_md)")
ap2.add_argument("--no-sb-lg", action="store_true", help="don't sandbox prologue/epilogue docs (volflags: no_sb_lg | sb_lg); enables non-js support")
ap2.add_argument("--have-unlistc", action="store_true", help=argparse.SUPPRESS)
def add_debug(ap):

View file

@ -2062,6 +2062,8 @@ class AuthSrv(object):
elif self.args.re_maxage:
vol.flags["scan"] = self.args.re_maxage
self.args.have_unlistc = False
all_mte = {}
errors = False
for vol in vfs.all_nodes.values():
@ -2123,6 +2125,9 @@ class AuthSrv(object):
if vol.flags.get("og"):
self.args.uqe = True
if "unlistcr" in vol.flags or "unlistcw" in vol.flags:
self.args.have_unlistc = True
zs = str(vol.flags.get("tcolor", "")).lstrip("#")
if len(zs) == 3: # fc5 => ffcc55
vol.flags["tcolor"] = "".join([x * 2 for x in zs])

View file

@ -280,6 +280,8 @@ flagcats = {
"nodirsz": "don't show total folder size",
"robots": "allows indexing by search engines (default)",
"norobots": "kindly asks search engines to leave",
"unlistcr": "don't list read-access in controlpanel",
"unlistcw": "don't list write-access in controlpanel",
"no_sb_md": "disable js sandbox for markdown files",
"no_sb_lg": "disable js sandbox for prologue/epilogue",
"sb_md": "enable js sandbox for markdown files (default)",

View file

@ -4949,6 +4949,11 @@ class HttpCli(object):
fn = html_escape(fn) if fn else self.conn.hsrv.iiam
dls.append((perc, hsent, spd, eta, idle, usr, erd, rds, fn))
if self.args.have_unlistc:
allvols = self.asrv.vfs.all_vols
rvol = [x for x in rvol if "unlistcr" not in allvols[x[1:-1]].flags]
wvol = [x for x in wvol if "unlistcw" not in allvols[x[1:-1]].flags]
fmt = self.uparam.get("ls", "")
if not fmt and (self.ua.startswith("curl/") or self.ua.startswith("fetch")):
fmt = "v"