mirror of
https://github.com/9001/copyparty.git
synced 2026-08-13 22:03:06 -06:00
volflags: no_readme, no_logues
This commit is contained in:
parent
8c4e931300
commit
379c0aa6b4
|
|
@ -1682,8 +1682,8 @@ def add_safety(ap):
|
||||||
ap2.add_argument("--vol-or-crash", action="store_true", help="if a volume's folder does not exist on the HDD, then burst into flames (volflag=assert_root)")
|
ap2.add_argument("--vol-or-crash", action="store_true", help="if a volume's folder does not exist on the HDD, then burst into flames (volflag=assert_root)")
|
||||||
ap2.add_argument("--no-dot-mv", action="store_true", help="disallow moving dotfiles; makes it impossible to move folders containing dotfiles")
|
ap2.add_argument("--no-dot-mv", action="store_true", help="disallow moving dotfiles; makes it impossible to move folders containing dotfiles")
|
||||||
ap2.add_argument("--no-dot-ren", action="store_true", help="disallow renaming dotfiles; makes it impossible to turn something into a dotfile")
|
ap2.add_argument("--no-dot-ren", action="store_true", help="disallow renaming dotfiles; makes it impossible to turn something into a dotfile")
|
||||||
ap2.add_argument("--no-logues", action="store_true", help="disable rendering .prologue/.epilogue.html into directory listings")
|
ap2.add_argument("--no-logues", action="store_true", help="disable rendering .prologue/.epilogue.html into directory listings (volflag=no_logues)")
|
||||||
ap2.add_argument("--no-readme", action="store_true", help="disable rendering readme/preadme.md into directory listings")
|
ap2.add_argument("--no-readme", action="store_true", help="disable rendering readme/preadme.md into directory listings (volflag=no_readme)")
|
||||||
ap2.add_argument("--csp-ui", metavar="TXT", default="script-src 'unsafe-eval' 'nonce-{{ js_nonce }}'; worker-src 'self'", help="content-security-policy to apply for the web-UI; default helps prevent XSS by blocking <script> / onclick / ... (volflag=csp_ui)")
|
ap2.add_argument("--csp-ui", metavar="TXT", default="script-src 'unsafe-eval' 'nonce-{{ js_nonce }}'; worker-src 'self'", help="content-security-policy to apply for the web-UI; default helps prevent XSS by blocking <script> / onclick / ... (volflag=csp_ui)")
|
||||||
ap2.add_argument("--csp-dl", metavar="TXT", default="", help="content-security-policy to apply for static files (volflag=csp_dl)")
|
ap2.add_argument("--csp-dl", metavar="TXT", default="", help="content-security-policy to apply for static files (volflag=csp_dl)")
|
||||||
ap2.add_argument("--no-script", action="store_true", help="disables javascript in html files; helps prevent XSS but kills interactive websites; this will override \033[33m--csp-dl\033[0m with [\033[32mscript-src 'none'\033[0m] (volflag=noscript)")
|
ap2.add_argument("--no-script", action="store_true", help="disables javascript in html files; helps prevent XSS but kills interactive websites; this will override \033[33m--csp-dl\033[0m with [\033[32mscript-src 'none'\033[0m] (volflag=noscript)")
|
||||||
|
|
|
||||||
|
|
@ -2617,6 +2617,8 @@ class AuthSrv(object):
|
||||||
zsl4 = list(set([x.lower() for x in zsl2]))
|
zsl4 = list(set([x.lower() for x in zsl2]))
|
||||||
emb_all.update(zsl3)
|
emb_all.update(zsl3)
|
||||||
emb_all.update(zsl4)
|
emb_all.update(zsl4)
|
||||||
|
if "no_readme" in vol.flags:
|
||||||
|
zsl1 = zsl2 = zsl3 = zsl4 = []
|
||||||
vol.flags["emb_mds"] = [[0, zsl1, zsl3], [1, zsl2, zsl4]]
|
vol.flags["emb_mds"] = [[0, zsl1, zsl3], [1, zsl2, zsl4]]
|
||||||
|
|
||||||
zsl1 = [x for x in vol.flags["prologues"].split(",") if x]
|
zsl1 = [x for x in vol.flags["prologues"].split(",") if x]
|
||||||
|
|
@ -2625,6 +2627,8 @@ class AuthSrv(object):
|
||||||
zsl4 = list(set([x.lower() for x in zsl2]))
|
zsl4 = list(set([x.lower() for x in zsl2]))
|
||||||
emb_all.update(zsl3)
|
emb_all.update(zsl3)
|
||||||
emb_all.update(zsl4)
|
emb_all.update(zsl4)
|
||||||
|
if "no_logues" in vol.flags:
|
||||||
|
zsl1 = zsl2 = zsl3 = zsl4 = []
|
||||||
vol.flags["emb_lgs"] = [[0, zsl1, zsl3], [1, zsl2, zsl4]]
|
vol.flags["emb_lgs"] = [[0, zsl1, zsl3], [1, zsl2, zsl4]]
|
||||||
|
|
||||||
zs = str(vol.flags.get("html_head") or "")
|
zs = str(vol.flags.get("html_head") or "")
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ def vf_bmap() -> dict[str, str]:
|
||||||
"magic",
|
"magic",
|
||||||
"md_no_br",
|
"md_no_br",
|
||||||
"no_db_ip",
|
"no_db_ip",
|
||||||
|
"no_logues",
|
||||||
|
"no_readme",
|
||||||
"no_sb_md",
|
"no_sb_md",
|
||||||
"no_sb_lg",
|
"no_sb_lg",
|
||||||
"nsort",
|
"nsort",
|
||||||
|
|
@ -365,6 +367,8 @@ flagcats = {
|
||||||
"epilogues=.epilogue.html": "files to embed below/after files",
|
"epilogues=.epilogue.html": "files to embed below/after files",
|
||||||
"readmes=readme.md,README.md": "files to embed as readmes",
|
"readmes=readme.md,README.md": "files to embed as readmes",
|
||||||
"preadmes=preadme.md,PREADME.md": "files to embed as preadmes",
|
"preadmes=preadme.md,PREADME.md": "files to embed as preadmes",
|
||||||
|
"no_readme": "disable embedding readme/preadme",
|
||||||
|
"no_logues": "disable embedding prologue/epilogue",
|
||||||
"no_sb_md": "disable js sandbox for markdown files",
|
"no_sb_md": "disable js sandbox for markdown files",
|
||||||
"no_sb_lg": "disable js sandbox for prologue/epilogue",
|
"no_sb_lg": "disable js sandbox for prologue/epilogue",
|
||||||
"sb_md": "enable js sandbox for markdown files (default)",
|
"sb_md": "enable js sandbox for markdown files (default)",
|
||||||
|
|
|
||||||
|
|
@ -436,6 +436,14 @@ IMPLICATIONS = [
|
||||||
["no_dupe_m", "no_dupe"],
|
["no_dupe_m", "no_dupe"],
|
||||||
["no_html", "no_script"],
|
["no_html", "no_script"],
|
||||||
["nohtml", "noscript"],
|
["nohtml", "noscript"],
|
||||||
|
["no_html", "nohtml"], # user-typo
|
||||||
|
["no_script", "noscript"], # user-typo
|
||||||
|
["no_readmes", "no_readme"], # user-typo
|
||||||
|
["noreadmes", "no_readme"], # user-typo
|
||||||
|
["noreadme", "no_readme"], # user-typo
|
||||||
|
["no_logue", "no_logues"], # user-typo
|
||||||
|
["nologues", "no_logues"], # user-typo
|
||||||
|
["nologue", "no_logues"], # user-typo
|
||||||
["sftpvv", "sftpv"],
|
["sftpvv", "sftpv"],
|
||||||
["smbw", "smb"],
|
["smbw", "smb"],
|
||||||
["smb1", "smb"],
|
["smb1", "smb"],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue