From 161bbc7d269a6417ca333e11044a14dc5211dca6 Mon Sep 17 00:00:00 2001 From: Toast <39011842+toast003@users.noreply.github.com> Date: Mon, 28 Jul 2025 21:14:26 +0200 Subject: [PATCH 1/2] connect-page: disable use real password button when there's no accounts --- copyparty/web/svcs.html | 2 +- copyparty/web/svcs.js | 28 +++++++++++++++------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/copyparty/web/svcs.html b/copyparty/web/svcs.html index 0c3ec858..c47d8403 100644 --- a/copyparty/web/svcs.html +++ b/copyparty/web/svcs.html @@ -36,7 +36,7 @@ {% if accs %}{{ pw }}=password, {% endif %}mp=mountpoint - use real password + {% if accs %}use real password{% endif %}

diff --git a/copyparty/web/svcs.js b/copyparty/web/svcs.js index 10513fd2..33eb5713 100644 --- a/copyparty/web/svcs.js +++ b/copyparty/web/svcs.js @@ -49,19 +49,21 @@ function setos(os) { setos(WINDOWS ? 'win' : LINUX ? 'lin' : MACOS ? 'mac' : 'idk'); -ebi('setpw').onclick = function (e) { - ev(e); - modal.prompt('password:', '', function (v) { - if (!v) - return; +pwbutton = ebi('setpw') +if (pwbutton != null) + pwbutton.onclick = function (e) { + ev(e); + modal.prompt('password:', '', function (v) { + if (!v) + return; - var pw0 = ebi('pw0').innerHTML, - oa = QSA('b'); + var pw0 = ebi('pw0').innerHTML, + oa = QSA('b'); - for (var a = 0; a < oa.length; a++) - if (oa[a].innerHTML == pw0) - oa[a].textContent = v; + for (var a = 0; a < oa.length; a++) + if (oa[a].innerHTML == pw0) + oa[a].textContent = v; - add_dls(); - }); -} + add_dls(); + }); + } From 510100c86b24cbb0a070e71f55027978e25b4277 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 28 Jul 2025 19:31:37 +0000 Subject: [PATCH 2/2] Update svcs.js Signed-off-by: ed --- copyparty/web/svcs.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/copyparty/web/svcs.js b/copyparty/web/svcs.js index 33eb5713..dc9b07dc 100644 --- a/copyparty/web/svcs.js +++ b/copyparty/web/svcs.js @@ -49,21 +49,21 @@ function setos(os) { setos(WINDOWS ? 'win' : LINUX ? 'lin' : MACOS ? 'mac' : 'idk'); -pwbutton = ebi('setpw') -if (pwbutton != null) - pwbutton.onclick = function (e) { - ev(e); - modal.prompt('password:', '', function (v) { - if (!v) - return; +function setpw() { + ev(e); + modal.prompt('password:', '', function (v) { + if (!v) + return; - var pw0 = ebi('pw0').innerHTML, - oa = QSA('b'); - - for (var a = 0; a < oa.length; a++) - if (oa[a].innerHTML == pw0) - oa[a].textContent = v; + var pw0 = ebi('pw0').innerHTML, + oa = QSA('b'); + + for (var a = 0; a < oa.length; a++) + if (oa[a].innerHTML == pw0) + oa[a].textContent = v; - add_dls(); - }); - } + add_dls(); + }); +} +if (ebi('setpw')) + ebi('setpw').onclick = setpw;