mirror of
https://github.com/9001/copyparty.git
synced 2025-11-24 07:23:22 -07:00
send msg when uploads finished; closes #949
This commit is contained in:
parent
b1efc0065c
commit
db87ea5ce1
12
bin/u2c.py
12
bin/u2c.py
|
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from __future__ import print_function, unicode_literals
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
S_VERSION = "2.14"
|
S_VERSION = "2.15"
|
||||||
S_BUILD_DT = "2025-10-24"
|
S_BUILD_DT = "2025-10-25"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
u2c.py: upload to copyparty
|
u2c.py: upload to copyparty
|
||||||
|
|
@ -232,6 +232,7 @@ class HCli(object):
|
||||||
|
|
||||||
MJ = "application/json"
|
MJ = "application/json"
|
||||||
MO = "application/octet-stream"
|
MO = "application/octet-stream"
|
||||||
|
MM = "application/x-www-form-urlencoded"
|
||||||
CLEN = "Content-Length"
|
CLEN = "Content-Length"
|
||||||
|
|
||||||
web = None # type: HCli
|
web = None # type: HCli
|
||||||
|
|
@ -979,6 +980,7 @@ class Ctl(object):
|
||||||
self.nfiles, self.nbytes = self.stats
|
self.nfiles, self.nbytes = self.stats
|
||||||
self.filegen = walkdirs([], ar.files, ar.x)
|
self.filegen = walkdirs([], ar.files, ar.x)
|
||||||
self.recheck = [] # type: list[File]
|
self.recheck = [] # type: list[File]
|
||||||
|
self.last_file = None
|
||||||
|
|
||||||
if ar.safe:
|
if ar.safe:
|
||||||
self._safe()
|
self._safe()
|
||||||
|
|
@ -1015,6 +1017,11 @@ class Ctl(object):
|
||||||
|
|
||||||
self._fancy()
|
self._fancy()
|
||||||
|
|
||||||
|
file = self.last_file
|
||||||
|
if self.up_br and file:
|
||||||
|
zs = quotep(file.name.encode("utf-8", WTF8))
|
||||||
|
web.req("POST", file.url, {}, b"msg=upload-queue-empty;" + zs, MM)
|
||||||
|
|
||||||
self.ok = not self.errs
|
self.ok = not self.errs
|
||||||
|
|
||||||
def _safe(self):
|
def _safe(self):
|
||||||
|
|
@ -1453,6 +1460,7 @@ class Ctl(object):
|
||||||
|
|
||||||
file = fsl.file
|
file = fsl.file
|
||||||
cids = fsl.cids
|
cids = fsl.cids
|
||||||
|
self.last_file = file
|
||||||
|
|
||||||
with self.mutex:
|
with self.mutex:
|
||||||
if not self.uploader_busy:
|
if not self.uploader_busy:
|
||||||
|
|
|
||||||
|
|
@ -1999,6 +1999,18 @@ function up2k_init(subtle) {
|
||||||
|
|
||||||
if (pvis.act == 'bz')
|
if (pvis.act == 'bz')
|
||||||
pvis.changecard('bz');
|
pvis.changecard('bz');
|
||||||
|
|
||||||
|
var n = st.files.length - 1,
|
||||||
|
f = n >= 0 && st.files[n];
|
||||||
|
if (f && !f.srch) {
|
||||||
|
var xhr = new XHR(),
|
||||||
|
ct = 'application/x-www-form-urlencoded;charset=UTF-8';
|
||||||
|
xhr.open('POST', f.purl, true);
|
||||||
|
xhr.setRequestHeader('Content-Type', ct);
|
||||||
|
if (xhr.overrideMimeType)
|
||||||
|
xhr.overrideMimeType('Content-Type', ct);
|
||||||
|
xhr.send('msg=upload-queue-empty;' + uricom_enc(f.name));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function chill(t) {
|
function chill(t) {
|
||||||
|
|
@ -2671,8 +2683,6 @@ function up2k_init(subtle) {
|
||||||
f2f(spd1, 2), !isNum(spd2) ? '--' : f2f(spd2, 2)));
|
f2f(spd1, 2), !isNum(spd2) ? '--' : f2f(spd2, 2)));
|
||||||
|
|
||||||
pvis.move(t.n, 'ok');
|
pvis.move(t.n, 'ok');
|
||||||
if (!pvis.ctr.bz && !pvis.ctr.q)
|
|
||||||
uptoast();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (t.t_uploaded)
|
if (t.t_uploaded)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue