Skip to content

Commit fd7c71d

Browse files
committed
add volflag to hide volume from controlpanel listing
1 parent fad2268 commit fd7c71d

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

copyparty/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,7 @@ def add_ui(ap, retry):
15351535
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")
15361536
ap2.add_argument("--no-sb-md", action="store_true", help="don't sandbox README/PREADME.md documents (volflags: no_sb_md | sb_md)")
15371537
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")
1538+
ap2.add_argument("--have-unlistc", action="store_true", help=argparse.SUPPRESS)
15381539

15391540

15401541
def add_debug(ap):

copyparty/authsrv.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,6 +2062,8 @@ def _reload(self, verbosity: int = 9) -> None:
20622062
elif self.args.re_maxage:
20632063
vol.flags["scan"] = self.args.re_maxage
20642064

2065+
self.args.have_unlistc = False
2066+
20652067
all_mte = {}
20662068
errors = False
20672069
for vol in vfs.all_nodes.values():
@@ -2123,6 +2125,9 @@ def _reload(self, verbosity: int = 9) -> None:
21232125
if vol.flags.get("og"):
21242126
self.args.uqe = True
21252127

2128+
if "unlistcr" in vol.flags or "unlistcw" in vol.flags:
2129+
self.args.have_unlistc = True
2130+
21262131
zs = str(vol.flags.get("tcolor", "")).lstrip("#")
21272132
if len(zs) == 3: # fc5 => ffcc55
21282133
vol.flags["tcolor"] = "".join([x * 2 for x in zs])

copyparty/cfg.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ def vf_cmap() -> dict[str, str]:
280280
"nodirsz": "don't show total folder size",
281281
"robots": "allows indexing by search engines (default)",
282282
"norobots": "kindly asks search engines to leave",
283+
"unlistcr": "don't list read-access in controlpanel",
284+
"unlistcw": "don't list write-access in controlpanel",
283285
"no_sb_md": "disable js sandbox for markdown files",
284286
"no_sb_lg": "disable js sandbox for prologue/epilogue",
285287
"sb_md": "enable js sandbox for markdown files (default)",

copyparty/httpcli.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4949,6 +4949,11 @@ def tx_mounts(self) -> bool:
49494949
fn = html_escape(fn) if fn else self.conn.hsrv.iiam
49504950
dls.append((perc, hsent, spd, eta, idle, usr, erd, rds, fn))
49514951

4952+
if self.args.have_unlistc:
4953+
allvols = self.asrv.vfs.all_vols
4954+
rvol = [x for x in rvol if "unlistcr" not in allvols[x[1:-1]].flags]
4955+
wvol = [x for x in wvol if "unlistcw" not in allvols[x[1:-1]].flags]
4956+
49524957
fmt = self.uparam.get("ls", "")
49534958
if not fmt and (self.ua.startswith("curl/") or self.ua.startswith("fetch")):
49544959
fmt = "v"

0 commit comments

Comments
 (0)