mirror of
https://github.com/9001/copyparty.git
synced 2026-02-20 09:19:58 +10:00
wo_up_readme according to volflags;
now that the filenames of logues/readmes can be customized, match against the configured names rather than the defaults
This commit is contained in:
@@ -1070,6 +1070,7 @@ class AuthSrv(object):
|
||||
"tcolor": self.args.tcolor,
|
||||
"du_iwho": self.args.du_iwho,
|
||||
"shr_who": self.args.shr_who if self.args.shr else "no",
|
||||
"emb_all": FN_EMB,
|
||||
"ls_q_m": ("", ""),
|
||||
}
|
||||
self._vf0 = self._vf0b.copy()
|
||||
@@ -2573,16 +2574,22 @@ class AuthSrv(object):
|
||||
t = "WARNING: volume [/%s]: invalid value specified for ext-th: %s"
|
||||
self.log(t % (vol.vpath, etv), 3)
|
||||
|
||||
emb_all = vol.flags["emb_all"] = set()
|
||||
|
||||
zsl1 = [x for x in vol.flags["preadmes"].split(",") if x]
|
||||
zsl2 = [x for x in vol.flags["readmes"].split(",") if x]
|
||||
zsl3 = list(set([x.lower() for x in zsl1]))
|
||||
zsl4 = list(set([x.lower() for x in zsl2]))
|
||||
emb_all.update(zsl3)
|
||||
emb_all.update(zsl4)
|
||||
vol.flags["emb_mds"] = [[0, zsl1, zsl3], [1, zsl2, zsl4]]
|
||||
|
||||
zsl1 = [x for x in vol.flags["prologues"].split(",") if x]
|
||||
zsl2 = [x for x in vol.flags["epilogues"].split(",") if x]
|
||||
zsl3 = list(set([x.lower() for x in zsl1]))
|
||||
zsl4 = list(set([x.lower() for x in zsl2]))
|
||||
emb_all.update(zsl3)
|
||||
emb_all.update(zsl4)
|
||||
vol.flags["emb_lgs"] = [[0, zsl1, zsl3], [1, zsl2, zsl4]]
|
||||
|
||||
zs = str(vol.flags.get("html_head") or "")
|
||||
|
||||
@@ -19,7 +19,6 @@ from .__init__ import PY2, TYPE_CHECKING
|
||||
from .authsrv import VFS
|
||||
from .bos import bos
|
||||
from .util import (
|
||||
FN_EMB,
|
||||
VF_CAREFUL,
|
||||
Daemon,
|
||||
ODict,
|
||||
@@ -179,7 +178,7 @@ class FtpFs(AbstractedFS):
|
||||
vfs, rem = self.hub.asrv.vfs.get(vpath, self.uname, r, w, m, d)
|
||||
if (
|
||||
w
|
||||
and fn.lower() in FN_EMB
|
||||
and fn.lower() in vfs.flags["emb_all"]
|
||||
and self.h.uname not in vfs.axs.uread
|
||||
and "wo_up_readme" not in vfs.flags
|
||||
):
|
||||
|
||||
@@ -45,7 +45,6 @@ from .util import (
|
||||
BITNESS,
|
||||
DAV_ALLPROPS,
|
||||
E_SCK_WR,
|
||||
FN_EMB,
|
||||
HAVE_SQLITE3,
|
||||
HTTPCODE,
|
||||
UTC,
|
||||
@@ -2922,7 +2921,7 @@ class HttpCli(object):
|
||||
if (
|
||||
not self.can_read
|
||||
and self.can_write
|
||||
and name.lower() in FN_EMB
|
||||
and name.lower() in dbv.flags["emb_all"]
|
||||
and "wo_up_readme" not in dbv.flags
|
||||
):
|
||||
name = "_wo_" + name
|
||||
|
||||
@@ -26,7 +26,6 @@ from .__init__ import ANYWIN, TYPE_CHECKING
|
||||
from .authsrv import LEELOO_DALLAS, VFS, AuthSrv
|
||||
from .bos import bos
|
||||
from .util import (
|
||||
FN_EMB,
|
||||
VF_CAREFUL,
|
||||
Daemon,
|
||||
ODict,
|
||||
@@ -328,7 +327,7 @@ class SFTP_Srv(paramiko.SFTPServerInterface):
|
||||
vn, rem = self.hub.asrv.vfs.get(vpath, self.uname, r, w, m, d)
|
||||
if (
|
||||
w
|
||||
and fn.lower() in FN_EMB
|
||||
and fn.lower() in vn.flags["emb_all"]
|
||||
and self.uname not in vn.axs.uread
|
||||
and "wo_up_readme" not in vn.flags
|
||||
):
|
||||
|
||||
@@ -37,7 +37,6 @@ from .__init__ import EXE, PY2, TYPE_CHECKING
|
||||
from .authsrv import VFS
|
||||
from .bos import bos
|
||||
from .util import (
|
||||
FN_EMB,
|
||||
UTC,
|
||||
BytesIO,
|
||||
Daemon,
|
||||
@@ -268,7 +267,7 @@ class Tftpd(object):
|
||||
vfs, rem = self.asrv.vfs.get(vpath, "*", *perms)
|
||||
if perms[1] and "*" not in vfs.axs.uread and "wo_up_readme" not in vfs.flags:
|
||||
zs, fn = vsplit(vpath)
|
||||
if fn.lower() in FN_EMB:
|
||||
if fn.lower() in vfs.flags["emb_all"]:
|
||||
vpath = vjoin(zs, "_wo_" + fn)
|
||||
vfs, rem = self.asrv.vfs.get(vpath, "*", *perms)
|
||||
|
||||
|
||||
@@ -1152,7 +1152,7 @@ class Up2k(object):
|
||||
ft = "\033[0;32m{}{:.0}"
|
||||
ff = "\033[0;35m{}{:.0}"
|
||||
fv = "\033[0;36m{}:\033[90m{}"
|
||||
zs = "bcasechk du_iwho emb_lgs emb_mds ext_th_d html_head html_head_d html_head_s ls_q_m put_name2 mv_re_r mv_re_t rm_re_r rm_re_t srch_re_dots srch_re_nodot zipmax zipmaxn_v zipmaxs_v"
|
||||
zs = "bcasechk du_iwho emb_all emb_lgs emb_mds ext_th_d html_head html_head_d html_head_s ls_q_m put_name2 mv_re_r mv_re_t rm_re_r rm_re_t srch_re_dots srch_re_nodot zipmax zipmaxn_v zipmaxs_v"
|
||||
fx = set(zs.split())
|
||||
fd = vf_bmap()
|
||||
fd.update(vf_cmap())
|
||||
|
||||
Reference in New Issue
Block a user