Skip to content

Commit c599e2a

Browse files
committed
add opt for dotfile visibility default
1 parent 2e53f79 commit c599e2a

File tree

5 files changed

+6
-2
lines changed

5 files changed

+6
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,8 @@ a client can request to see dotfiles in directory listings if global option `-ed
561561
562562
dotfiles do not appear in search results unless one of the above is true, **and** the global option / volflag `dotsrch` is set
563563
564+
> even if user has permission to see dotfiles, they are default-hidden unless `--see-dots` is set, and/or user has enabled the `dotfiles` option in the settings tab
565+
564566
config file example, where the same permission to see dotfiles is given in two different ways just for reference:
565567
566568
```yaml

copyparty/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,7 @@ def add_ui(ap, retry):
14941494
ap2.add_argument("--sort", metavar="C,C,C", type=u, default="href", help="default sort order, comma-separated column IDs (see header tooltips), prefix with '-' for descending. Examples: \033[32mhref -href ext sz ts tags/Album tags/.tn\033[0m (volflag=sort)")
14951495
ap2.add_argument("--nsort", action="store_true", help="default-enable natural sort of filenames with leading numbers (volflag=nsort)")
14961496
ap2.add_argument("--hsortn", metavar="N", type=int, default=2, help="number of sorting rules to include in media URLs by default (volflag=hsortn)")
1497+
ap2.add_argument("--see-dots", action="store_true", help="default-enable seeing dotfiles; only takes effect if user has the necessary permissions")
14971498
ap2.add_argument("--unlist", metavar="REGEX", type=u, default="", help="don't show files matching \033[33mREGEX\033[0m in file list. Purely cosmetic! Does not affect API calls, just the browser. Example: [\033[32m\\.(js|css)$\033[0m] (volflag=unlist)")
14981499
ap2.add_argument("--favico", metavar="TXT", type=u, default="c 000 none" if retry else "🎉 000 none", help="\033[33mfavicon-text\033[0m [ \033[33mforeground\033[0m [ \033[33mbackground\033[0m ] ], set blank to disable")
14991500
ap2.add_argument("--ext-th", metavar="E=VP", type=u, action="append", help="use thumbnail-image \033[33mVP\033[0m for file-extension \033[33mE\033[0m, example: [\033[32mexe=/.res/exe.png\033[0m] (volflag=ext_th)")

copyparty/authsrv.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2579,6 +2579,7 @@ def _reload(self, verbosity: int = 9) -> None:
25792579
"txt_ext": self.args.textfiles.replace(",", " "),
25802580
"def_hcols": list(vf.get("mth") or []),
25812581
"unlist0": vf.get("unlist") or "",
2582+
"see_dots": self.args.see_dots,
25822583
"dgrid": "grid" in vf,
25832584
"dgsel": "gsel" in vf,
25842585
"dnsort": "nsort" in vf,

copyparty/web/browser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7504,7 +7504,7 @@ var treectl = (function () {
75047504
bcfg_bind(r, 'idxh', 'idxh', idxh, setidxh);
75057505
bcfg_bind(r, 'dyn', 'dyntree', true, onresize);
75067506
bcfg_bind(r, 'csel', 'csel', dgsel);
7507-
bcfg_bind(r, 'dots', 'dotfiles', false, function (v) {
7507+
bcfg_bind(r, 'dots', 'dotfiles', see_dots, function (v) {
75087508
r.goto();
75097509
var xhr = new XHR();
75107510
xhr.open('GET', SR + '/?setck=dots=' + (v ? 'y' : ''), true);

tests/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def __init__(self, a=None, v=None, c=None, **ka0):
146146
ex = "chpw daw dav_auth dav_mac dav_rt e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp early_ban ed emp exp force_js getmod grid gsel hardlink ih ihead magic hardlink_only nid nih no_acode no_athumb no_bauth no_clone no_cp no_dav no_db_ip no_del no_dirsz no_dupe no_lifetime no_logues no_mv no_pipe no_poll no_readme no_robots no_sb_md no_sb_lg no_scandir no_tarcmp no_thumb no_vthumb no_zip nrand nsort nw og og_no_head og_s_title ohead q rand re_dirsz rss smb srch_dbg srch_excl stats uqe vague_403 vc ver wo_up_readme write_uplog xdev xlink xvol zipmaxu zs"
147147
ka.update(**{k: False for k in ex.split()})
148148

149-
ex = "dav_inf dedup dotpart dotsrch hook_v no_dhash no_fastboot no_fpool no_htp no_rescan no_sendfile no_ses no_snap no_up_list no_voldump re_dhash plain_ip"
149+
ex = "dav_inf dedup dotpart dotsrch hook_v no_dhash no_fastboot no_fpool no_htp no_rescan no_sendfile no_ses no_snap no_up_list no_voldump re_dhash see_dots plain_ip"
150150
ka.update(**{k: True for k in ex.split()})
151151

152152
ex = "ah_cli ah_gen css_browser dbpath hist ipu js_browser js_other mime mimes no_forget no_hash no_idx nonsus_urls og_tpl og_ua ua_nodoc ua_nozip"

0 commit comments

Comments
 (0)