diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py
index 7dc4bc1bb..dd4d958ef 100644
--- a/copyparty/httpcli.py
+++ b/copyparty/httpcli.py
@@ -5024,10 +5024,20 @@ class HttpCli(object):
else:
rip = host
+ defpw = "dave:hunter2" if self.args.usernames else "hunter2"
+
vp = (self.uparam["hc"] or "").lstrip("/")
- pw = self.ouparam.get("pw") or "hunter2"
+ pw = self.ouparam.get("pw") or defpw
if pw in self.asrv.sesa:
- pw = "hunter2"
+ pw = defpw
+
+ unpw = pw
+ try:
+ un, pw = unpw.split(":")
+ except:
+ un = ""
+ if self.args.usernames:
+ un = "dave"
html = self.j2s(
"svcs",
@@ -5041,7 +5051,10 @@ class HttpCli(object):
host=html_sh_esc(host),
hport=html_sh_esc(hport),
aname=aname,
+ b_un=("%s" % (html_sh_esc(un),)) if un else "k",
+ un=html_sh_esc(un),
pw=html_sh_esc(pw),
+ unpw=html_sh_esc(unpw),
)
self.reply(html.encode("utf-8"))
return True
diff --git a/copyparty/web/svcs.html b/copyparty/web/svcs.html
index 64e2e0dbe..f63e670f9 100644
--- a/copyparty/web/svcs.html
+++ b/copyparty/web/svcs.html
@@ -31,10 +31,10 @@
placeholders:
- {% if accs %}{{ pw }}=password, {% endif %}W:=mountpoint
+ {% if accs %}{% if un %}{{ un }}=username, {{ unpw }}=username:password, {% endif %}{{ pw }}=password, {% endif %}W:=mountpoint
- {% if accs %}{{ pw }}=password, {% endif %}mp=mountpoint
+ {% if accs %}{% if un %}{{ un }}=username, {{ unpw }}=username:password, {% endif %}{{ pw }}=password, {% endif %}mp=mountpoint
{% if accs %}use real password{% endif %}
show qr
@@ -54,7 +54,7 @@
if you can, install winfsp+rclone and then paste this in cmd:
- rclone config create {{ aname }}-dav webdav url=http{{ s }}://{{ rip }}{{ hport }} vendor=owncloud pacer_min_sleep=0.01ms{% if accs %} user=k pass={{ pw }}{% endif %}
+ rclone config create {{ aname }}-dav webdav url=http{{ s }}://{{ rip }}{{ hport }} vendor=owncloud pacer_min_sleep=0.01ms{% if accs %} user={{ b_un }} pass={{ pw }}{% endif %}
rclone mount --vfs-cache-mode writes --dir-cache-time 5s {{ aname }}-dav:{{ rvp }} W:
if you want to use the native WebDAV client in windows instead (slow and buggy), first run webdav-cfg.bat to remove the 47 MiB filesize limit (also fixes latency and password login), then connect:
+ {%- if un %}
+ net use w: http{{ s }}://{{ ep }}/{{ rvp }}{% if accs %} {{ pw }} /user:{{ b_un }}{% endif %}
+ {%- else %}
net use w: http{{ s }}://{{ ep }}/{{ rvp }}{% if accs %} k /user:{{ pw }}{% endif %}
+ {%- endif %}
rclone (v1.63 or later) is recommended:
- rclone config create {{ aname }}-dav webdav url=http{{ s }}://{{ rip }}{{ hport }} vendor=owncloud pacer_min_sleep=0.01ms{% if accs %} user=k pass={{ pw }}{% endif %}
+ rclone config create {{ aname }}-dav webdav url=http{{ s }}://{{ rip }}{{ hport }} vendor=owncloud pacer_min_sleep=0.01ms{% if accs %} user={{ b_un }} pass={{ pw }}{% endif %}
rclone mount --vfs-cache-mode writes --dir-cache-time 5s {{ aname }}-dav:{{ rvp }} mp
alternatively use davfs2 (requires root, is slower, forgets lastmodified-timestamp on upload):
yum install davfs2
+ {%- if un %}
+ {% if accs %}printf '%s\n' {{ b_un }} {{ pw }} | {% endif %}mount -t davfs -ouid=1000 http{{ s }}://{{ ep }}/{{ rvp }} mp
+ {%- else %}
{% if accs %}printf '%s\n' {{ pw }} k | {% endif %}mount -t davfs -ouid=1000 http{{ s }}://{{ ep }}/{{ rvp }} mp
+ {%- endif %}
+ {%- if accs %}
make davfs2 automount on boot:
+ {%- if un %}
+ printf '%s\n' "http{{ s }}://{{ ep }}/{{ rvp }} {{ b_un }} {{ pw }}" >> /etc/davfs2/secrets
+ {%- else %}
printf '%s\n' "http{{ s }}://{{ ep }}/{{ rvp }} {{ pw }} k" >> /etc/davfs2/secrets
+ {%- endif %}
printf '%s\n' "http{{ s }}://{{ ep }}/{{ rvp }} mp davfs rw,user,uid=1000,noauto 0 0" >> /etc/fstab
+ {%- endif %}
or the emergency alternative (gnome/gui-only):
{%- if accs %}
- echo {{ pw }} | gio mount dav{{ s }}://k@{{ ep }}/{{ rvp }}
+ echo {{ pw }} | gio mount dav{{ s }}://{{ b_un }}@{{ ep }}/{{ rvp }}
{%- else %}
gio mount -a dav{{ s }}://{{ ep }}/{{ rvp }}
{%- endif %}
@@ -107,11 +121,11 @@
- osascript -e ' mount volume "http{{ s }}://k:{{ pw }}@{{ ep }}/{{ rvp }}" '
+ osascript -e ' mount volume "http{{ s }}://{{ b_un }}:{{ pw }}@{{ ep }}/{{ rvp }}" '
or you can open up a Finder, press command-K and paste this instead:
- http{{ s }}://k:{{ pw }}@{{ ep }}/{{ rvp }}
+ http{{ s }}://{{ b_un }}:{{ pw }}@{{ ep }}/{{ rvp }}
{%- if s %}
@@ -130,14 +144,22 @@
{%- if args.ftp %}
connect with plaintext FTP:
+ {%- if un %}
+ rclone config create {{ aname }}-ftp ftp host={{ rip }} port={{ args.ftp }} user={% if accs %}{{ b_un }} pass={{ pw }}{% else %}anonymous pass=k{% endif %} tls=false
+ {%- else %}
rclone config create {{ aname }}-ftp ftp host={{ rip }} port={{ args.ftp }} pass=k user={% if accs %}{{ pw }}{% else %}anonymous{% endif %} tls=false
+ {%- endif %}
rclone mount --vfs-cache-mode writes --dir-cache-time 5s {{ aname }}-ftp:{{ rvp }} W:
{%- endif %}
{%- if args.ftps %}
connect with TLS-encrypted FTPS:
+ {%- if un %}
+ rclone config create {{ aname }}-ftps ftp host={{ rip }} port={{ args.ftps }} user={% if accs %}{{ b_un }} pass={{ pw }}{% else %}anonymous pass=k{% endif %} tls=false explicit_tls=true
+ {%- else %}
rclone config create {{ aname }}-ftps ftp host={{ rip }} port={{ args.ftps }} pass=k user={% if accs %}{{ pw }}{% else %}anonymous{% endif %} tls=false explicit_tls=true
+ {%- endif %}
rclone mount --vfs-cache-mode writes --dir-cache-time 5s {{ aname }}-ftps:{{ rvp }} W:
{%- endif %}
@@ -149,7 +171,11 @@
if you want to use the native FTP client in windows instead (please dont), press win+R and run this command:
+ {%- if un %}
+ explorer {{ "ftp" if args.ftp else "ftps" }}://{% if accs %}{{ b_un }}:{{ pw }}@{% endif %}{{ host }}:{{ args.ftp or args.ftps }}/{{ rvp }}
+ {%- else %}
explorer {{ "ftp" if args.ftp else "ftps" }}://{% if accs %}{{ pw }}:k@{% endif %}{{ host }}:{{ args.ftp or args.ftps }}/{{ rvp }}
+ {%- endif %}
@@ -157,14 +183,22 @@
{%- if args.ftp %}
connect with plaintext FTP:
+ {%- if un %}
+ rclone config create {{ aname }}-ftp ftp host={{ rip }} port={{ args.ftp }} user={% if accs %}{{ b_un }} pass={{ pw }}{% else %}anonymous pass=k{% endif %} tls=false
+ {%- else %}
rclone config create {{ aname }}-ftp ftp host={{ rip }} port={{ args.ftp }} pass=k user={% if accs %}{{ pw }}{% else %}anonymous{% endif %} tls=false
+ {%- endif %}
rclone mount --vfs-cache-mode writes --dir-cache-time 5s {{ aname }}-ftp:{{ rvp }} mp
{%- endif %}
{%- if args.ftps %}
connect with TLS-encrypted FTPS:
+ {%- if un %}
+ rclone config create {{ aname }}-ftps ftp host={{ rip }} port={{ args.ftps }} user={% if accs %}{{ b_un }} pass={{ pw }}{% else %}anonymous pass=k{% endif %} tls=false explicit_tls=true
+ {%- else %}
rclone config create {{ aname }}-ftps ftp host={{ rip }} port={{ args.ftps }} pass=k user={% if accs %}{{ pw }}{% else %}anonymous{% endif %} tls=false explicit_tls=true
+ {%- endif %}
rclone mount --vfs-cache-mode writes --dir-cache-time 5s {{ aname }}-ftps:{{ rvp }} mp
{%- endif %}
@@ -179,7 +213,7 @@
{%- if accs %}
- echo {{ pw }} | gio mount ftp{{ "" if args.ftp else "s" }}://k@{{ host }}:{{ args.ftp or args.ftps }}/{{ rvp }}
+ echo {{ pw }} | gio mount ftp{{ "" if args.ftp else "s" }}://{{ b_un }}@{{ host }}:{{ args.ftp or args.ftps }}/{{ rvp }}
{%- else %}
gio mount -a ftp{{ "" if args.ftp else "s" }}://{{ host }}:{{ args.ftp or args.ftps }}/{{ rvp }}
{%- endif %}
@@ -189,7 +223,7 @@
note: FTP is read-only on macos; please use WebDAV instead
- open {{ "ftp" if args.ftp else "ftps" }}://{% if accs %}k:{{ pw }}@{% else %}anonymous:@{% endif %}{{ host }}:{{ args.ftp or args.ftps }}/{{ rvp }}
+ open {{ "ftp" if args.ftp else "ftps" }}://{% if accs %}{{ b_un }}:{{ pw }}@{% else %}anonymous:@{% endif %}{{ host }}:{{ args.ftp or args.ftps }}/{{ rvp }}
{%- endif %}
@@ -204,7 +238,7 @@
doesn't need root
- partyfuse.py{% if accs %} -a {{ pw }}{% endif %} http{{ s }}://{{ ep }}/{{ rvp }} W:mp
+ partyfuse.py{% if accs %} -a {{ unpw }}{% endif %} http{{ s }}://{{ ep }}/{{ rvp }} W:mp
{%- if s %}
-td--usernames is enabled in the server config
net use w: \\{{ host }}\a{% if accs %} k /user:{{ pw }}{% endif %}
@@ -235,6 +273,7 @@
open 'smb://{{ pw }}:k@{{ host }}/a'
{%- endif %}
+ {%- endif %}
@@ -247,7 +286,7 @@
{ "Version": "15.0.0", "Name": "copyparty",
"RequestURL": "http{{ s }}://{{ ep }}/{{ rvp }}",
"Headers": {
- {% if accs %}"pw": "{{ pw }}", {% endif %}"accept": "url"
+ {% if accs %}"pw": "{{ unpw }}", {% endif %}"accept": "url"
},
"DestinationType": "ImageUploader, TextUploader, FileUploader",
"Body": "MultipartFormData", "URL": "{response}",
@@ -260,7 +299,7 @@
{ "Name": "copyparty",
"RequestURL": "http{{ s }}://{{ ep }}/{{ rvp }}",
"Headers": {
- {% if accs %}"pw": "{{ pw }}", {% endif %}"accept": "url"
+ {% if accs %}"pw": "{{ unpw }}", {% endif %}"accept": "url"
},
"DestinationType": "ImageUploader, TextUploader, FileUploader",
"FileFormName": "f" }
@@ -278,7 +317,9 @@
{ "Name": "copyparty",
"RequestURL": "http{{ s }}://{{ ep }}/{{ rvp }}",
"Headers": {
- {% if accs %}"pw": "{{ pw }}",{% endif %}
+ {%- if accs %}
+ "pw": "{{ unpw }}",
+ {%- endif %}
"accept": "json"
},
"ResponseURL": "{{ '{{fileurl}}' }}",
@@ -295,7 +336,7 @@
#!/bin/bash
- pw="{{ pw }}"
+ pw="{{ unpw }}"
url="http{{ s }}://{{ ep }}/{{ rvp }}"
filename="$(date +%Y-%m%d-%H%M%S).png"
flameshot gui -s -r | curl -sT- "$url$filename?want=url&pw=$pw" | xsel -ib
diff --git a/copyparty/web/svcs.js b/copyparty/web/svcs.js
index dad7faab1..0b0f6b91b 100644
--- a/copyparty/web/svcs.js
+++ b/copyparty/web/svcs.js
@@ -49,21 +49,47 @@ function setos(os) {
setos(WINDOWS ? 'win' : LINUX ? 'lin' : MACOS ? 'mac' : 'idk');
-var pw = '';
+var un, un0, pw, pw0, unpw, up0;
function setpw(e) {
ev(e);
+ if (!ebi('un0'))
+ return askpw();
+
+ modal.prompt('username:', '', function (v) {
+ if (!v)
+ return;
+
+ un = v;
+ un0 = ebi('un0').innerHTML;
+ var oa = QSA('b');
+
+ for (var a = 0; a < oa.length; a++)
+ if (oa[a].innerHTML == un0)
+ oa[a].textContent = un;
+
+ askpw();
+ });
+}
+function askpw() {
modal.prompt('password:', '', function (v) {
if (!v)
return;
pw = v;
- var pw0 = ebi('pw0').innerHTML,
- oa = QSA('b');
-
+ pw0 = ebi('pw0').innerHTML;
+ var oa = QSA('b');
+
for (var a = 0; a < oa.length; a++)
if (oa[a].innerHTML == pw0)
- oa[a].textContent = v;
+ oa[a].textContent = pw;
+ if (un) {
+ unpw = un ? (un+':'+pw) : pw;
+ up0 = ebi('up0').innerHTML;
+ for (var a = 0; a < oa.length; a++)
+ if (oa[a].innerHTML == up0)
+ oa[a].textContent = unpw;
+ }
add_dls();
});
}