Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a90dde94e1 | ||
|
|
7dfbfc7227 | ||
|
|
b10843d051 | ||
|
|
520ac8f4dc | ||
|
|
537a6e50e9 | ||
|
|
2d0cbdf1a8 | ||
|
|
5afb562aa3 | ||
|
|
db069c3d4a | ||
|
|
fae40c7e2f | ||
|
|
0c43b592dc | ||
|
|
2ab8924e2d | ||
|
|
0e31cfa784 | ||
|
|
8f7ffcf350 | ||
|
|
9c8507a0fd | ||
|
|
e9b2cab088 |
@@ -1090,6 +1090,8 @@ class Ctl(object):
|
||||
|
||||
spd = humansize(spd)
|
||||
self.eta = str(datetime.timedelta(seconds=int(eta)))
|
||||
if eta > 2591999:
|
||||
self.eta = self.eta.split(",")[0] # truncate HH:MM:SS
|
||||
sleft = humansize(self.nbytes - self.up_b)
|
||||
nleft = self.nfiles - self.up_f
|
||||
tail = "\033[K\033[u" if VT100 and not self.ar.ns else "\r"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Maintainer: icxes <dev.null@need.moe>
|
||||
pkgname=copyparty
|
||||
pkgver="1.16.0"
|
||||
pkgver="1.16.1"
|
||||
pkgrel=1
|
||||
pkgdesc="File server with accelerated resumable uploads, dedup, WebDAV, FTP, TFTP, zeroconf, media indexer, thumbnails++"
|
||||
arch=("any")
|
||||
@@ -21,7 +21,7 @@ optdepends=("ffmpeg: thumbnails for videos, images (slower) and audio, music tag
|
||||
)
|
||||
source=("https://github.com/9001/${pkgname}/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
|
||||
backup=("etc/${pkgname}.d/init" )
|
||||
sha256sums=("8a802bbb4392ead6bc92bcb1c71ecd1855a05a5b4d0312499c33f65424c12a00")
|
||||
sha256sums=("48506881f7920ad9d528763833a8cc3d1b6df39402bbe1cb90c3ff58c865dfc6")
|
||||
|
||||
build() {
|
||||
cd "${srcdir}/${pkgname}-${pkgver}"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"url": "https://github.com/9001/copyparty/releases/download/v1.16.0/copyparty-sfx.py",
|
||||
"version": "1.16.0",
|
||||
"hash": "sha256-H9imF66HcE6I/gGPZdJ5zkzATC3Vkc4luTAbRy8GRh4="
|
||||
"url": "https://github.com/9001/copyparty/releases/download/v1.16.1/copyparty-sfx.py",
|
||||
"version": "1.16.1",
|
||||
"hash": "sha256-vlxAuVtd/o11CIC6E6K6UDUdtYDzQ6u7kG3Qc3eqJ+U="
|
||||
}
|
||||
@@ -1457,6 +1457,7 @@ def add_ui(ap, retry):
|
||||
ap2.add_argument("--themes", metavar="NUM", type=int, default=8, help="number of themes installed")
|
||||
ap2.add_argument("--au-vol", metavar="0-100", type=int, default=50, choices=range(0, 101), help="default audio/video volume percent")
|
||||
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)")
|
||||
ap2.add_argument("--nsort", action="store_true", help="default-enable natural sort of filenames with leading numbers (volflag=nsort)")
|
||||
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)")
|
||||
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")
|
||||
ap2.add_argument("--mpmc", metavar="URL", type=u, default="", help="change the mediaplayer-toggle mouse cursor; URL to a folder with {2..5}.png inside (or disable with [\033[32m.\033[0m])")
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# coding: utf-8
|
||||
|
||||
VERSION = (1, 16, 1)
|
||||
VERSION = (1, 16, 2)
|
||||
CODENAME = "COPYparty"
|
||||
BUILD_DT = (2024, 11, 15)
|
||||
BUILD_DT = (2024, 11, 23)
|
||||
|
||||
S_VERSION = ".".join(map(str, VERSION))
|
||||
S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)
|
||||
|
||||
@@ -367,6 +367,8 @@ class VFS(object):
|
||||
self.ahtml: dict[str, list[str]] = {}
|
||||
self.aadmin: dict[str, list[str]] = {}
|
||||
self.adot: dict[str, list[str]] = {}
|
||||
self.js_ls = {}
|
||||
self.js_htm = ""
|
||||
|
||||
if realpath:
|
||||
rp = realpath + ("" if realpath.endswith(os.sep) else os.sep)
|
||||
@@ -2304,6 +2306,69 @@ class AuthSrv(object):
|
||||
cur.close()
|
||||
db.close()
|
||||
|
||||
self.js_ls = {}
|
||||
self.js_htm = {}
|
||||
for vn in self.vfs.all_nodes.values():
|
||||
vf = vn.flags
|
||||
vn.js_ls = {
|
||||
"idx": "e2d" in vf,
|
||||
"itag": "e2t" in vf,
|
||||
"dnsort": "nsort" in vf,
|
||||
"dsort": vf["sort"],
|
||||
"dcrop": vf["crop"],
|
||||
"dth3x": vf["th3x"],
|
||||
"u2ts": vf["u2ts"],
|
||||
"frand": bool(vf.get("rand")),
|
||||
"lifetime": vf.get("lifetime") or 0,
|
||||
"unlist": vf.get("unlist") or "",
|
||||
}
|
||||
js_htm = {
|
||||
"s_name": self.args.bname,
|
||||
"have_up2k_idx": "e2d" in vf,
|
||||
"have_acode": not self.args.no_acode,
|
||||
"have_shr": self.args.shr,
|
||||
"have_zip": not self.args.no_zip,
|
||||
"have_mv": not self.args.no_mv,
|
||||
"have_del": not self.args.no_del,
|
||||
"have_unpost": int(self.args.unpost),
|
||||
"have_emp": self.args.emp,
|
||||
"sb_md": "" if "no_sb_md" in vf else (vf.get("md_sbf") or "y"),
|
||||
"txt_ext": self.args.textfiles.replace(",", " "),
|
||||
"def_hcols": list(vf.get("mth") or []),
|
||||
"unlist0": vf.get("unlist") or "",
|
||||
"dgrid": "grid" in vf,
|
||||
"dgsel": "gsel" in vf,
|
||||
"dnsort": "nsort" in vf,
|
||||
"dsort": vf["sort"],
|
||||
"dcrop": vf["crop"],
|
||||
"dth3x": vf["th3x"],
|
||||
"dvol": self.args.au_vol,
|
||||
"idxh": int(self.args.ih),
|
||||
"themes": self.args.themes,
|
||||
"turbolvl": self.args.turbo,
|
||||
"u2j": self.args.u2j,
|
||||
"u2sz": self.args.u2sz,
|
||||
"u2ts": vf["u2ts"],
|
||||
"frand": bool(vf.get("rand")),
|
||||
"lifetime": vn.js_ls["lifetime"],
|
||||
"u2sort": self.args.u2sort,
|
||||
}
|
||||
vn.js_htm = json.dumps(js_htm)
|
||||
|
||||
vols = list(vfs.all_nodes.values())
|
||||
if enshare:
|
||||
assert shv # type: ignore # !rm
|
||||
vols.append(shv)
|
||||
vols.extend(list(shv.nodes.values()))
|
||||
|
||||
for vol in vols:
|
||||
dbv = vol.get_dbv("")[0]
|
||||
vol.js_ls = vol.js_ls or dbv.js_ls or {}
|
||||
vol.js_htm = vol.js_htm or dbv.js_htm or "{}"
|
||||
|
||||
zs = str(vol.flags.get("tcolor") or self.args.tcolor)
|
||||
vol.flags["tcolor"] = zs.lstrip("#")
|
||||
|
||||
def load_sessions(self, quiet=False) -> None:
|
||||
# mutex me
|
||||
if self.args.no_ses:
|
||||
|
||||
@@ -42,6 +42,7 @@ def vf_bmap() -> dict[str, str]:
|
||||
"magic",
|
||||
"no_sb_md",
|
||||
"no_sb_lg",
|
||||
"nsort",
|
||||
"og",
|
||||
"og_no_head",
|
||||
"og_s_title",
|
||||
|
||||
@@ -248,7 +248,6 @@ class HttpCli(object):
|
||||
ka["ts"] = self.conn.hsrv.cachebuster()
|
||||
ka["lang"] = self.args.lang
|
||||
ka["favico"] = self.args.favico
|
||||
ka["s_name"] = self.args.bname
|
||||
ka["s_doctitle"] = self.args.doctitle
|
||||
ka["tcolor"] = self.vn.flags["tcolor"]
|
||||
|
||||
@@ -705,7 +704,7 @@ class HttpCli(object):
|
||||
|
||||
if pex.code != 404 or self.do_log:
|
||||
self.log(
|
||||
"%s\033[0m, %s" % (msg, self.vpath),
|
||||
"http%d: %s\033[0m, %s" % (pex.code, msg, self.vpath),
|
||||
6 if em.startswith("client d/c ") else 3,
|
||||
)
|
||||
|
||||
@@ -1414,12 +1413,13 @@ class HttpCli(object):
|
||||
vst = os.stat_result((16877, -1, -1, 1, 1000, 1000, 8, zi, zi, zi))
|
||||
|
||||
try:
|
||||
topdir = {"vp": "", "st": bos.stat(tap)}
|
||||
st = bos.stat(tap)
|
||||
except OSError as ex:
|
||||
if ex.errno not in (errno.ENOENT, errno.ENOTDIR):
|
||||
raise
|
||||
raise Pebkac(404)
|
||||
|
||||
topdir = {"vp": "", "st": st}
|
||||
fgen: Iterable[dict[str, Any]] = []
|
||||
|
||||
depth = self.headers.get("depth", "infinity").lower()
|
||||
@@ -1455,6 +1455,12 @@ class HttpCli(object):
|
||||
wrap=False,
|
||||
)
|
||||
|
||||
elif depth == "0" or not stat.S_ISDIR(st.st_mode):
|
||||
# propfind on a file; return as topdir
|
||||
if not self.can_read and not self.can_get:
|
||||
self.log("inaccessible: [%s]" % (self.vpath,))
|
||||
raise Pebkac(401, "authenticate")
|
||||
|
||||
elif depth == "1":
|
||||
_, vfs_ls, vfs_virt = vn.ls(
|
||||
rem,
|
||||
@@ -1473,9 +1479,6 @@ class HttpCli(object):
|
||||
fgen = [{"vp": vp, "st": st} for vp, st in vfs_ls]
|
||||
fgen += [{"vp": v, "st": vst} for v in vfs_virt]
|
||||
|
||||
elif depth == "0":
|
||||
pass
|
||||
|
||||
else:
|
||||
t = "invalid depth value '{}' (must be either '0' or '1'{})"
|
||||
t2 = " or 'infinity'" if self.args.dav_inf else ""
|
||||
@@ -5496,61 +5499,28 @@ class HttpCli(object):
|
||||
is_js = False
|
||||
|
||||
vf = vn.flags
|
||||
unlist = vf.get("unlist", "")
|
||||
ls_ret = {
|
||||
"dirs": [],
|
||||
"files": [],
|
||||
"taglist": [],
|
||||
"srvinf": srv_infot,
|
||||
"acct": self.uname,
|
||||
"idx": e2d,
|
||||
"itag": e2t,
|
||||
"dsort": vf["sort"],
|
||||
"dcrop": vf["crop"],
|
||||
"dth3x": vf["th3x"],
|
||||
"u2ts": vf["u2ts"],
|
||||
"lifetime": vn.flags.get("lifetime") or 0,
|
||||
"frand": bool(vn.flags.get("rand")),
|
||||
"unlist": unlist,
|
||||
"perms": perms,
|
||||
"cfg": vn.js_ls,
|
||||
}
|
||||
cgv = {
|
||||
"ls0": None,
|
||||
"acct": self.uname,
|
||||
"perms": perms,
|
||||
"u2ts": vf["u2ts"],
|
||||
"lifetime": ls_ret["lifetime"],
|
||||
"frand": bool(vn.flags.get("rand")),
|
||||
"def_hcols": [],
|
||||
"have_emp": self.args.emp,
|
||||
"have_up2k_idx": e2d,
|
||||
"have_acode": (not self.args.no_acode),
|
||||
"have_mv": (not self.args.no_mv),
|
||||
"have_del": (not self.args.no_del),
|
||||
"have_zip": (not self.args.no_zip),
|
||||
"have_shr": self.args.shr,
|
||||
"have_unpost": int(self.args.unpost),
|
||||
"sb_md": "" if "no_sb_md" in vf else (vf.get("md_sbf") or "y"),
|
||||
"dgrid": "grid" in vf,
|
||||
"dgsel": "gsel" in vf,
|
||||
"dsort": vf["sort"],
|
||||
"dcrop": vf["crop"],
|
||||
"dth3x": vf["th3x"],
|
||||
"dvol": self.args.au_vol,
|
||||
"themes": self.args.themes,
|
||||
"turbolvl": self.args.turbo,
|
||||
"u2j": self.args.u2j,
|
||||
"u2sz": self.args.u2sz,
|
||||
"idxh": int(self.args.ih),
|
||||
"u2sort": self.args.u2sort,
|
||||
}
|
||||
j2a = {
|
||||
"cgv1": vn.js_htm,
|
||||
"cgv": cgv,
|
||||
"vpnodes": vpnodes,
|
||||
"files": [],
|
||||
"ls0": None,
|
||||
"taglist": [],
|
||||
"have_tags_idx": e2t,
|
||||
"have_tags_idx": int(e2t),
|
||||
"have_b_u": (self.can_write and self.uparam.get("b") == "u"),
|
||||
"sb_lg": "" if "no_sb_lg" in vf else (vf.get("lg_sbf") or "y"),
|
||||
"url_suf": url_suf,
|
||||
@@ -5922,17 +5892,12 @@ class HttpCli(object):
|
||||
"dirs": dirs,
|
||||
"files": files,
|
||||
"taglist": taglist,
|
||||
"unlist": unlist,
|
||||
}
|
||||
j2a["files"] = []
|
||||
else:
|
||||
j2a["files"] = dirs + files
|
||||
|
||||
j2a["taglist"] = taglist
|
||||
j2a["txt_ext"] = self.args.textfiles.replace(",", " ")
|
||||
|
||||
if "mth" in vn.flags:
|
||||
j2a["def_hcols"] = list(vn.flags["mth"])
|
||||
|
||||
if add_og and "raw" not in self.uparam:
|
||||
j2a["this"] = self
|
||||
|
||||
@@ -135,7 +135,7 @@ class HttpSrv(object):
|
||||
dls: dict[str, tuple[float, int]] = {} # state
|
||||
self.dli = self.tdli = dli
|
||||
self.dls = self.tdls = dls
|
||||
self.iiam = '<img src="%s.cpr/iiam.gif" />' % (self.args.SRS,)
|
||||
self.iiam = '<img src="%s.cpr/iiam.gif?cache=i" />' % (self.args.SRS,)
|
||||
|
||||
self.bound: set[tuple[str, int]] = set()
|
||||
self.name = "hsrv" + nsuf
|
||||
|
||||
@@ -70,6 +70,9 @@ class U2idx(object):
|
||||
self.log_func("u2idx", msg, c)
|
||||
|
||||
def shutdown(self) -> None:
|
||||
if not HAVE_SQLITE3:
|
||||
return
|
||||
|
||||
for cur in self.cur.values():
|
||||
db = cur.connection
|
||||
try:
|
||||
@@ -80,6 +83,12 @@ class U2idx(object):
|
||||
cur.close()
|
||||
db.close()
|
||||
|
||||
for cur in (self.mem_cur, self.sh_cur):
|
||||
if cur:
|
||||
db = cur.connection
|
||||
cur.close()
|
||||
db.close()
|
||||
|
||||
def fsearch(
|
||||
self, uname: str, vols: list[VFS], body: dict[str, Any]
|
||||
) -> list[dict[str, Any]]:
|
||||
|
||||
@@ -5297,6 +5297,11 @@ class Up2k(object):
|
||||
cur.close()
|
||||
db.close()
|
||||
|
||||
if self.mem_cur:
|
||||
db = self.mem_cur.connection
|
||||
self.mem_cur.close()
|
||||
db.close()
|
||||
|
||||
self.registry = {}
|
||||
|
||||
|
||||
|
||||
@@ -2709,12 +2709,29 @@ def build_netmap(csv: str, defer_mutex: bool = False):
|
||||
if csv in ("any", "all", "no", ",", ""):
|
||||
return None
|
||||
|
||||
if csv in ("lan", "local", "private", "prvt"):
|
||||
csv = "10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, fd00::/8" # lan
|
||||
csv += ", 169.254.0.0/16, fe80::/10" # link-local
|
||||
csv += ", 127.0.0.0/8, ::1/128" # loopback
|
||||
|
||||
srcs = [x.strip() for x in csv.split(",") if x.strip()]
|
||||
|
||||
expanded_shorthands = False
|
||||
for shorthand in ("lan", "local", "private", "prvt"):
|
||||
if shorthand in srcs:
|
||||
if not expanded_shorthands:
|
||||
srcs += [
|
||||
# lan:
|
||||
"10.0.0.0/8",
|
||||
"172.16.0.0/12",
|
||||
"192.168.0.0/16",
|
||||
"fd00::/8",
|
||||
# link-local:
|
||||
"169.254.0.0/16",
|
||||
"fe80::/10",
|
||||
# loopback:
|
||||
"127.0.0.0/8",
|
||||
"::1/128",
|
||||
]
|
||||
expanded_shorthands = True
|
||||
|
||||
srcs.remove(shorthand)
|
||||
|
||||
if not HAVE_IPV6:
|
||||
srcs = [x for x in srcs if ":" not in x]
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ window.baguetteBox = (function () {
|
||||
scrollCSS = ['', ''],
|
||||
scrollTimer = 0,
|
||||
re_i = /^[^?]+\.(a?png|avif|bmp|gif|heif|jpe?g|jfif|svg|webp)(\?|$)/i,
|
||||
re_v = /^[^?]+\.(webm|mkv|mp4|m4v)(\?|$)/i,
|
||||
re_v = /^[^?]+\.(webm|mkv|mp4|m4v|mov)(\?|$)/i,
|
||||
anims = ['slideIn', 'fadeIn', 'none'],
|
||||
data = {}, // all galleries
|
||||
imagesElements = [],
|
||||
|
||||
@@ -442,7 +442,7 @@ html.dz {
|
||||
--g-sel-b1: #c37;
|
||||
--g-sel-sh: #b36;
|
||||
--g-fsel-b1: #d48;
|
||||
|
||||
|
||||
--f-h-b1: #3b3;
|
||||
|
||||
text-shadow: none;
|
||||
|
||||
@@ -132,16 +132,15 @@
|
||||
|
||||
<script>
|
||||
var SR = {{ r|tojson }},
|
||||
CGV1 = {{ cgv1 }},
|
||||
CGV = {{ cgv|tojson }},
|
||||
TS = "{{ ts }}",
|
||||
dtheme = "{{ dtheme }}",
|
||||
srvinf = "{{ srv_info }}",
|
||||
s_name = "{{ s_name }}",
|
||||
lang = "{{ lang }}",
|
||||
dfavico = "{{ favico }}",
|
||||
have_tags_idx = {{ have_tags_idx|tojson }},
|
||||
have_tags_idx = {{ have_tags_idx }},
|
||||
sb_lg = "{{ sb_lg }}",
|
||||
txt_ext = "{{ txt_ext }}",
|
||||
logues = {{ logues|tojson if sb_lg else "[]" }},
|
||||
ls0 = {{ ls0|tojson }};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var XHR = XMLHttpRequest,
|
||||
img_re = /\.(a?png|avif|bmp|gif|heif|jpe?g|jfif|svg|webp|webm|mkv|mp4|m4v)(\?|$)/i;
|
||||
img_re = /\.(a?png|avif|bmp|gif|heif|jpe?g|jfif|svg|webp|webm|mkv|mp4|m4v|mov)(\?|$)/i;
|
||||
|
||||
var Ls = {
|
||||
"eng": {
|
||||
@@ -4214,6 +4214,8 @@ function eval_hash() {
|
||||
|
||||
|
||||
function read_dsort(txt) {
|
||||
dnsort = dnsort ? 1 : 0;
|
||||
clmod(ebi('nsort'), 'on', (sread('nsort') || dnsort) == 1);
|
||||
try {
|
||||
var zt = (('' + txt).trim() || 'href').split(/,+/g);
|
||||
dsort = [];
|
||||
@@ -4244,7 +4246,7 @@ function sortfiles(nodes) {
|
||||
var sopts = jread('fsort', jcp(dsort)),
|
||||
dir1st = sread('dir1st') !== '0';
|
||||
|
||||
var collator = sread('nsort') != 1 ? null :
|
||||
var collator = !clgot(ebi('nsort'), 'on') ? null :
|
||||
new Intl.Collator([], {numeric: true});
|
||||
|
||||
try {
|
||||
@@ -4670,8 +4672,8 @@ var fileman = (function () {
|
||||
toast.err(9, msg);
|
||||
return;
|
||||
}
|
||||
surl = surl.slice(15);
|
||||
var txt = esc(surl) + '<img class="b64" src="' + surl + '?qr" />';
|
||||
surl = surl.slice(15).trim();
|
||||
var txt = esc(surl) + '<img class="b64" width="100" height="100" src="' + surl + '?qr" />';
|
||||
modal.confirm(txt + L.fs_ok, function() {
|
||||
cliptxt(surl, function () {
|
||||
toast.ok(2, L.clipped);
|
||||
@@ -5943,7 +5945,7 @@ var thegrid = (function () {
|
||||
fid = oth.getAttribute('id'),
|
||||
aplay = ebi('a' + fid),
|
||||
atext = ebi('t' + fid),
|
||||
is_txt = atext && showfile.getlang(href) && !/\.ts$/.test(href),
|
||||
is_txt = atext && !/\.ts$/.test(href) && showfile.getlang(href),
|
||||
is_img = img_re.test(href),
|
||||
is_dir = href.endsWith('/'),
|
||||
is_srch = !!ebi('unsearch'),
|
||||
@@ -7032,7 +7034,7 @@ var treectl = (function () {
|
||||
xhr.open('GET', SR + '/?setck=dots=' + (v ? 'y' : ''), true);
|
||||
xhr.send();
|
||||
});
|
||||
bcfg_bind(r, 'nsort', 'nsort', false, resort);
|
||||
bcfg_bind(r, 'nsort', 'nsort', dnsort, resort);
|
||||
bcfg_bind(r, 'dir1st', 'dir1st', true, resort);
|
||||
setwrap(bcfg_bind(r, 'wtree', 'wraptree', true, setwrap));
|
||||
setwrap(bcfg_bind(r, 'parpane', 'parpane', true, onscroll));
|
||||
@@ -7516,6 +7518,7 @@ var treectl = (function () {
|
||||
|
||||
try {
|
||||
var res = JSON.parse(this.responseText);
|
||||
Object.assign(res, res.cfg);
|
||||
}
|
||||
catch (ex) {
|
||||
if (r.ls_cb) {
|
||||
@@ -7538,6 +7541,7 @@ var treectl = (function () {
|
||||
if (res.files[a].tags === undefined)
|
||||
res.files[a].tags = {};
|
||||
|
||||
dnsort = res.dnsort;
|
||||
read_dsort(res.dsort);
|
||||
dcrop = res.dcrop;
|
||||
dth3x = res.dth3x;
|
||||
@@ -7781,6 +7785,7 @@ var treectl = (function () {
|
||||
r.ls_cb = showfile.addlinks;
|
||||
return r.reqls(get_evpath(), false, undefined, true);
|
||||
}
|
||||
ls0.unlist = unlist0;
|
||||
|
||||
var top = get_evpath();
|
||||
if (r.chk_index_html(top, ls0))
|
||||
|
||||
@@ -45,7 +45,7 @@ function qr(e) {
|
||||
|
||||
function showqr(href) {
|
||||
var vhref = href.replace('?qr&', '?').replace('?qr', '');
|
||||
modal.alert(esc(vhref) + '<img class="b64" src="' + href + '" />');
|
||||
modal.alert(esc(vhref) + '<img class="b64" width="100" height="100" src="' + href + '" />');
|
||||
}
|
||||
|
||||
(function() {
|
||||
|
||||
@@ -94,6 +94,9 @@ table {
|
||||
.vols th:empty {
|
||||
padding: 0;
|
||||
}
|
||||
.vols img {
|
||||
margin: -4px 0;
|
||||
}
|
||||
.num {
|
||||
border-right: 1px solid #bbb;
|
||||
}
|
||||
|
||||
@@ -322,6 +322,8 @@ html.y #tth {
|
||||
margin: .1em auto;
|
||||
width: 60%;
|
||||
height: 60%;
|
||||
background: #999;
|
||||
background: rgba(128,128,128,0.2);
|
||||
}
|
||||
#modalb {
|
||||
position: sticky;
|
||||
|
||||
@@ -5,10 +5,17 @@ if (!window.console || !console.log)
|
||||
"log": function (msg) { }
|
||||
};
|
||||
|
||||
if (!Object.assign)
|
||||
Object.assign = function (a, b) {
|
||||
for (var k in b)
|
||||
a[k] = b[k];
|
||||
};
|
||||
|
||||
if (window.CGV1)
|
||||
Object.assign(window, window.CGV1);
|
||||
|
||||
if (window.CGV)
|
||||
for (var k in CGV)
|
||||
window[k] = CGV[k];
|
||||
Object.assign(window, window.CGV);
|
||||
|
||||
|
||||
var wah = '',
|
||||
@@ -874,6 +881,8 @@ if (window.Number && Number.isFinite)
|
||||
|
||||
function f2f(val, nd) {
|
||||
// 10.toFixed(1) returns 10.00 for certain values of 10
|
||||
if (!isNum(val))
|
||||
val = 999;
|
||||
val = (val * Math.pow(10, nd)).toFixed(0).split('.')[0];
|
||||
return nd ? (val.slice(0, -nd) || '0') + '.' + val.slice(-nd) : val;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||
# 2024-1115-2218 `v1.16.1` cbz thumbnails
|
||||
|
||||
## 🧪 new features
|
||||
|
||||
* thumbnails of .cbz manga archives 4d15dd6e
|
||||
|
||||
## 🩹 bugfixes
|
||||
|
||||
* when running with `-j0`, download-ETA could break in complex volume layouts 10fc4768
|
||||
* linking to the image gallery didn't quite work if multiselect was enabled 56a04996
|
||||
* password-hashing parameters (cpu/ram cost) could not be customized 1f177528
|
||||
* the defaults must be perfect considering nobody ever tried changing them ¯\\_(ツ)_/¯
|
||||
|
||||
## 🔧 other changes
|
||||
|
||||
* add intentional crash on startup if two volumes are configured to use the same histpath 2b63d7d1
|
||||
* prevents funky deadlocks and an eventual database loss in case of a no-thoughts-head-empty moment, purely hypothetical of course 🗿
|
||||
|
||||
|
||||
|
||||
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||
# 2024-1110-1932 `v1.16.0` COPYparty
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ class TestDedup(unittest.TestCase):
|
||||
self.td = tu.get_ramdisk()
|
||||
|
||||
def tearDown(self):
|
||||
if self.conn:
|
||||
self.conn.shutdown()
|
||||
os.chdir(tempfile.gettempdir())
|
||||
shutil.rmtree(self.td)
|
||||
|
||||
@@ -62,7 +64,6 @@ class TestDedup(unittest.TestCase):
|
||||
|
||||
self.conn = None
|
||||
self.fstab = None
|
||||
self.ctr = 0 # 2304
|
||||
for dedup, act_exp in product(tc_dedup, tcs):
|
||||
action, expect = act_exp.split(" ", 1)
|
||||
t = "dedup:%s action:%s" % (dedup, action)
|
||||
|
||||
@@ -34,6 +34,8 @@ class TestDedup(unittest.TestCase):
|
||||
]
|
||||
|
||||
def tearDown(self):
|
||||
if self.conn:
|
||||
self.conn.shutdown()
|
||||
os.chdir(tempfile.gettempdir())
|
||||
shutil.rmtree(self.td)
|
||||
|
||||
|
||||
@@ -17,6 +17,11 @@ from copyparty.up2k import Up2k
|
||||
from tests import util as tu
|
||||
from tests.util import Cfg
|
||||
|
||||
try:
|
||||
from typing import Optional
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def hdr(query, uname):
|
||||
h = "GET /%s HTTP/1.1\r\nPW: %s\r\nConnection: close\r\n\r\n"
|
||||
@@ -29,12 +34,21 @@ class TestDots(unittest.TestCase):
|
||||
self.is_dut = True
|
||||
|
||||
def setUp(self):
|
||||
self.conn: Optional[tu.VHttpConn] = None
|
||||
self.td = tu.get_ramdisk()
|
||||
|
||||
def tearDown(self):
|
||||
if self.conn:
|
||||
self.conn.shutdown()
|
||||
os.chdir(tempfile.gettempdir())
|
||||
shutil.rmtree(self.td)
|
||||
|
||||
def cinit(self):
|
||||
if self.conn:
|
||||
self.conn.shutdown()
|
||||
self.conn = None
|
||||
self.conn = tu.VHttpConn(self.args, self.asrv, self.log, b"")
|
||||
|
||||
def test_dots(self):
|
||||
td = os.path.join(self.td, "vfs")
|
||||
os.mkdir(td)
|
||||
@@ -57,6 +71,7 @@ class TestDots(unittest.TestCase):
|
||||
vcfg = [".::r,u1:r.,u2", "a:a:r,u1:r,u2", ".b:.b:r.,u1:r,u2"]
|
||||
self.args = Cfg(v=vcfg, a=["u1:u1", "u2:u2"], e2dsa=True)
|
||||
self.asrv = AuthSrv(self.args, self.log)
|
||||
self.cinit()
|
||||
|
||||
self.assertEqual(self.tardir("", "u1"), "f0 t/f1 a/f3 a/da/f4")
|
||||
self.assertEqual(self.tardir(".t", "u1"), "f2")
|
||||
@@ -88,6 +103,7 @@ class TestDots(unittest.TestCase):
|
||||
self.args = Cfg(v=vcfg, a=["u1:u1", "u2:u2"], dotsrch=False, e2d=True)
|
||||
self.asrv = AuthSrv(self.args, self.log)
|
||||
u2idx = U2idx(self)
|
||||
self.cinit()
|
||||
|
||||
x = u2idx.search("u1", self.asrv.vfs.all_vols.values(), "", 999)
|
||||
x = " ".join(sorted([x["rp"] for x in x[0]]))
|
||||
@@ -113,6 +129,8 @@ class TestDots(unittest.TestCase):
|
||||
]
|
||||
self.args = Cfg(v=vcfg, a=["u1:u1", "u2:u2"])
|
||||
self.asrv = AuthSrv(self.args, self.log)
|
||||
self.cinit()
|
||||
|
||||
zj = json.loads(self.curl("?ls", "u1")[1])
|
||||
url = "?k=" + zj["dk"]
|
||||
# should descend into folders, but not other volumes:
|
||||
@@ -148,6 +166,7 @@ class TestDots(unittest.TestCase):
|
||||
|
||||
self.args = Cfg(v=vcfg, a=["u1:u1", "u2:u2"])
|
||||
self.asrv = AuthSrv(self.args, self.log)
|
||||
self.cinit()
|
||||
|
||||
dk = {}
|
||||
for d in "dk dks dk,fk dks,fk".split():
|
||||
@@ -353,7 +372,7 @@ class TestDots(unittest.TestCase):
|
||||
|
||||
def curl(self, url, uname, binary=False, req=b""):
|
||||
req = req or hdr(url, uname)
|
||||
conn = tu.VHttpConn(self.args, self.asrv, self.log, req)
|
||||
conn = self.conn.setbuf(req)
|
||||
HttpCli(conn).run()
|
||||
if binary:
|
||||
h, b = conn.s._reply.split(b"\r\n\r\n", 1)
|
||||
|
||||
@@ -12,6 +12,11 @@ from copyparty.httpcli import HttpCli
|
||||
from tests import util as tu
|
||||
from tests.util import Cfg
|
||||
|
||||
try:
|
||||
from typing import Optional
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def hdr(query):
|
||||
h = "GET /{} HTTP/1.1\r\nPW: o\r\nConnection: close\r\n\r\n"
|
||||
@@ -20,6 +25,7 @@ def hdr(query):
|
||||
|
||||
class TestHooks(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.conn: Optional[tu.VHttpConn] = None
|
||||
self.td = tu.get_ramdisk()
|
||||
|
||||
def tearDown(self):
|
||||
@@ -34,6 +40,12 @@ class TestHooks(unittest.TestCase):
|
||||
os.chdir(td)
|
||||
return td
|
||||
|
||||
def cinit(self):
|
||||
if self.conn:
|
||||
self.conn.shutdown()
|
||||
self.conn = None
|
||||
self.conn = tu.VHttpConn(self.args, self.asrv, self.log, b"")
|
||||
|
||||
def test(self):
|
||||
vcfg = ["a/b/c/d:c/d:A", "a:a:r"]
|
||||
|
||||
@@ -59,6 +71,7 @@ class TestHooks(unittest.TestCase):
|
||||
ka = {hooktype: ["j,c1,h.py"]}
|
||||
self.args = Cfg(v=vcfg, a=["o:o"], e2d=True, **ka)
|
||||
self.asrv = AuthSrv(self.args, self.log)
|
||||
self.cinit()
|
||||
|
||||
h, b = upfun(url_up)
|
||||
self.assertIn("201 Created", h)
|
||||
@@ -73,7 +86,7 @@ class TestHooks(unittest.TestCase):
|
||||
buf = "PUT /{0} HTTP/1.1\r\nPW: o\r\nConnection: close\r\nContent-Length: {1}\r\n\r\nok {0}\n"
|
||||
buf = buf.format(url, len(url) + 4).encode("utf-8")
|
||||
print("PUT -->", buf)
|
||||
conn = tu.VHttpConn(self.args, self.asrv, self.log, buf)
|
||||
conn = self.conn.setbuf(buf)
|
||||
HttpCli(conn).run()
|
||||
ret = conn.s._reply.decode("utf-8").split("\r\n\r\n", 1)
|
||||
print("PUT <--", ret)
|
||||
@@ -92,14 +105,14 @@ class TestHooks(unittest.TestCase):
|
||||
buf = (bdy % (fn,) + "ok %s/%s\n" % (url, fn) + ftr).encode("utf-8")
|
||||
buf = (hdr % (url, len(buf))).encode("utf-8") + buf
|
||||
print("PoST -->", buf)
|
||||
conn = tu.VHttpConn(self.args, self.asrv, self.log, buf)
|
||||
conn = self.conn.setbuf(buf)
|
||||
HttpCli(conn).run()
|
||||
ret = conn.s._reply.decode("utf-8").split("\r\n\r\n", 1)
|
||||
print("POST <--", ret)
|
||||
return ret
|
||||
|
||||
def curl(self, url, binary=False):
|
||||
conn = tu.VHttpConn(self.args, self.asrv, self.log, hdr(url))
|
||||
conn = self.conn.setbuf(hdr(url))
|
||||
HttpCli(conn).run()
|
||||
if binary:
|
||||
h, b = conn.s._reply.split(b"\r\n\r\n", 1)
|
||||
|
||||
@@ -178,6 +178,8 @@ class TestHttpCli(unittest.TestCase):
|
||||
ap = os.path.join(vn.realpath, rem)
|
||||
os.unlink(ap)
|
||||
|
||||
self.conn.shutdown()
|
||||
|
||||
def can_rw(self, fp):
|
||||
# lowest non-neutral folder declares permissions
|
||||
expect = fp.split("/")[:-1]
|
||||
|
||||
@@ -27,6 +27,8 @@ class TestMetrics(unittest.TestCase):
|
||||
os.chdir(self.td)
|
||||
|
||||
def tearDown(self):
|
||||
if self.conn:
|
||||
self.conn.shutdown()
|
||||
os.chdir(tempfile.gettempdir())
|
||||
shutil.rmtree(self.td)
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ class TestDedup(unittest.TestCase):
|
||||
self.td = tu.get_ramdisk()
|
||||
|
||||
def tearDown(self):
|
||||
if not PY2 and self.conn:
|
||||
self.conn.shutdown()
|
||||
os.chdir(tempfile.gettempdir())
|
||||
shutil.rmtree(self.td)
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ class Cfg(Namespace):
|
||||
def __init__(self, a=None, v=None, c=None, **ka0):
|
||||
ka = {}
|
||||
|
||||
ex = "chpw daw dav_auth dav_inf 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_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 nw og og_no_head og_s_title ohead q rand re_dirsz rss smb srch_dbg stats uqe vague_403 vc ver write_uplog xdev xlink xvol zs"
|
||||
ex = "chpw daw dav_auth dav_inf 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_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 stats uqe vague_403 vc ver write_uplog xdev xlink xvol zs"
|
||||
ka.update(**{k: False for k in ex.split()})
|
||||
|
||||
ex = "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"
|
||||
@@ -278,6 +278,10 @@ class VHttpSrv(object):
|
||||
self.u2idx = self.u2idx or U2idx(self)
|
||||
return self.u2idx
|
||||
|
||||
def shutdown(self):
|
||||
if self.u2idx:
|
||||
self.u2idx.shutdown()
|
||||
|
||||
|
||||
class VHttpSrvUp2k(VHttpSrv):
|
||||
def __init__(self, args, asrv, log):
|
||||
@@ -285,6 +289,11 @@ class VHttpSrvUp2k(VHttpSrv):
|
||||
self.hub = VHub(args, asrv, log)
|
||||
self.broker = VBrokerThr(self.hub)
|
||||
|
||||
def shutdown(self):
|
||||
self.hub.up2k.shutdown()
|
||||
if self.u2idx:
|
||||
self.u2idx.shutdown()
|
||||
|
||||
|
||||
class VHttpConn(object):
|
||||
def __init__(self, args, asrv, log, buf, use_up2k=False):
|
||||
@@ -322,6 +331,9 @@ class VHttpConn(object):
|
||||
self.sr = Unrecv(self.s, None) # type: ignore
|
||||
return self
|
||||
|
||||
def shutdown(self):
|
||||
self.hsrv.shutdown()
|
||||
|
||||
|
||||
if WINDOWS:
|
||||
os.system("rem")
|
||||
|
||||
Reference in New Issue
Block a user