mirror of
https://github.com/9001/copyparty.git
synced 2025-08-16 16:42:13 -06:00
dist: strip some pointless code
This commit is contained in:
parent
44f2b63e43
commit
f1646b96ca
|
@ -363,8 +363,10 @@ class Gateway(object):
|
|||
ctype = r.getheader("Content-Type", "")
|
||||
if ctype == "application/json":
|
||||
parser = self.parse_jls
|
||||
# !rm.yes>
|
||||
elif ctype.startswith("text/html"):
|
||||
parser = self.parse_html
|
||||
# !rm.no>
|
||||
else:
|
||||
info("listdir on file (%s): %r", ctype, path)
|
||||
raise FuseOSError(errno.ENOENT)
|
||||
|
@ -418,6 +420,7 @@ class Gateway(object):
|
|||
|
||||
return ret
|
||||
|
||||
# !rm.yes>
|
||||
def parse_html(self, sck):
|
||||
ret = {}
|
||||
rem = b""
|
||||
|
@ -465,6 +468,7 @@ class Gateway(object):
|
|||
ret[fname] = self.stat_dir(ts, sz)
|
||||
|
||||
return ret
|
||||
# !rm.no>
|
||||
|
||||
def stat_dir(self, ts, sz=4096):
|
||||
return {
|
||||
|
@ -548,6 +552,7 @@ class CPPF(Operations):
|
|||
break
|
||||
return None
|
||||
|
||||
# !rm.yes>
|
||||
"""
|
||||
,-------------------------------, g1>=c1, g2<=c2
|
||||
|cache1 cache2| buf[g1-c1:(g1-c1)+(g2-g1)]
|
||||
|
@ -572,6 +577,7 @@ class CPPF(Operations):
|
|||
|get1 get2|
|
||||
`---------------'
|
||||
"""
|
||||
# !rm.no>
|
||||
|
||||
def get_cached_file(self, path, get1, get2, file_sz):
|
||||
car = None
|
||||
|
@ -802,6 +808,7 @@ class CPPF(Operations):
|
|||
|
||||
return ret
|
||||
|
||||
# !rm.yes>
|
||||
fn = "cppf-{}-{}-{}".format(time.time(), offset, length)
|
||||
if False:
|
||||
with open(fn, "wb", len(ret)) as f:
|
||||
|
@ -824,6 +831,7 @@ class CPPF(Operations):
|
|||
raise Exception("cache bork")
|
||||
|
||||
return ret
|
||||
# !rm.no>
|
||||
|
||||
def getattr(self, path, fh=None):
|
||||
dbg("getattr %r", path)
|
||||
|
@ -871,6 +879,7 @@ class CPPF(Operations):
|
|||
releasedir = None
|
||||
statfs = None
|
||||
|
||||
# !rm.yes>
|
||||
if False:
|
||||
# incorrect semantics but good for debugging stuff like samba and msys2
|
||||
def access(self, path, mode):
|
||||
|
@ -908,6 +917,7 @@ class CPPF(Operations):
|
|||
def statfs(self, path):
|
||||
dbg("@@ statfs [{}]".format(path))
|
||||
return {}
|
||||
# !rm.no>
|
||||
|
||||
if sys.platform == "win32":
|
||||
# quick compat for /mingw64/bin/python3 (msys2)
|
||||
|
|
|
@ -73,6 +73,7 @@ web/deps/busy.mp3
|
|||
web/deps/easymde.css
|
||||
web/deps/easymde.js
|
||||
web/deps/marked.js
|
||||
web/deps/fuse.py
|
||||
web/deps/mini-fa.css
|
||||
web/deps/mini-fa.woff
|
||||
web/deps/prism.css
|
||||
|
|
|
@ -761,6 +761,7 @@ class _Unrecv(object):
|
|||
self.buf = buf + self.buf
|
||||
|
||||
|
||||
# !rm.yes>
|
||||
class _LUnrecv(object):
|
||||
"""
|
||||
with expensive debug logging
|
||||
|
@ -815,6 +816,7 @@ class _LUnrecv(object):
|
|||
self.buf = buf + self.buf
|
||||
t = "\033[0;7mur:push\033[0;1;31m {}\n\033[0;7mur:rem:\033[0;1;35m {}\033[0m"
|
||||
print(t.format(buf, self.buf))
|
||||
# !rm.no>
|
||||
|
||||
|
||||
Unrecv = _Unrecv
|
||||
|
|
|
@ -27,14 +27,14 @@ help() { exec cat <<'EOF'
|
|||
#
|
||||
# `no-ftp` saves ~30k by removing the ftp server, disabling --ftp
|
||||
#
|
||||
# `no-pf` saves ~12k by removing the option to download partyfuse
|
||||
#
|
||||
# `no-tfp` saves ~10k by removing the tftp server, disabling --tftp
|
||||
#
|
||||
# `no-zm` saves ~7k by removing the zeroconf mDNS server
|
||||
#
|
||||
# `no-smb` saves ~3.5k by removing the smb / cifs server
|
||||
#
|
||||
# `no-pf` saves ~2.8k by removing the option to download partyfuse
|
||||
#
|
||||
# _____________________________________________________________________
|
||||
# web features:
|
||||
#
|
||||
|
@ -109,7 +109,7 @@ pybin=$(command -v python3 || command -v python) || {
|
|||
|
||||
langs=
|
||||
use_gz=
|
||||
zopf=2560
|
||||
zopf=2000
|
||||
while [ ! -z "$1" ]; do
|
||||
case $1 in
|
||||
clean) clean=1 ; ;;
|
||||
|
|
|
@ -61,11 +61,21 @@ def uh2(fp):
|
|||
# remove expensive imports too
|
||||
lns = []
|
||||
on = True
|
||||
on2 = True
|
||||
for ln in cs.split("\n"):
|
||||
if ln.startswith("if True:"):
|
||||
on = False
|
||||
continue
|
||||
|
||||
if ln.endswith("# !rm.yes>"):
|
||||
on2 = False
|
||||
continue
|
||||
|
||||
if not on2:
|
||||
if ln.endswith("# !rm.no>"):
|
||||
on2 = True
|
||||
continue
|
||||
|
||||
if not on and (not ln.strip() or ln.startswith(" ")):
|
||||
continue
|
||||
|
||||
|
|
Loading…
Reference in a new issue