copyparty 1.19.5__tar.gz → 1.19.7__tar.gz
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-1.19.5 → copyparty-1.19.7}/PKG-INFO +11 -1
- {copyparty-1.19.5 → copyparty-1.19.7}/README.md +10 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/__main__.py +85 -30
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/__version__.py +2 -2
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/authsrv.py +16 -1
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/broker_util.py +0 -1
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/cert.py +1 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/cfg.py +2 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/ftpd.py +1 -1
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/httpcli.py +43 -27
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/mdns.py +2 -2
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/multicast.py +3 -3
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/pwhash.py +1 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/smbd.py +1 -1
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/svchub.py +54 -17
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/tcpsrv.py +4 -3
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/up2k.py +13 -2
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/util.py +30 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/a/u2c.py +6 -6
- copyparty-1.19.7/copyparty/web/browser.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/md.html +2 -1
- copyparty-1.19.7/copyparty/web/md.js.gz +0 -0
- copyparty-1.19.7/copyparty/web/md2.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/mde.html +2 -1
- copyparty-1.19.7/copyparty/web/splash.js.gz +0 -0
- copyparty-1.19.7/copyparty/web/ui.css.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty.egg-info/PKG-INFO +11 -1
- copyparty-1.19.5/copyparty/web/browser.js.gz +0 -0
- copyparty-1.19.5/copyparty/web/md.js.gz +0 -0
- copyparty-1.19.5/copyparty/web/md2.js.gz +0 -0
- copyparty-1.19.5/copyparty/web/splash.js.gz +0 -0
- copyparty-1.19.5/copyparty/web/ui.css.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/LICENSE +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/__init__.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/bos/__init__.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/bos/bos.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/bos/path.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/broker_mp.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/broker_mpw.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/broker_thr.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/dxml.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/fsutil.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/httpconn.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/httpsrv.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/ico.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/metrics.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/mtag.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/res/COPYING.txt +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/res/__init__.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/res/insecure.pem +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/ssdp.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/star.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/stolen/__init__.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/stolen/dnslib/__init__.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/stolen/dnslib/bimap.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/stolen/dnslib/bit.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/stolen/dnslib/buffer.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/stolen/dnslib/dns.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/stolen/dnslib/label.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/stolen/dnslib/lex.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/stolen/dnslib/ranges.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/stolen/ifaddr/__init__.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/stolen/ifaddr/_posix.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/stolen/ifaddr/_shared.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/stolen/ifaddr/_win32.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/stolen/qrcodegen.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/stolen/surrogateescape.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/sutil.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/szip.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/tftpd.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/th_cli.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/th_srv.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/u2idx.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/a/__init__.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/a/partyfuse.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/a/webdav-cfg.bat +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/baguettebox.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/browser.css.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/browser.html +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/browser2.html +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/cf.html +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/dbg-audio.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/deps/__init__.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/deps/busy.mp3.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/deps/easymde.css.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/deps/easymde.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/deps/fuse.py +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/deps/marked.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/deps/mini-fa.css.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/deps/mini-fa.woff +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/deps/prism.css.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/deps/prism.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/deps/prismd.css.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/deps/scp.woff2 +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/deps/sha512.ac.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/deps/sha512.hw.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/idp.html +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/md.css.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/md2.css.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/mde.css.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/mde.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/msg.css.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/msg.html +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/rups.css.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/rups.html +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/rups.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/shares.css.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/shares.html +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/shares.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/splash.css.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/splash.html +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/svcs.html +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/svcs.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/up2k.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/util.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty/web/w.hash.js.gz +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty.egg-info/SOURCES.txt +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty.egg-info/dependency_links.txt +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty.egg-info/entry_points.txt +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty.egg-info/requires.txt +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/copyparty.egg-info/top_level.txt +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/pyproject.toml +0 -0
- {copyparty-1.19.5 → copyparty-1.19.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: copyparty
|
3
|
-
Version: 1.19.
|
3
|
+
Version: 1.19.7
|
4
4
|
Summary: Portable file server with accelerated resumable uploads, deduplication, WebDAV, FTP, zeroconf, media indexer, video thumbnails, audio transcoding, and write-only folders
|
5
5
|
Author-email: ed <copyparty@ocv.me>
|
6
6
|
License: MIT
|
@@ -637,6 +637,8 @@ for example `-v /mnt::r -v /var/empty:web/certs:r` mounts the server folder `/mn
|
|
637
637
|
|
638
638
|
the example config file right above this section may explain this better; the first volume `/` is mapped to `/srv` which means http://127.0.0.1:3923/music would try to read `/srv/music` on the server filesystem, but since there's another volume at `/music` mapped to `/mnt/music` then it'll go to `/mnt/music` instead
|
639
639
|
|
640
|
+
> ℹ️ this also works for single files, because files can also be volumes
|
641
|
+
|
640
642
|
|
641
643
|
## dotfiles
|
642
644
|
|
@@ -1494,6 +1496,7 @@ and some minor issues,
|
|
1494
1496
|
* win10 onwards does not allow connecting anonymously / without accounts
|
1495
1497
|
* python3 only
|
1496
1498
|
* slow (the builtin webdav support in windows is 5x faster, and rclone-webdav is 30x faster)
|
1499
|
+
* those numbers are specifically for copyparty's smb-server (because it sucks); other smb-servers should be similar to webdav
|
1497
1500
|
|
1498
1501
|
known client bugs:
|
1499
1502
|
* on win7 only, `--smb1` is much faster than smb2 (default) because it keeps rescanning folders on smb2
|
@@ -2679,9 +2682,16 @@ NOTE: full bidirectional sync, like what [nextcloud](https://docs.nextcloud.com/
|
|
2679
2682
|
|
2680
2683
|
the commandline uploader [u2c.py](https://github.com/9001/copyparty/tree/hovudstraum/bin#u2cpy) with `--dr` is the best way to sync a folder to copyparty; verifies checksums and does files in parallel, and deletes unexpected files on the server after upload has finished which makes file-renames really cheap (it'll rename serverside and skip uploading)
|
2681
2684
|
|
2685
|
+
if you want to sync with `u2c.py` then:
|
2686
|
+
* the `e2dsa` option (either globally or volflag) must be enabled on the server for the volumes you're syncing into
|
2687
|
+
* ...but DON'T enable global-options `no-hash` or `no-idx` (or volflags `nohash` / `noidx`), or at least make sure they are configured so they do not affect anything you are syncing into
|
2688
|
+
* ...and u2c needs the delete-permission, so either `rwd` at minimum, or just `A` which is the same as `rwmd.a`
|
2689
|
+
* quick reminder that `a` and `A` are different permissions, and `.` is very useful for sync
|
2690
|
+
|
2682
2691
|
alternatively there is [rclone](./docs/rclone.md) which allows for bidirectional sync and is *way* more flexible (stream files straight from sftp/s3/gcs to copyparty, ...), although there is no integrity check and it won't work with files over 100 MiB if copyparty is behind cloudflare
|
2683
2692
|
|
2684
2693
|
* starting from rclone v1.63, rclone is faster than u2c.py on low-latency connections
|
2694
|
+
* but this is only true for the initial upload; u2c will be faster for periodic syncing
|
2685
2695
|
|
2686
2696
|
|
2687
2697
|
## mount as drive
|
@@ -572,6 +572,8 @@ for example `-v /mnt::r -v /var/empty:web/certs:r` mounts the server folder `/mn
|
|
572
572
|
|
573
573
|
the example config file right above this section may explain this better; the first volume `/` is mapped to `/srv` which means http://127.0.0.1:3923/music would try to read `/srv/music` on the server filesystem, but since there's another volume at `/music` mapped to `/mnt/music` then it'll go to `/mnt/music` instead
|
574
574
|
|
575
|
+
> ℹ️ this also works for single files, because files can also be volumes
|
576
|
+
|
575
577
|
|
576
578
|
## dotfiles
|
577
579
|
|
@@ -1429,6 +1431,7 @@ and some minor issues,
|
|
1429
1431
|
* win10 onwards does not allow connecting anonymously / without accounts
|
1430
1432
|
* python3 only
|
1431
1433
|
* slow (the builtin webdav support in windows is 5x faster, and rclone-webdav is 30x faster)
|
1434
|
+
* those numbers are specifically for copyparty's smb-server (because it sucks); other smb-servers should be similar to webdav
|
1432
1435
|
|
1433
1436
|
known client bugs:
|
1434
1437
|
* on win7 only, `--smb1` is much faster than smb2 (default) because it keeps rescanning folders on smb2
|
@@ -2614,9 +2617,16 @@ NOTE: full bidirectional sync, like what [nextcloud](https://docs.nextcloud.com/
|
|
2614
2617
|
|
2615
2618
|
the commandline uploader [u2c.py](https://github.com/9001/copyparty/tree/hovudstraum/bin#u2cpy) with `--dr` is the best way to sync a folder to copyparty; verifies checksums and does files in parallel, and deletes unexpected files on the server after upload has finished which makes file-renames really cheap (it'll rename serverside and skip uploading)
|
2616
2619
|
|
2620
|
+
if you want to sync with `u2c.py` then:
|
2621
|
+
* the `e2dsa` option (either globally or volflag) must be enabled on the server for the volumes you're syncing into
|
2622
|
+
* ...but DON'T enable global-options `no-hash` or `no-idx` (or volflags `nohash` / `noidx`), or at least make sure they are configured so they do not affect anything you are syncing into
|
2623
|
+
* ...and u2c needs the delete-permission, so either `rwd` at minimum, or just `A` which is the same as `rwmd.a`
|
2624
|
+
* quick reminder that `a` and `A` are different permissions, and `.` is very useful for sync
|
2625
|
+
|
2617
2626
|
alternatively there is [rclone](./docs/rclone.md) which allows for bidirectional sync and is *way* more flexible (stream files straight from sftp/s3/gcs to copyparty, ...), although there is no integrity check and it won't work with files over 100 MiB if copyparty is behind cloudflare
|
2618
2627
|
|
2619
2628
|
* starting from rclone v1.63, rclone is faster than u2c.py on low-latency connections
|
2629
|
+
* but this is only true for the initial upload; u2c will be faster for periodic syncing
|
2620
2630
|
|
2621
2631
|
|
2622
2632
|
## mount as drive
|
@@ -190,35 +190,41 @@ def init_E(EE ) :
|
|
190
190
|
(unicode, "/tmp"),
|
191
191
|
]
|
192
192
|
errs = []
|
193
|
-
for
|
194
|
-
|
195
|
-
|
193
|
+
for npath, (pf, pa) in enumerate(paths):
|
194
|
+
p = ""
|
195
|
+
try:
|
196
|
+
p = pf(pa)
|
197
|
+
if not p or p.startswith("~"):
|
198
|
+
continue
|
199
|
+
|
200
|
+
p = os.path.normpath(p)
|
201
|
+
mkdir = not os.path.isdir(p)
|
202
|
+
if mkdir:
|
203
|
+
os.mkdir(p)
|
204
|
+
|
205
|
+
p = os.path.join(p, "copyparty")
|
196
206
|
try:
|
197
|
-
p
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
except Exception as ex:
|
219
|
-
if p and npath < 2:
|
220
|
-
t = "Unable to store config in [%s] due to %r"
|
221
|
-
errs.append(t % (p, ex))
|
207
|
+
os.listdir(p)
|
208
|
+
except:
|
209
|
+
os.mkdir(p)
|
210
|
+
|
211
|
+
if npath > 1:
|
212
|
+
t = "Using %s/copyparty [%s] for config; filekeys/dirkeys will change on every restart. Consider setting XDG_CONFIG_HOME or giving the unix-user a ~/.config/"
|
213
|
+
errs.append(t % (pa, p))
|
214
|
+
elif mkdir:
|
215
|
+
t = "Using %s/copyparty [%s] for config%s (Warning: %s did not exist and was created just now)"
|
216
|
+
errs.append(t % (pa, p, " instead" if npath else "", pa))
|
217
|
+
elif errs:
|
218
|
+
errs.append("Using %s/copyparty [%s] instead" % (pa, p))
|
219
|
+
|
220
|
+
if errs:
|
221
|
+
warn(". ".join(errs))
|
222
|
+
|
223
|
+
return p # type: ignore
|
224
|
+
except Exception as ex:
|
225
|
+
if p and npath < 2:
|
226
|
+
t = "Unable to store config in %s [%s] due to %r"
|
227
|
+
errs.append(t % (pa, p, ex))
|
222
228
|
|
223
229
|
raise Exception("could not find a writable path for config")
|
224
230
|
|
@@ -662,6 +668,42 @@ def get_sects():
|
|
662
668
|
"""
|
663
669
|
),
|
664
670
|
],
|
671
|
+
[
|
672
|
+
"auth-ord",
|
673
|
+
"authentication precedence",
|
674
|
+
dedent(
|
675
|
+
"""
|
676
|
+
\033[33m--auth-ord\033[0m is a comma-separated list of auth options
|
677
|
+
(one or more of the [\033[35moptions\033[0m] below); first one wins
|
678
|
+
|
679
|
+
[\033[35mpw\033[0m] is conventional login, for example the "\033[36mPW\033[0m" header,
|
680
|
+
or the \033[36m?pw=\033[0m[...] URL-suffix, or a valid session cookie
|
681
|
+
(see \033[33m--help-auth\033[0m)
|
682
|
+
|
683
|
+
[\033[35midp\033[0m] is a username provided in the http-request-header
|
684
|
+
defined by \033[33m--idp-h-usr\033[0m and/or \033[33m--idp-hm-usr\033[0m, which is
|
685
|
+
provided by an authentication middleware such as
|
686
|
+
authentik, authelia, tailscale, ... (see \033[33m--help-idp\033[0m)
|
687
|
+
|
688
|
+
[\033[35midp-h\033[0m] is specifically an \033[33m--idp-h-usr\033[0m header,
|
689
|
+
[\033[35midp-hm\033[0m] is specifically an \033[33m--idp-hm-usr\033[0m header;
|
690
|
+
[\033[35midp\033[0m] is the same as [\033[35midp-hm,idp-h\033[0m]
|
691
|
+
|
692
|
+
[\033[35mipu\033[0m] is a mapping from an IP-address to a username,
|
693
|
+
auto-authing that client-IP to that account
|
694
|
+
(see the description of \033[36m--ipu\033[0m in \033[33m--help\033[0m)
|
695
|
+
|
696
|
+
NOTE: even if an option (\033[35mpw\033[0m/\033[35mipu\033[0m/...) is not in the list,
|
697
|
+
it may still be enabled and can still take effect if
|
698
|
+
none of the other alternatives identify the user
|
699
|
+
|
700
|
+
NOTE: if [\033[35mipu\033[0m] is in the list, it must be FIRST or LAST
|
701
|
+
|
702
|
+
NOTE: if [\033[35mpw\033[0m] is not in the list, the logout-button
|
703
|
+
will be hidden when any idp feature is enabled
|
704
|
+
"""
|
705
|
+
),
|
706
|
+
],
|
665
707
|
[
|
666
708
|
"flags",
|
667
709
|
"list of volflags",
|
@@ -1084,6 +1126,7 @@ def add_general(ap, nc, srvname):
|
|
1084
1126
|
ap2.add_argument("-v", metavar="VOL", type=u, action="append", help="\033[34mREPEATABLE:\033[0m add volume, \033[33mSRC\033[0m:\033[33mDST\033[0m:\033[33mFLAG\033[0m; examples [\033[32m.::r\033[0m], [\033[32m/mnt/nas/music:/music:r:aed\033[0m], see --help-accounts")
|
1085
1127
|
ap2.add_argument("--grp", metavar="G:N,N", type=u, action="append", help="\033[34mREPEATABLE:\033[0m add group, \033[33mNAME\033[0m:\033[33mUSER1\033[0m,\033[33mUSER2\033[0m,\033[33m...\033[0m; example [\033[32madmins:ed,foo,bar\033[0m]")
|
1086
1128
|
ap2.add_argument("--usernames", action="store_true", help="require username and password for login; default is just password")
|
1129
|
+
ap2.add_argument("--chdir", metavar="PATH", type=u, help="change working-directory to \033[33mPATH\033[0m before mapping volumes")
|
1087
1130
|
ap2.add_argument("-ed", action="store_true", help="enable the ?dots url parameter / client option which allows clients to see dotfiles / hidden files (volflag=dots)")
|
1088
1131
|
ap2.add_argument("--urlform", metavar="MODE", type=u, default="print,xm", help="how to handle url-form POSTs; see \033[33m--help-urlform\033[0m")
|
1089
1132
|
ap2.add_argument("--wintitle", metavar="TXT", type=u, default="cpp @ $pub", help="server terminal title, for example [\033[32m$ip-10.1.2.\033[0m] or [\033[32m$ip-]")
|
@@ -1107,6 +1150,8 @@ def add_qr(ap, tty):
|
|
1107
1150
|
ap2.add_argument("--qrz", metavar="N", type=int, default=0, help="[\033[32m1\033[0m]=1x, [\033[32m2\033[0m]=2x, [\033[32m0\033[0m]=auto (try [\033[32m2\033[0m] on broken fonts)")
|
1108
1151
|
ap2.add_argument("--qr-pin", metavar="N", type=int, default=0, help="sticky/pin the qr-code to always stay on-screen; [\033[32m0\033[0m]=disabled, [\033[32m1\033[0m]=with-url, [\033[32m2\033[0m]=just-qr")
|
1109
1152
|
ap2.add_argument("--qr-wait", metavar="SEC", type=float, default=0, help="wait \033[33mSEC\033[0m before printing the qr-code to the log")
|
1153
|
+
ap2.add_argument("--qr-every", metavar="SEC", type=float, default=0, help="print the qr-code every \033[33mSEC\033[0m (try this with/without --qr-pin in case of issues)")
|
1154
|
+
ap2.add_argument("--qr-winch", metavar="SEC", type=float, default=0, help="when --qr-pin is enabled, check for terminal size change every \033[33mSEC\033[0m")
|
1110
1155
|
ap2.add_argument("--qr-file", metavar="TXT", type=u, action="append", help="\033[34mREPEATABLE:\033[0m write qr-code to file.\n └─To create txt or svg, \033[33mTXT\033[0m is Filepath:Zoom:Pad, for example [\033[32mqr.txt:1:2\033[0m]\n └─To create png or gif, \033[33mTXT\033[0m is Filepath:Zoom:Pad:Foreground:Background, for example [\033[32mqr.png:8:2:333333:ffcc55\033[0m], or [\033[32mqr.png:8:2::ffcc55\033[0m] for transparent")
|
1111
1156
|
|
1112
1157
|
|
@@ -1232,7 +1277,7 @@ def add_auth(ap):
|
|
1232
1277
|
ses_db = os.path.join(E.cfg, "sessions.db")
|
1233
1278
|
ap2 = ap.add_argument_group("IdP / identity provider / user authentication options")
|
1234
1279
|
ap2.add_argument("--idp-h-usr", metavar="HN", type=u, action="append", help="\033[34mREPEATABLE:\033[0m bypass the copyparty authentication checks if the request-header \033[33mHN\033[0m contains a username to associate the request with (for use with authentik/oauth/...)\n\033[1;31mWARNING:\033[0m if you enable this, make sure clients are unable to specify this header themselves; must be washed away and replaced by a reverse-proxy")
|
1235
|
-
ap2.add_argument("--idp-hm-usr", metavar="
|
1280
|
+
ap2.add_argument("--idp-hm-usr", metavar="T", type=u, action="append", help="\033[34mREPEATABLE:\033[0m bypass the copyparty authentication checks if the request-header \033[33mT\033[0m is provided, and its value exists in a mapping defined by this option; see --help-idp")
|
1236
1281
|
ap2.add_argument("--idp-h-grp", metavar="HN", type=u, default="", help="assume the request-header \033[33mHN\033[0m contains the groupname of the requesting user; can be referenced in config files for group-based access control")
|
1237
1282
|
ap2.add_argument("--idp-h-key", metavar="HN", type=u, default="", help="optional but recommended safeguard; your reverse-proxy will insert a secret header named \033[33mHN\033[0m into all requests, and the other IdP headers will be ignored if this header is not present")
|
1238
1283
|
ap2.add_argument("--idp-gsep", metavar="RE", type=u, default="|:;+,", help="if there are multiple groups in \033[33m--idp-h-grp\033[0m, they are separated by one of the characters in \033[33mRE\033[0m")
|
@@ -1240,6 +1285,7 @@ def add_auth(ap):
|
|
1240
1285
|
ap2.add_argument("--idp-store", metavar="N", type=int, default=1, help="how to use \033[33m--idp-db\033[0m; [\033[32m0\033[0m] = entirely disable, [\033[32m1\033[0m] = write-only (effectively disabled), [\033[32m2\033[0m] = remember users, [\033[32m3\033[0m] = remember users and groups.\nNOTE: Will remember and restore the IdP-volumes of all users for all eternity if set to 2 or 3, even when user is deleted from your IdP")
|
1241
1286
|
ap2.add_argument("--idp-adm", metavar="U,U", type=u, default="", help="comma-separated list of users allowed to use /?idp (the cache management UI)")
|
1242
1287
|
ap2.add_argument("--idp-cookie", metavar="S", type=int, default=0, help="generate a session-token for IdP users which is written to cookie \033[33mcppws\033[0m (or \033[33mcppwd\033[0m if plaintext), to reduce the load on the IdP server, lifetime \033[33mS\033[0m seconds.\n └─note: The expiration time is a client hint only; the actual lifetime of the session-token is infinite (until next restart with \033[33m--ses-db\033[0m wiped)")
|
1288
|
+
ap2.add_argument("--auth-ord", metavar="TXT", type=u, default="idp,ipu", help="controls auth precedence; examples: [\033[32mpw,idp,ipu\033[0m], [\033[32mipu,pw,idp\033[0m], see --help-auth-ord")
|
1243
1289
|
ap2.add_argument("--no-bauth", action="store_true", help="disable basic-authentication support; do not accept passwords from the 'Authenticate' header at all. NOTE: This breaks support for the android app")
|
1244
1290
|
ap2.add_argument("--bauth-last", action="store_true", help="keeps basic-authentication enabled, but only as a last-resort; if a cookie is also provided then the cookie wins")
|
1245
1291
|
ap2.add_argument("--ses-db", metavar="PATH", type=u, default=ses_db, help="where to store the sessions database (if you run multiple copyparty instances, make sure they use different DBs)")
|
@@ -1250,6 +1296,10 @@ def add_auth(ap):
|
|
1250
1296
|
ap2.add_argument("--ipr", metavar="CIDR=USR", type=u, action="append", help="\033[34mREPEATABLE:\033[0m username \033[33mUSR\033[0m can only connect from an IP matching one or more \033[33mCIDR\033[0m (comma-sep.); example: [\033[32m192.168.123.0/24,172.16.0.0/16=dave]")
|
1251
1297
|
ap2.add_argument("--have-idp-hdrs", type=u, default="", help=argparse.SUPPRESS)
|
1252
1298
|
ap2.add_argument("--have-ipu-or-ipr", type=u, default="", help=argparse.SUPPRESS)
|
1299
|
+
ap2.add_argument("--ao-idp-before-pw", type=u, default="", help=argparse.SUPPRESS)
|
1300
|
+
ap2.add_argument("--ao-h-before-hm", type=u, default="", help=argparse.SUPPRESS)
|
1301
|
+
ap2.add_argument("--ao-ipu-wins", type=u, default="", help=argparse.SUPPRESS)
|
1302
|
+
ap2.add_argument("--ao-has-pw", type=u, default="", help=argparse.SUPPRESS)
|
1253
1303
|
|
1254
1304
|
|
1255
1305
|
def add_chpw(ap):
|
@@ -1489,6 +1539,7 @@ def add_logging(ap):
|
|
1489
1539
|
ap2.add_argument("--log-utc", action="store_true", help="do not use local timezone; assume the TZ env-var is UTC (tiny bit faster)")
|
1490
1540
|
ap2.add_argument("--log-tdec", metavar="N", type=int, default=3, help="timestamp resolution / number of timestamp decimals")
|
1491
1541
|
ap2.add_argument("--log-badpwd", metavar="N", type=int, default=2, help="log failed login attempt passwords: 0=terse, 1=plaintext, 2=hashed")
|
1542
|
+
ap2.add_argument("--log-badxml", action="store_true", help="log any invalid XML received from a client")
|
1492
1543
|
ap2.add_argument("--log-conn", action="store_true", help="debug: print tcp-server msgs")
|
1493
1544
|
ap2.add_argument("--log-htp", action="store_true", help="debug: print http-server threadpool scaling")
|
1494
1545
|
ap2.add_argument("--ihead", metavar="HEADER", type=u, action='append', help="print request \033[33mHEADER\033[0m; [\033[32m*\033[0m]=all")
|
@@ -1626,6 +1677,7 @@ def add_db_metadata(ap):
|
|
1626
1677
|
|
1627
1678
|
def add_txt(ap):
|
1628
1679
|
ap2 = ap.add_argument_group("textfile options")
|
1680
|
+
ap2.add_argument("--md-no-br", action="store_true", help="markdown: disable newline-is-newline; will only render a newline into the html given two trailing spaces or a double-newline (volflag=md_no_br)")
|
1629
1681
|
ap2.add_argument("--md-hist", metavar="TXT", type=u, default="s", help="where to store old version of markdown files; [\033[32ms\033[0m]=subfolder, [\033[32mv\033[0m]=volume-histpath, [\033[32mn\033[0m]=nope/disabled (volflag=md_hist)")
|
1630
1682
|
ap2.add_argument("--txt-eol", metavar="TYPE", type=u, default="", help="enable EOL conversion when writing documents; supported: CRLF, LF (volflag=txt_eol)")
|
1631
1683
|
ap2.add_argument("-mcr", metavar="SEC", type=int, default=60, help="the textfile editor will check for serverside changes every \033[33mSEC\033[0m seconds")
|
@@ -1932,6 +1984,9 @@ def main(argv = None) :
|
|
1932
1984
|
except:
|
1933
1985
|
sys.exit(1)
|
1934
1986
|
|
1987
|
+
if al.chdir:
|
1988
|
+
os.chdir(al.chdir)
|
1989
|
+
|
1935
1990
|
if al.ansi:
|
1936
1991
|
al.no_ansi = False
|
1937
1992
|
elif not al.no_ansi:
|
@@ -1959,7 +2014,7 @@ def main(argv = None) :
|
|
1959
2014
|
if not HAVE_IPV6 and al.i == "::":
|
1960
2015
|
al.i = "0.0.0.0"
|
1961
2016
|
|
1962
|
-
al.i = al.i.split(",")
|
2017
|
+
al.i = [x.strip() for x in al.i.split(",")]
|
1963
2018
|
try:
|
1964
2019
|
if "-" in al.p:
|
1965
2020
|
lo, hi = [int(x) for x in al.p.split("-")]
|
@@ -1651,6 +1651,7 @@ class AuthSrv(object):
|
|
1651
1651
|
# accept both , and : as separators between usernames
|
1652
1652
|
zs1, zs2 = x.replace("=", ":").split(":", 1)
|
1653
1653
|
grps[zs1] = zs2.replace(":", ",").split(",")
|
1654
|
+
grps[zs1] = [x.strip() for x in grps[zs1]]
|
1654
1655
|
except:
|
1655
1656
|
t = '\n invalid value "{}" for argument --grp, must be groupname:username1,username2,...'
|
1656
1657
|
raise Exception(t.format(x))
|
@@ -1704,6 +1705,7 @@ class AuthSrv(object):
|
|
1704
1705
|
|
1705
1706
|
self.args.have_idp_hdrs = bool(self.args.idp_h_usr or self.args.idp_hm_usr)
|
1706
1707
|
self.args.have_ipu_or_ipr = bool(self.args.ipu or self.args.ipr)
|
1708
|
+
self.setup_auth_ord()
|
1707
1709
|
|
1708
1710
|
self.setup_pwhash(acct)
|
1709
1711
|
defpw = acct.copy()
|
@@ -2802,7 +2804,8 @@ class AuthSrv(object):
|
|
2802
2804
|
"have_mv": not self.args.no_mv,
|
2803
2805
|
"have_del": not self.args.no_del,
|
2804
2806
|
"have_unpost": int(self.args.unpost),
|
2805
|
-
"have_emp": self.args.emp,
|
2807
|
+
"have_emp": int(self.args.emp),
|
2808
|
+
"md_no_br": int(vf.get("md_no_br") or 0),
|
2806
2809
|
"ext_th": vf.get("ext_th_d") or {},
|
2807
2810
|
"sb_md": "" if "no_sb_md" in vf else (vf.get("md_sbf") or "y"),
|
2808
2811
|
"sba_md": vf.get("md_sba") or "",
|
@@ -2852,6 +2855,18 @@ class AuthSrv(object):
|
|
2852
2855
|
zs = str(vol.flags.get("tcolor") or self.args.tcolor)
|
2853
2856
|
vol.flags["tcolor"] = zs.lstrip("#")
|
2854
2857
|
|
2858
|
+
def setup_auth_ord(self) :
|
2859
|
+
ao = [x.strip() for x in self.args.auth_ord.split(",")]
|
2860
|
+
if "idp" in ao:
|
2861
|
+
zi = ao.index("idp")
|
2862
|
+
ao = ao[:zi] + ["idp-hm", "idp-h"] + ao[zi:]
|
2863
|
+
zsl = "pw idp-h idp-hm ipu".split()
|
2864
|
+
pw, h, hm, ipu = [ao.index(x) if x in ao else 99 for x in zsl]
|
2865
|
+
self.args.ao_idp_before_pw = min(h, hm) < pw
|
2866
|
+
self.args.ao_h_before_hm = h < hm
|
2867
|
+
self.args.ao_ipu_wins = ipu == 0
|
2868
|
+
self.args.ao_have_pw = pw < 99
|
2869
|
+
|
2855
2870
|
def load_idp_db(self, quiet=False) :
|
2856
2871
|
# mutex me
|
2857
2872
|
level = self.args.idp_store
|
@@ -126,6 +126,7 @@ def _gen_srv(log , args, netdevs ):
|
|
126
126
|
nlog = lambda msg, c=0: log("cert-gen-srv", msg, c)
|
127
127
|
|
128
128
|
names = args.crt_ns.split(",") if args.crt_ns else []
|
129
|
+
names = [x.strip() for x in names]
|
129
130
|
if not args.crt_exact:
|
130
131
|
for n in names[:]:
|
131
132
|
names.append("*.{}".format(n))
|
@@ -44,6 +44,7 @@ def vf_bmap() :
|
|
44
44
|
"gsel",
|
45
45
|
"hardlink",
|
46
46
|
"magic",
|
47
|
+
"md_no_br",
|
47
48
|
"no_db_ip",
|
48
49
|
"no_sb_md",
|
49
50
|
"no_sb_lg",
|
@@ -324,6 +325,7 @@ flagcats = {
|
|
324
325
|
"og_ua": "if defined: only send OG html if useragent matches this regex",
|
325
326
|
},
|
326
327
|
"textfiles": {
|
328
|
+
"md_no_br": "newline only on double-newline or two tailing spaces",
|
327
329
|
"md_hist": "where to put markdown backups; s=subfolder, v=volHist, n=nope",
|
328
330
|
"exp": "enable textfile expansion; see --help-exp",
|
329
331
|
"exp_md": "placeholders to expand in markdown files; see --help",
|
@@ -382,7 +382,7 @@ class FtpFs(AbstractedFS):
|
|
382
382
|
svp = join(self.cwd, src).lstrip("/")
|
383
383
|
dvp = join(self.cwd, dst).lstrip("/")
|
384
384
|
try:
|
385
|
-
self.hub.up2k.handle_mv(self.uname, self.h.cli_ip, svp, dvp)
|
385
|
+
self.hub.up2k.handle_mv("", self.uname, self.h.cli_ip, svp, dvp)
|
386
386
|
except Exception as ex:
|
387
387
|
raise FSE(str(ex))
|
388
388
|
|
@@ -12,7 +12,6 @@ import random
|
|
12
12
|
import re
|
13
13
|
import socket
|
14
14
|
import stat
|
15
|
-
import string
|
16
15
|
import sys
|
17
16
|
import threading # typechk
|
18
17
|
import time
|
@@ -31,7 +30,7 @@ try:
|
|
31
30
|
except:
|
32
31
|
pass
|
33
32
|
|
34
|
-
from .__init__ import ANYWIN,
|
33
|
+
from .__init__ import ANYWIN, RES, TYPE_CHECKING, EnvParams, unicode
|
35
34
|
from .__version__ import S_VERSION
|
36
35
|
from .authsrv import LEELOO_DALLAS, VFS # typechk
|
37
36
|
from .bos import bos
|
@@ -66,6 +65,7 @@ from .util import (
|
|
66
65
|
exclude_dotfiles,
|
67
66
|
formatdate,
|
68
67
|
fsenc,
|
68
|
+
gen_content_disposition,
|
69
69
|
gen_filekey,
|
70
70
|
gen_filekey_dbg,
|
71
71
|
gencookie,
|
@@ -619,7 +619,9 @@ class HttpCli(object):
|
|
619
619
|
or "*"
|
620
620
|
)
|
621
621
|
|
622
|
-
if self.args.have_idp_hdrs
|
622
|
+
if self.args.have_idp_hdrs and (
|
623
|
+
self.uname == "*" or self.args.ao_idp_before_pw
|
624
|
+
):
|
623
625
|
idp_usr = ""
|
624
626
|
if self.args.idp_hm_usr:
|
625
627
|
for hn, hmv in self.args.idp_hm_usr_p.items():
|
@@ -632,9 +634,9 @@ class HttpCli(object):
|
|
632
634
|
if idp_usr:
|
633
635
|
break
|
634
636
|
for hn in self.args.idp_h_usr:
|
635
|
-
if idp_usr:
|
637
|
+
if idp_usr and not self.args.ao_h_before_hm:
|
636
638
|
break
|
637
|
-
idp_usr = self.headers.get(hn)
|
639
|
+
idp_usr = self.headers.get(hn) or idp_usr
|
638
640
|
if idp_usr:
|
639
641
|
idp_grp = (
|
640
642
|
self.headers.get(self.args.idp_h_grp) or ""
|
@@ -683,7 +685,10 @@ class HttpCli(object):
|
|
683
685
|
if idp_usr in self.asrv.vfs.aread:
|
684
686
|
self.pw = ""
|
685
687
|
self.uname = idp_usr
|
686
|
-
self.
|
688
|
+
if self.args.ao_have_pw:
|
689
|
+
self.html_head += "<script>var is_idp=1</script>\n"
|
690
|
+
else:
|
691
|
+
self.html_head += "<script>var is_idp=2</script>\n"
|
687
692
|
zs = self.asrv.ases.get(idp_usr)
|
688
693
|
if zs:
|
689
694
|
self.set_idp_cookie(zs)
|
@@ -691,7 +696,7 @@ class HttpCli(object):
|
|
691
696
|
self.log("unknown username: %r" % (idp_usr,), 1)
|
692
697
|
|
693
698
|
if self.args.have_ipu_or_ipr:
|
694
|
-
if self.args.ipu and self.uname == "*":
|
699
|
+
if self.args.ipu and (self.uname == "*" or self.args.ao_ipu_wins):
|
695
700
|
self.uname = self.conn.ipu_iu[self.conn.ipu_nm.map(self.ip)]
|
696
701
|
ipr = self.conn.hsrv.ipr
|
697
702
|
if ipr and self.uname in ipr:
|
@@ -809,6 +814,15 @@ class HttpCli(object):
|
|
809
814
|
6 if em.startswith("client d/c ") else 3,
|
810
815
|
)
|
811
816
|
|
817
|
+
if self.hint and self.hint.startswith("<xml> "):
|
818
|
+
if self.args.log_badxml:
|
819
|
+
t = "invalid XML received from client: %r"
|
820
|
+
self.log(t % (self.hint[6:],), 6)
|
821
|
+
else:
|
822
|
+
t = "received invalid XML from client; enable --log-badxml to see the whole XML in the log"
|
823
|
+
self.log(t, 6)
|
824
|
+
self.hint = ""
|
825
|
+
|
812
826
|
msg = "%s\r\nURL: %s\r\n" % (em, self.vpath)
|
813
827
|
if self.hint:
|
814
828
|
msg += "hint: %s\r\n" % (self.hint,)
|
@@ -1525,7 +1539,9 @@ class HttpCli(object):
|
|
1525
1539
|
if not rbuf or len(buf) >= 32768:
|
1526
1540
|
break
|
1527
1541
|
|
1528
|
-
|
1542
|
+
sbuf = buf.decode(enc, "replace")
|
1543
|
+
self.hint = "<xml> " + sbuf
|
1544
|
+
xroot = parse_xml(sbuf)
|
1529
1545
|
xtag = next((x for x in xroot if x.tag.split("}")[-1] == "prop"), None)
|
1530
1546
|
if xtag is not None:
|
1531
1547
|
props = set([y.tag.split("}")[-1] for y in xtag])
|
@@ -1731,6 +1747,7 @@ class HttpCli(object):
|
|
1731
1747
|
uenc = enc.upper()
|
1732
1748
|
|
1733
1749
|
txt = buf.decode(enc, "replace")
|
1750
|
+
self.hint = "<xml> " + txt
|
1734
1751
|
ET.register_namespace("D", "DAV:")
|
1735
1752
|
xroot = mkenod("D:orz")
|
1736
1753
|
xroot.insert(0, parse_xml(txt))
|
@@ -1788,6 +1805,7 @@ class HttpCli(object):
|
|
1788
1805
|
uenc = enc.upper()
|
1789
1806
|
|
1790
1807
|
txt = buf.decode(enc, "replace")
|
1808
|
+
self.hint = "<xml> " + txt
|
1791
1809
|
ET.register_namespace("D", "DAV:")
|
1792
1810
|
lk = parse_xml(txt)
|
1793
1811
|
assert lk.tag == "{DAV:}lockinfo"
|
@@ -3995,6 +4013,13 @@ class HttpCli(object):
|
|
3995
4013
|
if not editions:
|
3996
4014
|
return self.tx_404()
|
3997
4015
|
|
4016
|
+
#
|
4017
|
+
# force download
|
4018
|
+
|
4019
|
+
if "dl" in self.ouparam:
|
4020
|
+
cdis = gen_content_disposition(os.path.basename(req_path))
|
4021
|
+
self.out_headers["Content-Disposition"] = cdis
|
4022
|
+
|
3998
4023
|
#
|
3999
4024
|
# if-modified
|
4000
4025
|
|
@@ -4162,6 +4187,13 @@ class HttpCli(object):
|
|
4162
4187
|
if not editions:
|
4163
4188
|
return self.tx_404()
|
4164
4189
|
|
4190
|
+
#
|
4191
|
+
# force download
|
4192
|
+
|
4193
|
+
if "dl" in self.ouparam:
|
4194
|
+
cdis = gen_content_disposition(os.path.basename(req_path))
|
4195
|
+
self.out_headers["Content-Disposition"] = cdis
|
4196
|
+
|
4165
4197
|
#
|
4166
4198
|
# if-modified
|
4167
4199
|
|
@@ -4707,24 +4739,7 @@ class HttpCli(object):
|
|
4707
4739
|
if maxn < nf:
|
4708
4740
|
raise Pebkac(400, t)
|
4709
4741
|
|
4710
|
-
|
4711
|
-
afn = "".join([x if x in safe.replace('"', "") else "_" for x in fn])
|
4712
|
-
bascii = unicode(safe).encode("utf-8")
|
4713
|
-
zb = fn.encode("utf-8", "xmlcharrefreplace")
|
4714
|
-
if not PY2:
|
4715
|
-
zbl = [
|
4716
|
-
chr(x).encode("utf-8")
|
4717
|
-
if x in bascii
|
4718
|
-
else "%{:02x}".format(x).encode("ascii")
|
4719
|
-
for x in zb
|
4720
|
-
]
|
4721
|
-
else:
|
4722
|
-
zbl = [unicode(x) if x in bascii else "%{:02x}".format(ord(x)) for x in zb]
|
4723
|
-
|
4724
|
-
ufn = b"".join(zbl).decode("ascii")
|
4725
|
-
|
4726
|
-
cdis = "attachment; filename=\"{}.{}\"; filename*=UTF-8''{}.{}"
|
4727
|
-
cdis = cdis.format(afn, ext, ufn, ext)
|
4742
|
+
cdis = gen_content_disposition("%s.%s" % (fn, ext))
|
4728
4743
|
self.log(repr(cdis))
|
4729
4744
|
self.send_headers(None, mime=mime, headers={"Content-Disposition": cdis})
|
4730
4745
|
|
@@ -4911,7 +4926,8 @@ class HttpCli(object):
|
|
4911
4926
|
"lastmod": int(ts_md * 1000),
|
4912
4927
|
"lang": self.args.lang,
|
4913
4928
|
"favico": self.args.favico,
|
4914
|
-
"have_emp": self.args.emp,
|
4929
|
+
"have_emp": int(self.args.emp),
|
4930
|
+
"md_no_br": int(vn.flags.get("md_no_br") or 0),
|
4915
4931
|
"md_chk_rate": self.args.mcr,
|
4916
4932
|
"md": boundary,
|
4917
4933
|
"arg_base": arg_base,
|
@@ -27,7 +27,7 @@ from .stolen.dnslib import (
|
|
27
27
|
DNSRecord,
|
28
28
|
set_avahi_379,
|
29
29
|
)
|
30
|
-
from .util import CachedSet, Daemon, Netdev, list_ips, min_ex
|
30
|
+
from .util import IP6_LL, CachedSet, Daemon, Netdev, list_ips, min_ex
|
31
31
|
|
32
32
|
if TYPE_CHECKING:
|
33
33
|
from .svchub import SvcHub
|
@@ -371,7 +371,7 @@ class MDNS(MCast):
|
|
371
371
|
cip = addr[0]
|
372
372
|
v6 = ":" in cip
|
373
373
|
if (cip.startswith("169.254") and not self.ll_ok) or (
|
374
|
-
v6 and not cip.startswith(
|
374
|
+
v6 and not cip.startswith(IP6_LL)
|
375
375
|
):
|
376
376
|
return
|
377
377
|
|
@@ -15,7 +15,7 @@ from ipaddress import (
|
|
15
15
|
)
|
16
16
|
|
17
17
|
from .__init__ import MACOS, TYPE_CHECKING
|
18
|
-
from .util import Daemon, Netdev, find_prefix, min_ex, spack
|
18
|
+
from .util import IP6_LL, IP64_LL, Daemon, Netdev, find_prefix, min_ex, spack
|
19
19
|
|
20
20
|
if TYPE_CHECKING:
|
21
21
|
from .svchub import SvcHub
|
@@ -142,7 +142,7 @@ class MCast(object):
|
|
142
142
|
all_selected = ips[:]
|
143
143
|
|
144
144
|
# discard non-linklocal ipv6
|
145
|
-
ips = [x for x in ips if ":" not in x or x.startswith(
|
145
|
+
ips = [x for x in ips if ":" not in x or x.startswith(IP6_LL)]
|
146
146
|
|
147
147
|
if not ips:
|
148
148
|
raise NoIPs()
|
@@ -180,7 +180,7 @@ class MCast(object):
|
|
180
180
|
srv.ips[oth_ip.split("/")[0]] = ipaddress.ip_network(oth_ip, False)
|
181
181
|
|
182
182
|
# gvfs breaks if a linklocal ip appears in a dns reply
|
183
|
-
ll = {k: v for k, v in srv.ips.items() if k.startswith(
|
183
|
+
ll = {k: v for k, v in srv.ips.items() if k.startswith(IP64_LL)}
|
184
184
|
rt = {k: v for k, v in srv.ips.items() if k not in ll}
|
185
185
|
|
186
186
|
if self.args.ll or not rt:
|
@@ -315,7 +315,7 @@ class SMB(object):
|
|
315
315
|
t = "blocked rename (no-move-acc %s): /%s @%s"
|
316
316
|
yeet(t % (vfs1.axs.umove, vp1, uname))
|
317
317
|
|
318
|
-
self.hub.up2k.handle_mv(uname, "1.7.6.2", vp1, vp2)
|
318
|
+
self.hub.up2k.handle_mv("", uname, "1.7.6.2", vp1, vp2)
|
319
319
|
try:
|
320
320
|
bos.makedirs(ap2, vf=vfs2.flags)
|
321
321
|
except:
|