diff --git a/README.md b/README.md index a597b755..97e3be8e 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,14 @@ turn your phone or raspi into a portable file server with resumable uploads/down * code standard: `black` +## notes + +* iPhone/iPad: use Firefox to download files +* Android-Chrome: set max "parallel uploads" for 200% upload speed (android bug) +* Android-Firefox: takes a while to select files (in order to avoid the above android-chrome issue) +* Desktop-Firefox: may use gigabytes of RAM if your connection is great and your files are massive + + ## status * [x] sanic multipart parser diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 4cff3bf8..e47193ec 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -302,8 +302,8 @@ class HttpCli(object): if sha_b64 != chash: raise Pebkac( 400, - "your chunk got corrupted somehow:\n{} expected,\n{} received ({} bytes)".format( - chash, sha_b64, post_sz + "your chunk got corrupted somehow (received {} bytes); expected vs received hash:\n{}\n{}".format( + post_sz, chash, sha_b64 ), ) @@ -447,7 +447,8 @@ class HttpCli(object): do_send = True status = 200 extra_headers = [] - logmsg = "{:4} {} {}".format("", self.req, "200 OK") + logmsg = "{:4} {} ".format("", self.req) + logtail = "" # # if request is for foo.js, check if we have foo.js.gz @@ -516,7 +517,7 @@ class HttpCli(object): "Content-Range: bytes {}-{}/{}".format(lower, upper - 1, file_sz) ) - logmsg += " [\033[36m" + str(lower) + "-" + str(upper) + "\033[0m]" + logtail += " [\033[36m{}-{}\033[0m]".format(lower, upper) # # Accept-Encoding and UA decides if we can send gzip as-is @@ -546,6 +547,8 @@ class HttpCli(object): # # send reply + logmsg += str(status) + logtail + mime = mimetypes.guess_type(req_path)[0] or "application/octet-stream" headers = [ diff --git a/copyparty/svchub.py b/copyparty/svchub.py index 430f4a4a..b901d909 100644 --- a/copyparty/svchub.py +++ b/copyparty/svchub.py @@ -77,7 +77,7 @@ class SvcHub(object): dt = dt.replace(hour=0, minute=0, second=0) self.next_day = calendar.timegm(dt.utctimetuple()) - ts = datetime.utcfromtimestamp(now).strftime("%H:%M:%S") + ts = datetime.utcfromtimestamp(now).strftime("%H:%M:%S.%f")[:-3] print("\033[36m{} \033[33m{:21} \033[0m{}".format(ts, src, msg)) def check_mp_support(self): diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 47c51c95..bbcc2a80 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -108,7 +108,7 @@ class Up2k(object): while True: for mul in [1, 2]: nchunks = math.ceil(filesize * 1.0 / chunksize) - if nchunks <= 256: + if nchunks <= 256 or chunksize >= 32 * 1024 * 1024: return chunksize chunksize += stepsize diff --git a/copyparty/web/splash.html b/copyparty/web/splash.html index 1c3d60f1..4295ebfd 100644 --- a/copyparty/web/splash.html +++ b/copyparty/web/splash.html @@ -35,13 +35,6 @@ - -