copyparty 1.15.0__py3-none-any.whl → 1.15.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- copyparty/__init__.py +1 -0
- copyparty/__main__.py +21 -12
- copyparty/__version__.py +2 -2
- copyparty/authsrv.py +84 -8
- copyparty/broker_mp.py +6 -2
- copyparty/broker_mpw.py +6 -2
- copyparty/broker_thr.py +5 -9
- copyparty/broker_util.py +13 -1
- copyparty/cfg.py +1 -0
- copyparty/fsutil.py +0 -3
- copyparty/httpcli.py +145 -70
- copyparty/httpconn.py +0 -1
- copyparty/httpsrv.py +3 -5
- copyparty/svchub.py +67 -5
- copyparty/th_srv.py +15 -7
- copyparty/u2idx.py +0 -3
- copyparty/up2k.py +223 -100
- copyparty/util.py +116 -63
- copyparty/web/browser.css.gz +0 -0
- copyparty/web/browser.js.gz +0 -0
- copyparty/web/splash.css.gz +0 -0
- copyparty/web/splash.html +12 -0
- copyparty/web/splash.js.gz +0 -0
- {copyparty-1.15.0.dist-info → copyparty-1.15.2.dist-info}/METADATA +15 -3
- {copyparty-1.15.0.dist-info → copyparty-1.15.2.dist-info}/RECORD +29 -29
- {copyparty-1.15.0.dist-info → copyparty-1.15.2.dist-info}/WHEEL +1 -1
- {copyparty-1.15.0.dist-info → copyparty-1.15.2.dist-info}/LICENSE +0 -0
- {copyparty-1.15.0.dist-info → copyparty-1.15.2.dist-info}/entry_points.txt +0 -0
- {copyparty-1.15.0.dist-info → copyparty-1.15.2.dist-info}/top_level.txt +0 -0
copyparty/th_srv.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
from __future__ import print_function, unicode_literals
|
3
3
|
|
4
|
-
import base64
|
5
4
|
import hashlib
|
6
5
|
import logging
|
7
6
|
import os
|
@@ -27,6 +26,7 @@ from .util import (
|
|
27
26
|
min_ex,
|
28
27
|
runcmd,
|
29
28
|
statdir,
|
29
|
+
ub64enc,
|
30
30
|
vsplit,
|
31
31
|
wrename,
|
32
32
|
wunlink,
|
@@ -106,6 +106,9 @@ except:
|
|
106
106
|
HAVE_VIPS = False
|
107
107
|
|
108
108
|
|
109
|
+
th_dir_cache = {}
|
110
|
+
|
111
|
+
|
109
112
|
def thumb_path(histpath , rem , mtime , fmt , ffa ) :
|
110
113
|
# base16 = 16 = 256
|
111
114
|
# b64-lc = 38 = 1444
|
@@ -119,14 +122,20 @@ def thumb_path(histpath , rem , mtime , fmt , ffa ) :
|
|
119
122
|
if ext in ffa and fmt[:2] in ("wf", "jf"):
|
120
123
|
fmt = fmt.replace("f", "")
|
121
124
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
125
|
+
dcache = th_dir_cache
|
126
|
+
rd_key = rd + "\n" + fmt
|
127
|
+
rd = dcache.get(rd_key)
|
128
|
+
if not rd:
|
129
|
+
h = hashlib.sha512(afsenc(rd_key)).digest()
|
130
|
+
b64 = ub64enc(h).decode("ascii")[:24]
|
131
|
+
rd = ("%s/%s/" % (b64[:2], b64[2:4])).lower() + b64
|
132
|
+
if len(dcache) > 9001:
|
133
|
+
dcache.clear()
|
134
|
+
dcache[rd_key] = rd
|
126
135
|
|
127
136
|
# could keep original filenames but this is safer re pathlen
|
128
137
|
h = hashlib.sha512(afsenc(fn)).digest()
|
129
|
-
fn =
|
138
|
+
fn = ub64enc(h).decode("ascii")[:24]
|
130
139
|
|
131
140
|
if fmt in ("opus", "caf", "mp3"):
|
132
141
|
cat = "ac"
|
@@ -476,7 +485,6 @@ class ThumbSrv(object):
|
|
476
485
|
if c == crops[-1]:
|
477
486
|
raise
|
478
487
|
|
479
|
-
assert img # type: ignore
|
480
488
|
img.write_to_file(tpath, Q=40)
|
481
489
|
|
482
490
|
def conv_ffmpeg(self, abspath , tpath , fmt , vn ) :
|
copyparty/u2idx.py
CHANGED
@@ -101,7 +101,6 @@ class U2idx(object):
|
|
101
101
|
if not HAVE_SQLITE3 or not self.args.shr:
|
102
102
|
return None
|
103
103
|
|
104
|
-
assert sqlite3 # type: ignore
|
105
104
|
|
106
105
|
db = sqlite3.connect(self.args.shr_db, timeout=2, check_same_thread=False)
|
107
106
|
cur = db.cursor()
|
@@ -117,7 +116,6 @@ class U2idx(object):
|
|
117
116
|
if not HAVE_SQLITE3 or "e2d" not in vn.flags:
|
118
117
|
return None
|
119
118
|
|
120
|
-
assert sqlite3 # type: ignore
|
121
119
|
|
122
120
|
ptop = vn.realpath
|
123
121
|
histpath = self.asrv.vfs.histtab.get(ptop)
|
@@ -464,5 +462,4 @@ class U2idx(object):
|
|
464
462
|
return
|
465
463
|
|
466
464
|
if identifier == self.active_id:
|
467
|
-
assert self.active_cur
|
468
465
|
self.active_cur.connection.interrupt()
|