From 136c0fdc2b74ca57340f547e9a5827278519ebe8 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 5 Feb 2024 19:17:36 +0000 Subject: [PATCH 1/4] detect reverse-proxies stripping URL params: if a reverseproxy decides to strip away URL parameters, show an appropriate error-toast instead of silently entering a bad state someone on discord ended up in an infinite page-reload loop since the js would try to recover by fully navigating to the requested dir if `?ls` failed, which wouldn't do any good anyways if the dir in question is the initial dir to display --- copyparty/web/browser.js | 13 ++++++++----- copyparty/web/util.js | 2 ++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 98c14d0c..b84f32e3 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -5830,7 +5830,7 @@ var treectl = (function () { var res = JSON.parse(this.responseText); } catch (ex) { - return; + return toast.err(30, "bad ?tree reply;\nexpected json, got this:\n\n" + esc(this.responseText + '')); } rendertree(res, this.ts, this.top, this.dst, this.rst); } @@ -5995,7 +5995,7 @@ var treectl = (function () { thegrid.setvis(true); } - r.reqls = function (url, hpush, back) { + r.reqls = function (url, hpush, back, hydrate) { if (IE && !history.pushState) return window.location = url; @@ -6003,6 +6003,7 @@ var treectl = (function () { xhr.top = url.split('?')[0]; xhr.back = back xhr.hpush = hpush; + xhr.hydrate = hydrate; xhr.ts = Date.now(); xhr.open('GET', xhr.top + '?ls' + (r.dots ? '&dots' : ''), true); xhr.onload = xhr.onerror = recvls; @@ -6049,8 +6050,10 @@ var treectl = (function () { var res = JSON.parse(this.responseText); } catch (ex) { - location = this.top; - return; + if (!this.hydrate) + location = this.top; + + return toast.err(30, "bad ?ls reply;\nexpected json, got this:\n\n" + esc(this.responseText + '')); } if (r.chk_index_html(this.top, res)) @@ -6272,7 +6275,7 @@ var treectl = (function () { xhr.send(); r.ls_cb = showfile.addlinks; - return r.reqls(get_evpath(), false); + return r.reqls(get_evpath(), false, undefined, true); } var top = get_evpath(); diff --git a/copyparty/web/util.js b/copyparty/web/util.js index 6ea920b2..057b8ad9 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -1470,6 +1470,8 @@ var toast = (function () { }; r.show = function (cl, sec, txt, tag) { + txt = (txt + '').slice(0, 16384); + var same = r.visible && txt == r.p_txt && r.p_sec == sec, delta = Date.now() - r.p_t; From 4e797a715607fd8e4c85fe95afc491f7ab3df280 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 5 Feb 2024 20:11:04 +0000 Subject: [PATCH 2/4] docker: mention debian issue from discord --- scripts/docker/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/docker/README.md b/scripts/docker/README.md index d90cd975..6ab1e711 100644 --- a/scripts/docker/README.md +++ b/scripts/docker/README.md @@ -79,6 +79,15 @@ or using commandline arguments, ``` +# faq + +the following advice is best-effort and not guaranteed to be entirely correct + +* q: starting a rootless container on debian 12 fails with `failed to register layer: lsetxattr user.overlay.impure /etc: operation not supported` + * a: docker's default rootless configuration on debian is to use the overlay2 storage driver; this does not work. Your options are to replace docker with podman (good choice), or to configure docker to use the `fuse-overlayfs` storage driver + + + # build the images yourself basically `./make.sh hclean pull img push` but see [devnotes.md](./devnotes.md) From f0cdd9f25d97a9aa1ee03e126ac3c4333b055c20 Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 7 Feb 2024 20:39:51 +0000 Subject: [PATCH 3/4] upgrade copyparty.exe to python 3.11.8 --- scripts/pyinstaller/deps.sha512 | 2 +- scripts/pyinstaller/notes.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pyinstaller/deps.sha512 b/scripts/pyinstaller/deps.sha512 index 90550a7f..de7912b1 100644 --- a/scripts/pyinstaller/deps.sha512 +++ b/scripts/pyinstaller/deps.sha512 @@ -29,4 +29,4 @@ ba91ab0518c61eff13e5612d9e6b532940813f6b56e6ed81ea6c7c4d45acee4d98136a383a250675 8a6e2b13a2ec4ef914a5d62aad3db6464d45e525a82e07f6051ed10474eae959069e165dba011aefb8207cdfd55391d73d6f06362c7eb247b08763106709526e mutagen-1.47.0-py3-none-any.whl 656015f5cc2c04aa0653ee5609c39a7e5f0b6a58c84fe26b20bd070c52d20b4effb810132f7fb771168483e9fd975cc3302837dd7a1a687ee058b0460c857cc4 packaging-23.2-py3-none-any.whl 424e20dc7263a31d524307bc39ed755a9dd82f538086fff68d98dd97e236c9b00777a8ac2e3853081b532b0e93cef44983e74d0ab274877440e8b7341b19358a pillow-10.2.0-cp311-cp311-win_amd64.whl -2e6a57bab45b5a825a2073780c73980cbf5aafd99dc3b28660ea3f5f658f04668cd0f01c7de0bb79e362ff4e3b8f01dd4f671d3a2e054d3071baefdcf0b0e4ba python-3.11.7-amd64.exe +e6bdbae1affd161e62fc87407c912462dfe875f535ba9f344d0c4ade13715c947cd3ae832eff60f1bad4161938311d06ac8bc9b52ef203f7b0d9de1409f052a5 python-3.11.8-amd64.exe diff --git a/scripts/pyinstaller/notes.txt b/scripts/pyinstaller/notes.txt index 287c655b..91904192 100644 --- a/scripts/pyinstaller/notes.txt +++ b/scripts/pyinstaller/notes.txt @@ -29,7 +29,7 @@ fns=( mutagen-1.47.0-py3-none-any.whl packaging-23.2-py3-none-any.whl pillow-10.2.0-cp311-cp311-win_amd64.whl - python-3.11.7-amd64.exe + python-3.11.8-amd64.exe ) [ $w7 ] && fns+=( pyinstaller-5.13.2-py3-none-win32.whl From ed524d84bb291565badc9e72deeac7d5be5771ba Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 7 Feb 2024 23:02:47 +0000 Subject: [PATCH 4/4] /np: exclude uploader ip and trim dot-prefix --- copyparty/web/browser.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index b84f32e3..562a05a3 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -1813,19 +1813,21 @@ function MPlayer() { } -function ft2dict(tr) { +function ft2dict(tr, skip) { var th = ebi('files').tHead.rows[0].cells, rv = [], rh = [], ra = [], rt = {}; + skip = skip || {}; + for (var a = 1, aa = th.length; a < aa; a++) { var tv = tr.cells[a].textContent, tk = a == 1 ? 'file' : th[a].getAttribute('name').split('/').pop().toLowerCase(), vis = th[a].className.indexOf('min') === -1; - if (!tv) + if (!tv || skip[tk]) continue; (vis ? rv : rh).push(tk); @@ -1838,7 +1840,7 @@ function ft2dict(tr) { function get_np() { var tr = QS('#files tr.play'); - return ft2dict(tr); + return ft2dict(tr, { 'up_ip': 1 }); }; @@ -1899,7 +1901,7 @@ var widget = (function () { np = npr[0]; for (var a = 0; a < npk.length; a++) - m += (npk[a] == 'file' ? '' : npk[a]) + '(' + cv + np[npk[a]] + ck + ') // '; + m += (npk[a] == 'file' ? '' : npk[a]).replace(/^\./, '') + '(' + cv + np[npk[a]] + ck + ') // '; m += '[' + cv + s2ms(mp.au.currentTime) + ck + '/' + cv + s2ms(mp.au.duration) + ck + ']';