copyparty 1.16.5__py3-none-any.whl → 1.16.7__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 +3 -0
- copyparty/__main__.py +4 -1
- copyparty/__version__.py +2 -2
- copyparty/authsrv.py +33 -20
- copyparty/fsutil.py +4 -4
- copyparty/httpcli.py +273 -83
- copyparty/httpsrv.py +6 -9
- copyparty/mtag.py +4 -4
- copyparty/smbd.py +1 -1
- copyparty/sutil.py +1 -1
- copyparty/tcpsrv.py +3 -3
- copyparty/tftpd.py +1 -1
- copyparty/th_cli.py +3 -3
- copyparty/th_srv.py +6 -6
- copyparty/u2idx.py +3 -3
- copyparty/up2k.py +92 -87
- copyparty/util.py +13 -13
- copyparty/web/a/u2c.py +1 -1
- copyparty/web/browser.html +1 -1
- copyparty/web/browser.js.gz +0 -0
- copyparty/web/md.html +2 -2
- copyparty/web/mde.html +2 -2
- copyparty/web/rups.css.gz +0 -0
- copyparty/web/rups.html +50 -0
- copyparty/web/rups.js.gz +0 -0
- copyparty/web/shares.css.gz +0 -0
- copyparty/web/shares.html +6 -3
- copyparty/web/splash.html +2 -1
- copyparty/web/splash.js.gz +0 -0
- copyparty/web/svcs.html +1 -1
- copyparty/web/up2k.js.gz +0 -0
- copyparty/web/util.js.gz +0 -0
- {copyparty-1.16.5.dist-info → copyparty-1.16.7.dist-info}/METADATA +14 -2
- {copyparty-1.16.5.dist-info → copyparty-1.16.7.dist-info}/RECORD +38 -35
- {copyparty-1.16.5.dist-info → copyparty-1.16.7.dist-info}/LICENSE +0 -0
- {copyparty-1.16.5.dist-info → copyparty-1.16.7.dist-info}/WHEEL +0 -0
- {copyparty-1.16.5.dist-info → copyparty-1.16.7.dist-info}/entry_points.txt +0 -0
- {copyparty-1.16.5.dist-info → copyparty-1.16.7.dist-info}/top_level.txt +0 -0
    
        copyparty/__init__.py
    CHANGED
    
    
    
        copyparty/__main__.py
    CHANGED
    
    | @@ -1242,7 +1242,6 @@ def add_optouts(ap): | |
| 1242 1242 | 
             
                ap2.add_argument("--no-zip", action="store_true", help="disable download as zip/tar")
         | 
| 1243 1243 | 
             
                ap2.add_argument("--no-tarcmp", action="store_true", help="disable download as compressed tar (?tar=gz, ?tar=bz2, ?tar=xz, ?tar=gz:9, ...)")
         | 
| 1244 1244 | 
             
                ap2.add_argument("--no-lifetime", action="store_true", help="do not allow clients (or server config) to schedule an upload to be deleted after a given time")
         | 
| 1245 | 
            -
                ap2.add_argument("--no-up-list", action="store_true", help="don't show list of incoming files in controlpanel")
         | 
| 1246 1245 | 
             
                ap2.add_argument("--no-pipe", action="store_true", help="disable race-the-beam (lockstep download of files which are currently being uploaded) (volflag=nopipe)")
         | 
| 1247 1246 | 
             
                ap2.add_argument("--no-db-ip", action="store_true", help="do not write uploader IPs into the database")
         | 
| 1248 1247 |  | 
| @@ -1318,7 +1317,10 @@ def add_admin(ap): | |
| 1318 1317 | 
             
                ap2.add_argument("--no-reload", action="store_true", help="disable ?reload=cfg (reload users/volumes/volflags from config file)")
         | 
| 1319 1318 | 
             
                ap2.add_argument("--no-rescan", action="store_true", help="disable ?scan (volume reindexing)")
         | 
| 1320 1319 | 
             
                ap2.add_argument("--no-stack", action="store_true", help="disable ?stack (list all stacks)")
         | 
| 1320 | 
            +
                ap2.add_argument("--no-ups-page", action="store_true", help="disable ?ru (list of recent uploads)")
         | 
| 1321 | 
            +
                ap2.add_argument("--no-up-list", action="store_true", help="don't show list of incoming files in controlpanel")
         | 
| 1321 1322 | 
             
                ap2.add_argument("--dl-list", metavar="LVL", type=int, default=2, help="who can see active downloads in the controlpanel? [\033[32m0\033[0m]=nobody, [\033[32m1\033[0m]=admins, [\033[32m2\033[0m]=everyone")
         | 
| 1323 | 
            +
                ap2.add_argument("--ups-when", action="store_true", help="let everyone see upload timestamps on the ?ru page, not just admins")
         | 
| 1322 1324 |  | 
| 1323 1325 |  | 
| 1324 1326 | 
             
            def add_thumbnail(ap):
         | 
| @@ -1497,6 +1499,7 @@ def add_debug(ap): | |
| 1497 1499 | 
             
                ap2.add_argument("--bf-nc", metavar="NUM", type=int, default=200, help="bak-flips: stop if there's more than \033[33mNUM\033[0m files at \033[33m--kf-dir\033[0m already; default: 6.3 GiB max (200*32M)")
         | 
| 1498 1500 | 
             
                ap2.add_argument("--bf-dir", metavar="PATH", type=u, default="bf", help="bak-flips: store corrupted chunks at \033[33mPATH\033[0m; default: folder named 'bf' wherever copyparty was started")
         | 
| 1499 1501 | 
             
                ap2.add_argument("--bf-log", metavar="PATH", type=u, default="", help="bak-flips: log corruption info to a textfile at \033[33mPATH\033[0m")
         | 
| 1502 | 
            +
                ap2.add_argument("--no-cfg-cmt-warn", action="store_true", help=argparse.SUPPRESS)
         | 
| 1500 1503 |  | 
| 1501 1504 |  | 
| 1502 1505 | 
             
            # fmt: on
         | 
    
        copyparty/__version__.py
    CHANGED
    
    
    
        copyparty/authsrv.py
    CHANGED
    
    | @@ -205,7 +205,7 @@ class Lim(object): | |
| 205 205 |  | 
| 206 206 | 
             
                        df, du, err = get_df(abspath, True)
         | 
| 207 207 | 
             
                        if err:
         | 
| 208 | 
            -
                            t = "failed to read disk space usage for  | 
| 208 | 
            +
                            t = "failed to read disk space usage for %r: %s"
         | 
| 209 209 | 
             
                            self.log(t % (abspath, err), 3)
         | 
| 210 210 | 
             
                            self.dfv = 0xAAAAAAAAA  # 42.6 GiB
         | 
| 211 211 | 
             
                        else:
         | 
| @@ -519,7 +519,7 @@ class VFS(object): | |
| 519 519 | 
             
                    """returns [vfsnode,fs_remainder] if user has the requested permissions"""
         | 
| 520 520 | 
             
                    if relchk(vpath):
         | 
| 521 521 | 
             
                        if self.log:
         | 
| 522 | 
            -
                            self.log("vfs", "invalid relpath  | 
| 522 | 
            +
                            self.log("vfs", "invalid relpath %r @%s" % (vpath, uname))
         | 
| 523 523 | 
             
                        raise Pebkac(422)
         | 
| 524 524 |  | 
| 525 525 | 
             
                    cvpath = undot(vpath)
         | 
| @@ -536,11 +536,11 @@ class VFS(object): | |
| 536 536 | 
             
                        if req and uname not in d and uname != LEELOO_DALLAS:
         | 
| 537 537 | 
             
                            if vpath != cvpath and vpath != "." and self.log:
         | 
| 538 538 | 
             
                                ap = vn.canonical(rem)
         | 
| 539 | 
            -
                                t = " | 
| 540 | 
            -
                                self.log("vfs", t | 
| 539 | 
            +
                                t = "%s has no %s in %r => %r => %r"
         | 
| 540 | 
            +
                                self.log("vfs", t % (uname, msg, vpath, cvpath, ap), 6)
         | 
| 541 541 |  | 
| 542 | 
            -
                            t =  | 
| 543 | 
            -
                            raise Pebkac(err, t % (msg, cvpath, vn.vpath))
         | 
| 542 | 
            +
                            t = "you don't have %s-access in %r or below %r"
         | 
| 543 | 
            +
                            raise Pebkac(err, t % (msg, "/" + cvpath, "/" + vn.vpath))
         | 
| 544 544 |  | 
| 545 545 | 
             
                    return vn, rem
         | 
| 546 546 |  | 
| @@ -686,8 +686,8 @@ class VFS(object): | |
| 686 686 | 
             
                        and fsroot in seen
         | 
| 687 687 | 
             
                    ):
         | 
| 688 688 | 
             
                        if self.log:
         | 
| 689 | 
            -
                            t = "bailing from symlink loop,\n  prev:  | 
| 690 | 
            -
                            self.log("vfs.walk", t | 
| 689 | 
            +
                            t = "bailing from symlink loop,\n  prev: %r\n  curr: %r\n  from: %r / %r"
         | 
| 690 | 
            +
                            self.log("vfs.walk", t % (seen[-1], fsroot, self.vpath, rem), 3)
         | 
| 691 691 | 
             
                        return
         | 
| 692 692 |  | 
| 693 693 | 
             
                    if "xdev" in self.flags or "xvol" in self.flags:
         | 
| @@ -699,7 +699,7 @@ class VFS(object): | |
| 699 699 | 
             
                                rm1.append(le)
         | 
| 700 700 | 
             
                        _ = [vfs_ls.remove(x) for x in rm1]  # type: ignore
         | 
| 701 701 |  | 
| 702 | 
            -
                    dots_ok = wantdots and uname in dbv.axs.udot
         | 
| 702 | 
            +
                    dots_ok = wantdots and (wantdots == 2 or uname in dbv.axs.udot)
         | 
| 703 703 | 
             
                    if not dots_ok:
         | 
| 704 704 | 
             
                        vfs_ls = [x for x in vfs_ls if "/." not in "/" + x[0]]
         | 
| 705 705 |  | 
| @@ -753,7 +753,7 @@ class VFS(object): | |
| 753 753 | 
             
                    # if single folder: the folder itself is the top-level item
         | 
| 754 754 | 
             
                    folder = "" if flt or not wrap else (vpath.split("/")[-1].lstrip(".") or "top")
         | 
| 755 755 |  | 
| 756 | 
            -
                    g = self.walk(folder, vrem, [], uname, [[True, False]],  | 
| 756 | 
            +
                    g = self.walk(folder, vrem, [], uname, [[True, False]], 1, scandir, False)
         | 
| 757 757 | 
             
                    for _, _, vpath, apath, files, rd, vd in g:
         | 
| 758 758 | 
             
                        if flt:
         | 
| 759 759 | 
             
                            files = [x for x in files if x[0] in flt]
         | 
| @@ -811,8 +811,8 @@ class VFS(object): | |
| 811 811 |  | 
| 812 812 | 
             
                        if vdev != st.st_dev:
         | 
| 813 813 | 
             
                            if self.log:
         | 
| 814 | 
            -
                                t = "xdev:  | 
| 815 | 
            -
                                self.log("vfs", t | 
| 814 | 
            +
                                t = "xdev: %s[%r] => %s[%r]"
         | 
| 815 | 
            +
                                self.log("vfs", t % (vdev, self.realpath, st.st_dev, ap), 3)
         | 
| 816 816 |  | 
| 817 817 | 
             
                            return None
         | 
| 818 818 |  | 
| @@ -822,7 +822,7 @@ class VFS(object): | |
| 822 822 | 
             
                                return vn
         | 
| 823 823 |  | 
| 824 824 | 
             
                        if self.log:
         | 
| 825 | 
            -
                            self.log("vfs", "xvol:  | 
| 825 | 
            +
                            self.log("vfs", "xvol: %r" % (ap,), 3)
         | 
| 826 826 |  | 
| 827 827 | 
             
                        return None
         | 
| 828 828 |  | 
| @@ -907,7 +907,7 @@ class AuthSrv(object): | |
| 907 907 |  | 
| 908 908 | 
             
                        self.idp_accs[uname] = gnames
         | 
| 909 909 |  | 
| 910 | 
            -
                        t = "reinitializing due to new user from IdP: [% | 
| 910 | 
            +
                        t = "reinitializing due to new user from IdP: [%r:%r]"
         | 
| 911 911 | 
             
                        self.log(t % (uname, gnames), 3)
         | 
| 912 912 |  | 
| 913 913 | 
             
                        if not broker:
         | 
| @@ -1561,7 +1561,7 @@ class AuthSrv(object): | |
| 1561 1561 | 
             
                                continue
         | 
| 1562 1562 |  | 
| 1563 1563 | 
             
                            if self.args.shr_v:
         | 
| 1564 | 
            -
                                t = "loading %s share  | 
| 1564 | 
            +
                                t = "loading %s share %r by %r => %r"
         | 
| 1565 1565 | 
             
                                self.log(t % (s_pr, s_k, s_un, s_vp))
         | 
| 1566 1566 |  | 
| 1567 1567 | 
             
                            if s_pw:
         | 
| @@ -1758,7 +1758,7 @@ class AuthSrv(object): | |
| 1758 1758 | 
             
                            use = True
         | 
| 1759 1759 | 
             
                            try:
         | 
| 1760 1760 | 
             
                                _ = float(zs)
         | 
| 1761 | 
            -
                                zs = "%sg" % (zs)
         | 
| 1761 | 
            +
                                zs = "%sg" % (zs,)
         | 
| 1762 1762 | 
             
                            except:
         | 
| 1763 1763 | 
             
                                pass
         | 
| 1764 1764 | 
             
                            lim.dfl = unhumanize(zs)
         | 
| @@ -2174,11 +2174,11 @@ class AuthSrv(object): | |
| 2174 2174 | 
             
                        if not self.args.no_voldump:
         | 
| 2175 2175 | 
             
                            self.log(t)
         | 
| 2176 2176 |  | 
| 2177 | 
            -
                        if have_e2d:
         | 
| 2177 | 
            +
                        if have_e2d or self.args.idp_h_usr:
         | 
| 2178 2178 | 
             
                            t = self.chk_sqlite_threadsafe()
         | 
| 2179 2179 | 
             
                            if t:
         | 
| 2180 2180 | 
             
                                self.log("\n\033[{}\033[0m\n".format(t))
         | 
| 2181 | 
            -
             | 
| 2181 | 
            +
                        if have_e2d:
         | 
| 2182 2182 | 
             
                            if not have_e2t:
         | 
| 2183 2183 | 
             
                                t = "hint: enable multimedia indexing (artist/title/...) with argument -e2ts"
         | 
| 2184 2184 | 
             
                                self.log(t, 6)
         | 
| @@ -2530,7 +2530,7 @@ class AuthSrv(object): | |
| 2530 2530 | 
             
                        return
         | 
| 2531 2531 |  | 
| 2532 2532 | 
             
                    elif self.args.chpw_v == 2:
         | 
| 2533 | 
            -
                        t = "chpw: %d changed" % (len(uok))
         | 
| 2533 | 
            +
                        t = "chpw: %d changed" % (len(uok),)
         | 
| 2534 2534 | 
             
                        if urst:
         | 
| 2535 2535 | 
             
                            t += ", \033[0munchanged:\033[35m %s" % (", ".join(list(urst)))
         | 
| 2536 2536 |  | 
| @@ -2688,7 +2688,7 @@ class AuthSrv(object): | |
| 2688 2688 | 
             
                                [],
         | 
| 2689 2689 | 
             
                                u,
         | 
| 2690 2690 | 
             
                                [[True, False]],
         | 
| 2691 | 
            -
                                 | 
| 2691 | 
            +
                                1,
         | 
| 2692 2692 | 
             
                                not self.args.no_scandir,
         | 
| 2693 2693 | 
             
                                False,
         | 
| 2694 2694 | 
             
                                False,
         | 
| @@ -3009,6 +3009,19 @@ def expand_config_file( | |
| 3009 3009 |  | 
| 3010 3010 | 
             
                ret.append("#\033[36m closed{}\033[0m".format(ipath))
         | 
| 3011 3011 |  | 
| 3012 | 
            +
                zsl = []
         | 
| 3013 | 
            +
                for ln in ret:
         | 
| 3014 | 
            +
                    zs = ln.split("  #")[0]
         | 
| 3015 | 
            +
                    if " #" in zs and zs.split("#")[0].strip():
         | 
| 3016 | 
            +
                        zsl.append(ln)
         | 
| 3017 | 
            +
                if zsl and "no-cfg-cmt-warn" not in "\n".join(ret):
         | 
| 3018 | 
            +
                    t = "\033[33mWARNING: there is less than two spaces before the # in the following config lines, so instead of assuming that this is a comment, the whole line will become part of the config value:\n\n>>> %s\n\nif you are familiar with this and would like to mute this warning, specify the global-option no-cfg-cmt-warn\n\033[0m"
         | 
| 3019 | 
            +
                    t = t % ("\n>>> ".join(zsl),)
         | 
| 3020 | 
            +
                    if log:
         | 
| 3021 | 
            +
                        log(t)
         | 
| 3022 | 
            +
                    else:
         | 
| 3023 | 
            +
                        print(t, file=sys.stderr)
         | 
| 3024 | 
            +
             | 
| 3012 3025 |  | 
| 3013 3026 | 
             
            def upgrade_cfg_fmt(
         | 
| 3014 3027 | 
             
                log , args , orig , cfg_fp 
         | 
    
        copyparty/fsutil.py
    CHANGED
    
    | @@ -36,14 +36,14 @@ class Fstab(object): | |
| 36 36 | 
             
                        self.cache = {}
         | 
| 37 37 |  | 
| 38 38 | 
             
                    fs = "ext4"
         | 
| 39 | 
            -
                    msg = "failed to determine filesystem at  | 
| 39 | 
            +
                    msg = "failed to determine filesystem at %r; assuming %s\n%s"
         | 
| 40 40 |  | 
| 41 41 | 
             
                    if ANYWIN:
         | 
| 42 42 | 
             
                        fs = "vfat"
         | 
| 43 43 | 
             
                        try:
         | 
| 44 44 | 
             
                            path = self._winpath(path)
         | 
| 45 45 | 
             
                        except:
         | 
| 46 | 
            -
                            self.log(msg | 
| 46 | 
            +
                            self.log(msg % (path, fs, min_ex()), 3)
         | 
| 47 47 | 
             
                            return fs
         | 
| 48 48 |  | 
| 49 49 | 
             
                    path = undot(path)
         | 
| @@ -55,11 +55,11 @@ class Fstab(object): | |
| 55 55 | 
             
                    try:
         | 
| 56 56 | 
             
                        fs = self.get_w32(path) if ANYWIN else self.get_unix(path)
         | 
| 57 57 | 
             
                    except:
         | 
| 58 | 
            -
                        self.log(msg | 
| 58 | 
            +
                        self.log(msg % (path, fs, min_ex()), 3)
         | 
| 59 59 |  | 
| 60 60 | 
             
                    fs = fs.lower()
         | 
| 61 61 | 
             
                    self.cache[path] = fs
         | 
| 62 | 
            -
                    self.log("found  | 
| 62 | 
            +
                    self.log("found %s at %r" % (fs, path))
         | 
| 63 63 | 
             
                    return fs
         | 
| 64 64 |  | 
| 65 65 | 
             
                def _winpath(self, path )  :
         |