Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
9001 committed Oct 24, 2022
1 parent 5f60c50 commit 69f78b8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ regarding the frequent server log message during uploads;
* on this http connection, `2.77 GiB` transferred, `102.9 MiB/s` average, `948` chunks handled
* client says `4` uploads OK, `0` failed, `3` busy, `1` queued, `10042 MiB` total size, `7198 MiB` and `00:01:09` left

design detail: [why chunk-hashes](#./docs/devnotes/#why-chunk-hashes)
design detail: [why chunk-hashes](#./docs/devnotes.md#why-chunk-hashes)


# performance
Expand Down Expand Up @@ -1369,7 +1369,7 @@ these are standalone programs and will never be imported / evaluated by copypart

the self-contained "binary" [copyparty-sfx.py](https://github.com/9001/copyparty/releases/latest/download/copyparty-sfx.py) will unpack itself and run copyparty, assuming you have python installed of course

you can reduce the sfx size by repacking it; see [./docs/devnotes/#sfx-repack](#./docs/devnotes/#sfx-repack)
you can reduce the sfx size by repacking it; see [./docs/devnotes.md#sfx-repack](#./docs/devnotes.md#sfx-repack)


## copyparty.exe
Expand Down
4 changes: 2 additions & 2 deletions copyparty/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,12 +634,12 @@ def run_argparse(argv: list[str], formatter: Any, retry: bool) -> argparse.Names
ap2.add_argument("--ftp-pr", metavar="P-P", type=u, help="the range of TCP ports to use for passive connections, for example \033[32m12000-13000")

ap2 = ap.add_argument_group('WebDAV options')
ap2.add_argument("--daw", action="store_true", help="enable full write support. \033[1;31mNB!\033[0m This has side-effects -- PUT-operations will now \033[1;31mOVERWRITE\033[0m existing files, rather than inventing new filenames to avoid loss of data. You might want to instead set this as a volflag where needed. By not setting this flag, uploaded files can get written to a filename which the client does not expect (which might be okay, depending on client)")
ap2.add_argument("--daw", action="store_true", help="enable full write support. \033[1;31mWARNING:\033[0m This has side-effects -- PUT-operations will now \033[1;31mOVERWRITE\033[0m existing files, rather than inventing new filenames to avoid loss of data. You might want to instead set this as a volflag where needed. By not setting this flag, uploaded files can get written to a filename which the client does not expect (which might be okay, depending on client)")
ap2.add_argument("--dav-nr", action="store_true", help="reject depth:infinite requests (recursive file listing); breaks spec compliance and some clients, which might be a good thing since depth:infinite is extremely server-heavy")
ap2.add_argument("--dav-mac", action="store_true", help="disable apple-garbage filter -- allow macos to create junk files (._* and .DS_Store, .Spotlight-*, .fseventsd, .Trashes, .AppleDouble, __MACOS)")

ap2 = ap.add_argument_group('SMB/CIFS options')
ap2.add_argument("--smb", action="store_true", help="enable smb (read-only) -- this requires running copyparty as root on linux and macos unless --smb-port")
ap2.add_argument("--smb", action="store_true", help="enable smb (read-only) -- this requires running copyparty as root on linux and macos unless --smb-port is set above 1024 and your OS does port-forwarding from 445 to that.\n\033[1;31mWARNING:\033[0m this protocol is dangerous! Never expose to the internet. Account permissions are coalesced; if one account has write-access to a volume, then all accounts do.")
ap2.add_argument("--smbw", action="store_true", help="enable write support (please dont)")
ap2.add_argument("--smb1", action="store_true", help="disable SMBv2, only enable SMBv1 (CIFS)")
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")
Expand Down
10 changes: 3 additions & 7 deletions copyparty/smbd.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# coding: utf-8
from __future__ import print_function, unicode_literals

import inspect
import logging
Expand All @@ -24,10 +23,6 @@
from .svchub import SvcHub


class Standin(object):
pass


class HLog(logging.Handler):
def __init__(self, log_func: Any) -> None:
logging.Handler.__init__(self)
Expand Down Expand Up @@ -173,6 +168,7 @@ def _open(
self.files = {k: v for k, v in self.files.items() if v[0] > cutoff}
logging.info("was tracking %d files, now %d", nf, len(self.files))

vpath = vpath.replace("\\", "/").lstrip("/")
self.files[ret] = (now, vpath)

return ret
Expand Down Expand Up @@ -234,12 +230,12 @@ def _unlink(self, vpath: str) -> None:
yeet("blocked delete (no --smbw): " + vpath)

# return bos.unlink(self._v2a("stat", vpath, *a)[1])
vp = vpath.lstrip("/")
vfs, ap = self._v2a("delete", vpath)
if not vfs.axs.udel:
yeet("blocked delete (no-del-acc): " + vpath)

self.hub.up2k.handle_rm(LEELOO_DALLAS, "1.7.6.2", [vp], [])
vpath = vpath.replace("\\", "/").lstrip("/")
self.hub.up2k.handle_rm(LEELOO_DALLAS, "1.7.6.2", [vpath], [])

def _utime(self, vpath: str, times: tuple[float, float]) -> None:
if not self.args.smbw:
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ def run(self):
"audiotags": ["mutagen"],
"ftpd": ["pyftpdlib"],
"ftps": ["pyftpdlib", "pyopenssl"],
"smbd": ["impacket"],
},
"entry_points": {"console_scripts": ["copyparty = copyparty.__main__:main"]},
"scripts": ["bin/copyparty-fuse.py", "bin/up2k.py"],
Expand Down

0 comments on commit 69f78b8

Please sign in to comment.