mirror of
https://github.com/9001/copyparty.git
synced 2025-11-04 22:03:21 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96ceccd12a | ||
|
|
87994fe006 | ||
|
|
fa12c81a03 | ||
|
|
344ce63455 |
@@ -1,8 +1,8 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
VERSION = (1, 2, 2)
|
VERSION = (1, 2, 3)
|
||||||
CODENAME = "ftp btw"
|
CODENAME = "ftp btw"
|
||||||
BUILD_DT = (2022, 3, 20)
|
BUILD_DT = (2022, 3, 24)
|
||||||
|
|
||||||
S_VERSION = ".".join(map(str, VERSION))
|
S_VERSION = ".".join(map(str, VERSION))
|
||||||
S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)
|
S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)
|
||||||
|
|||||||
@@ -2175,6 +2175,7 @@ class HttpCli(object):
|
|||||||
tpl = "browser"
|
tpl = "browser"
|
||||||
if "b" in self.uparam:
|
if "b" in self.uparam:
|
||||||
tpl = "browser2"
|
tpl = "browser2"
|
||||||
|
is_js = False
|
||||||
|
|
||||||
logues = ["", ""]
|
logues = ["", ""]
|
||||||
if not self.args.no_logues:
|
if not self.args.no_logues:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import tarfile
|
|||||||
import threading
|
import threading
|
||||||
|
|
||||||
from .sutil import errdesc
|
from .sutil import errdesc
|
||||||
from .util import Queue, fsenc
|
from .util import Queue, fsenc, min_ex
|
||||||
from .bos import bos
|
from .bos import bos
|
||||||
|
|
||||||
|
|
||||||
@@ -88,8 +88,9 @@ class StreamTar(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.ser(f)
|
self.ser(f)
|
||||||
except Exception as ex:
|
except Exception:
|
||||||
errors.append([f["vp"], repr(ex)])
|
ex = min_ex(5, True).replace("\n", "\n-- ")
|
||||||
|
errors.append([f["vp"], ex])
|
||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
self.errf, txt = errdesc(errors)
|
self.errf, txt = errdesc(errors)
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import print_function, unicode_literals
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
import os
|
|
||||||
import time
|
import time
|
||||||
import zlib
|
import zlib
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from .sutil import errdesc
|
from .sutil import errdesc
|
||||||
from .util import yieldfile, sanitize_fn, spack, sunpack
|
from .util import yieldfile, sanitize_fn, spack, sunpack, min_ex
|
||||||
from .bos import bos
|
from .bos import bos
|
||||||
|
|
||||||
|
|
||||||
@@ -36,7 +35,10 @@ def unixtime2dos(ts):
|
|||||||
|
|
||||||
bd = ((dy - 1980) << 9) + (dm << 5) + dd
|
bd = ((dy - 1980) << 9) + (dm << 5) + dd
|
||||||
bt = (th << 11) + (tm << 5) + ts // 2
|
bt = (th << 11) + (tm << 5) + ts // 2
|
||||||
|
try:
|
||||||
return spack(b"<HH", bt, bd)
|
return spack(b"<HH", bt, bd)
|
||||||
|
except:
|
||||||
|
return b"\x00\x00\x21\x00"
|
||||||
|
|
||||||
|
|
||||||
def gen_fdesc(sz, crc32, z64):
|
def gen_fdesc(sz, crc32, z64):
|
||||||
@@ -244,8 +246,9 @@ class StreamZip(object):
|
|||||||
try:
|
try:
|
||||||
for x in self.ser(f):
|
for x in self.ser(f):
|
||||||
yield x
|
yield x
|
||||||
except Exception as ex:
|
except Exception:
|
||||||
errors.append([f["vp"], repr(ex)])
|
ex = min_ex(5, True).replace("\n", "\n-- ")
|
||||||
|
errors.append([f["vp"], ex])
|
||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
errf, txt = errdesc(errors)
|
errf, txt = errdesc(errors)
|
||||||
|
|||||||
@@ -485,13 +485,13 @@ def vol_san(vols, txt):
|
|||||||
return txt
|
return txt
|
||||||
|
|
||||||
|
|
||||||
def min_ex():
|
def min_ex(max_lines=8, reverse=False):
|
||||||
et, ev, tb = sys.exc_info()
|
et, ev, tb = sys.exc_info()
|
||||||
tb = traceback.extract_tb(tb)
|
tb = traceback.extract_tb(tb)
|
||||||
fmt = "{} @ {} <{}>: {}"
|
fmt = "{} @ {} <{}>: {}"
|
||||||
ex = [fmt.format(fp.split(os.sep)[-1], ln, fun, txt) for fp, ln, fun, txt in tb]
|
ex = [fmt.format(fp.split(os.sep)[-1], ln, fun, txt) for fp, ln, fun, txt in tb]
|
||||||
ex.append("[{}] {}".format(et.__name__, ev))
|
ex.append("[{}] {}".format(et.__name__, ev))
|
||||||
return "\n".join(ex[-8:])
|
return "\n".join(ex[-max_lines:][:: -1 if reverse else 1])
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
|
|||||||
@@ -1173,7 +1173,7 @@ function up2k_init(subtle) {
|
|||||||
var t = st.todo.handshake[0],
|
var t = st.todo.handshake[0],
|
||||||
cd = t.cooldown;
|
cd = t.cooldown;
|
||||||
|
|
||||||
if (cd && cd - Date.now() > 0)
|
if (cd && cd > Date.now())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// keepalive or verify
|
// keepalive or verify
|
||||||
@@ -1370,6 +1370,14 @@ function up2k_init(subtle) {
|
|||||||
return taskerd;
|
return taskerd;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
function chill(t) {
|
||||||
|
var now = Date.now();
|
||||||
|
if ((t.coolmul || 0) < 2 || now - t.cooldown < t.coolmul * 700)
|
||||||
|
t.coolmul = Math.min((t.coolmul || 0.5) * 2, 32);
|
||||||
|
|
||||||
|
t.cooldown = Math.max(t.cooldown || 1, Date.now() + t.coolmul * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
/////
|
/////
|
||||||
////
|
////
|
||||||
/// hashing
|
/// hashing
|
||||||
@@ -1756,8 +1764,12 @@ function up2k_init(subtle) {
|
|||||||
|
|
||||||
pvis.move(t.n, 'ok');
|
pvis.move(t.n, 'ok');
|
||||||
}
|
}
|
||||||
else t.t_uploaded = undefined;
|
else {
|
||||||
|
if (t.t_uploaded)
|
||||||
|
chill(t);
|
||||||
|
|
||||||
|
t.t_uploaded = undefined;
|
||||||
|
}
|
||||||
tasker();
|
tasker();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1869,7 +1881,8 @@ function up2k_init(subtle) {
|
|||||||
else {
|
else {
|
||||||
toast.err(0, "server broke; cu-err {0} on file [{1}]:\n".format(
|
toast.err(0, "server broke; cu-err {0} on file [{1}]:\n".format(
|
||||||
xhr.status, t.name) + (txt || "no further information"));
|
xhr.status, t.name) + (txt || "no further information"));
|
||||||
return;
|
|
||||||
|
chill(t);
|
||||||
}
|
}
|
||||||
orz2(xhr);
|
orz2(xhr);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user