copyparty 1.15.3__py3-none-any.whl → 1.15.5__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 +54 -0
- copyparty/__main__.py +14 -12
- copyparty/__version__.py +2 -2
- copyparty/cert.py +20 -8
- copyparty/cfg.py +1 -1
- copyparty/ftpd.py +1 -1
- copyparty/httpcli.py +226 -67
- copyparty/httpconn.py +0 -3
- copyparty/httpsrv.py +10 -15
- copyparty/metrics.py +1 -1
- copyparty/smbd.py +6 -3
- copyparty/stolen/qrcodegen.py +17 -0
- copyparty/szip.py +1 -1
- copyparty/u2idx.py +1 -0
- copyparty/up2k.py +30 -12
- copyparty/util.py +148 -64
- copyparty/web/a/partyfuse.py +233 -357
- copyparty/web/a/u2c.py +249 -153
- copyparty/web/browser.css.gz +0 -0
- copyparty/web/browser.html +3 -6
- copyparty/web/browser.js.gz +0 -0
- copyparty/web/deps/fuse.py +1064 -0
- copyparty/web/deps/marked.js.gz +0 -0
- copyparty/web/shares.css.gz +0 -0
- copyparty/web/shares.html +7 -4
- copyparty/web/shares.js.gz +0 -0
- copyparty/web/splash.html +12 -12
- copyparty/web/splash.js.gz +0 -0
- copyparty/web/svcs.html +1 -1
- copyparty/web/ui.css.gz +0 -0
- copyparty/web/util.js.gz +0 -0
- {copyparty-1.15.3.dist-info → copyparty-1.15.5.dist-info}/METADATA +10 -8
- {copyparty-1.15.3.dist-info → copyparty-1.15.5.dist-info}/RECORD +37 -36
- {copyparty-1.15.3.dist-info → copyparty-1.15.5.dist-info}/WHEEL +1 -1
- {copyparty-1.15.3.dist-info → copyparty-1.15.5.dist-info}/LICENSE +0 -0
- {copyparty-1.15.3.dist-info → copyparty-1.15.5.dist-info}/entry_points.txt +0 -0
- {copyparty-1.15.3.dist-info → copyparty-1.15.5.dist-info}/top_level.txt +0 -0
copyparty/__init__.py
CHANGED
@@ -48,6 +48,60 @@ try:
|
|
48
48
|
except:
|
49
49
|
CORES = (os.cpu_count() if hasattr(os, "cpu_count") else 0) or 2
|
50
50
|
|
51
|
+
# all embedded resources to be retrievable over http
|
52
|
+
zs = """
|
53
|
+
web/a/partyfuse.py
|
54
|
+
web/a/u2c.py
|
55
|
+
web/a/webdav-cfg.bat
|
56
|
+
web/baguettebox.js
|
57
|
+
web/browser.css
|
58
|
+
web/browser.html
|
59
|
+
web/browser.js
|
60
|
+
web/browser2.html
|
61
|
+
web/cf.html
|
62
|
+
web/copyparty.gif
|
63
|
+
web/dd/2.png
|
64
|
+
web/dd/3.png
|
65
|
+
web/dd/4.png
|
66
|
+
web/dd/5.png
|
67
|
+
web/deps/busy.mp3
|
68
|
+
web/deps/easymde.css
|
69
|
+
web/deps/easymde.js
|
70
|
+
web/deps/marked.js
|
71
|
+
web/deps/fuse.py
|
72
|
+
web/deps/mini-fa.css
|
73
|
+
web/deps/mini-fa.woff
|
74
|
+
web/deps/prism.css
|
75
|
+
web/deps/prism.js
|
76
|
+
web/deps/prismd.css
|
77
|
+
web/deps/scp.woff2
|
78
|
+
web/deps/sha512.ac.js
|
79
|
+
web/deps/sha512.hw.js
|
80
|
+
web/md.css
|
81
|
+
web/md.html
|
82
|
+
web/md.js
|
83
|
+
web/md2.css
|
84
|
+
web/md2.js
|
85
|
+
web/mde.css
|
86
|
+
web/mde.html
|
87
|
+
web/mde.js
|
88
|
+
web/msg.css
|
89
|
+
web/msg.html
|
90
|
+
web/shares.css
|
91
|
+
web/shares.html
|
92
|
+
web/shares.js
|
93
|
+
web/splash.css
|
94
|
+
web/splash.html
|
95
|
+
web/splash.js
|
96
|
+
web/svcs.html
|
97
|
+
web/svcs.js
|
98
|
+
web/ui.css
|
99
|
+
web/up2k.js
|
100
|
+
web/util.js
|
101
|
+
web/w.hash.js
|
102
|
+
"""
|
103
|
+
RES = set(zs.strip().split("\n"))
|
104
|
+
|
51
105
|
|
52
106
|
class EnvParams(object):
|
53
107
|
def __init__(self) :
|
copyparty/__main__.py
CHANGED
@@ -57,6 +57,8 @@ from .util import (
|
|
57
57
|
ansi_re,
|
58
58
|
b64enc,
|
59
59
|
dedent,
|
60
|
+
has_resource,
|
61
|
+
load_resource,
|
60
62
|
min_ex,
|
61
63
|
pybin,
|
62
64
|
termsize,
|
@@ -319,8 +321,7 @@ def ensure_locale() :
|
|
319
321
|
|
320
322
|
|
321
323
|
def ensure_webdeps() :
|
322
|
-
|
323
|
-
if os.path.exists(ap):
|
324
|
+
if has_resource(E, "web/deps/mini-fa.woff"):
|
324
325
|
return
|
325
326
|
|
326
327
|
warn(
|
@@ -511,14 +512,18 @@ def sfx_tpoke(top ):
|
|
511
512
|
|
512
513
|
|
513
514
|
def showlic() :
|
514
|
-
|
515
|
-
|
515
|
+
try:
|
516
|
+
with load_resource(E, "res/COPYING.txt") as f:
|
517
|
+
buf = f.read()
|
518
|
+
except:
|
519
|
+
buf = b""
|
520
|
+
|
521
|
+
if buf:
|
522
|
+
print(buf.decode("utf-8", "replace"))
|
523
|
+
else:
|
516
524
|
print("no relevant license info to display")
|
517
525
|
return
|
518
526
|
|
519
|
-
with open(p, "rb") as f:
|
520
|
-
print(f.read().decode("utf-8", "replace"))
|
521
|
-
|
522
527
|
|
523
528
|
def get_sects():
|
524
529
|
return [
|
@@ -1166,7 +1171,7 @@ def add_smb(ap):
|
|
1166
1171
|
ap2.add_argument("--smbw", action="store_true", help="enable write support (please dont)")
|
1167
1172
|
ap2.add_argument("--smb1", action="store_true", help="disable SMBv2, only enable SMBv1 (CIFS)")
|
1168
1173
|
ap2.add_argument("--smb-port", metavar="PORT", type=int, default=445, help="port to listen on -- if you change this value, you must NAT from TCP:445 to this port using iptables or similar")
|
1169
|
-
ap2.add_argument("--smb-nwa-1", action="store_true", help="
|
1174
|
+
ap2.add_argument("--smb-nwa-1", action="store_true", help="truncate directory listings to 64kB (~400 files); avoids impacket-0.11 bug, fixes impacket-0.12 performance")
|
1170
1175
|
ap2.add_argument("--smb-nwa-2", action="store_true", help="disable impacket workaround for filecopy globs")
|
1171
1176
|
ap2.add_argument("--smba", action="store_true", help="small performance boost: disable per-account permissions, enables account coalescing instead (if one user has write/delete-access, then everyone does)")
|
1172
1177
|
ap2.add_argument("--smbv", action="store_true", help="verbose")
|
@@ -1558,16 +1563,13 @@ def run_argparse(
|
|
1558
1563
|
return ret
|
1559
1564
|
|
1560
1565
|
|
1561
|
-
def main(argv = None
|
1566
|
+
def main(argv = None) :
|
1562
1567
|
time.strptime("19970815", "%Y%m%d") # python#7980
|
1563
1568
|
if WINDOWS:
|
1564
1569
|
os.system("rem") # enables colors
|
1565
1570
|
|
1566
1571
|
init_E(E)
|
1567
1572
|
|
1568
|
-
if rsrc: # pyz
|
1569
|
-
E.mod = rsrc
|
1570
|
-
|
1571
1573
|
if argv is None:
|
1572
1574
|
argv = sys.argv
|
1573
1575
|
|
copyparty/__version__.py
CHANGED
copyparty/cert.py
CHANGED
@@ -7,7 +7,7 @@ import shutil
|
|
7
7
|
import time
|
8
8
|
|
9
9
|
from .__init__ import ANYWIN
|
10
|
-
from .util import Netdev, runcmd, wrename, wunlink
|
10
|
+
from .util import Netdev, load_resource, runcmd, wrename, wunlink
|
11
11
|
|
12
12
|
HAVE_CFSSL = not os.environ.get("PRTY_NO_CFSSL")
|
13
13
|
|
@@ -25,13 +25,15 @@ def ensure_cert(log , args) :
|
|
25
25
|
|
26
26
|
i feel awful about this and so should they
|
27
27
|
"""
|
28
|
-
|
28
|
+
with load_resource(args.E, "res/insecure.pem") as f:
|
29
|
+
cert_insec = f.read()
|
29
30
|
cert_appdata = os.path.join(args.E.cfg, "cert.pem")
|
30
31
|
if not os.path.isfile(args.cert):
|
31
32
|
if cert_appdata != args.cert:
|
32
33
|
raise Exception("certificate file does not exist: " + args.cert)
|
33
34
|
|
34
|
-
|
35
|
+
with open(args.cert, "wb") as f:
|
36
|
+
f.write(cert_insec)
|
35
37
|
|
36
38
|
with open(args.cert, "rb") as f:
|
37
39
|
buf = f.read()
|
@@ -46,7 +48,9 @@ def ensure_cert(log , args) :
|
|
46
48
|
raise Exception(m + "private key must appear before server certificate")
|
47
49
|
|
48
50
|
try:
|
49
|
-
|
51
|
+
with open(args.cert, "rb") as f:
|
52
|
+
active_cert = f.read()
|
53
|
+
if active_cert == cert_insec:
|
50
54
|
t = "using default TLS certificate; https will be insecure:\033[36m {}"
|
51
55
|
log("cert", t.format(args.cert), 3)
|
52
56
|
except:
|
@@ -147,14 +151,22 @@ def _gen_srv(log , args, netdevs ):
|
|
147
151
|
raise Exception("no useable cert found")
|
148
152
|
|
149
153
|
expired = time.time() + args.crt_sdays * 60 * 60 * 24 * 0.5 > expiry
|
150
|
-
|
154
|
+
if expired:
|
155
|
+
raise Exception("old server-cert has expired")
|
156
|
+
|
151
157
|
for n in names:
|
152
158
|
if n not in inf["sans"]:
|
153
159
|
raise Exception("does not have {}".format(n))
|
154
|
-
|
155
|
-
|
156
|
-
|
160
|
+
|
161
|
+
with load_resource(args.E, "res/insecure.pem") as f:
|
162
|
+
cert_insec = f.read()
|
163
|
+
|
164
|
+
with open(args.cert, "rb") as f:
|
165
|
+
active_cert = f.read()
|
166
|
+
|
167
|
+
if active_cert and active_cert != cert_insec:
|
157
168
|
return
|
169
|
+
|
158
170
|
except Exception as ex:
|
159
171
|
log("cert", "will create new server-cert; {}".format(ex))
|
160
172
|
|
copyparty/cfg.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
from __future__ import print_function, unicode_literals
|
3
3
|
|
4
4
|
# awk -F\" '/add_argument\("-[^-]/{print(substr($2,2))}' copyparty/__main__.py | sort | tr '\n' ' '
|
5
|
-
zs = "a c e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vp e2vu ed emp i j lo mcr mte mth mtm mtp nb nc nid nih nw p q s ss sss v z zv"
|
5
|
+
zs = "a c e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vp e2vu ed emp i j lo mcr mte mth mtm mtp nb nc nid nih nth nw p q s ss sss v z zv"
|
6
6
|
onedash = set(zs.split())
|
7
7
|
|
8
8
|
|
copyparty/ftpd.py
CHANGED
@@ -159,7 +159,7 @@ class FtpFs(AbstractedFS):
|
|
159
159
|
t = "Unsupported characters in [{}]"
|
160
160
|
raise FSE(t.format(vpath), 1)
|
161
161
|
|
162
|
-
fn = sanitize_fn(fn or "", ""
|
162
|
+
fn = sanitize_fn(fn or "", "")
|
163
163
|
vpath = vjoin(rd, fn)
|
164
164
|
vfs, rem = self.hub.asrv.vfs.get(vpath, self.uname, r, w, m, d)
|
165
165
|
if not vfs.realpath:
|