mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
cleanup and minor fixes
This commit is contained in:
parent
241b022520
commit
bf3163be0f
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -39,6 +39,9 @@
|
|||
"--max-line-length=120",
|
||||
"--ignore=E722,F405,E203,W503,W293",
|
||||
],
|
||||
"python.linting.banditArgs": [
|
||||
"--ignore=B104"
|
||||
],
|
||||
"python.formatting.provider": "black",
|
||||
"editor.formatOnSave": true,
|
||||
"[html]": {
|
||||
|
|
|
@ -138,6 +138,8 @@ class AuthSrv(object):
|
|||
self.log_func = log_func
|
||||
self.args = args
|
||||
|
||||
self.warn_anonwrite = True
|
||||
|
||||
self.mutex = threading.Lock()
|
||||
self.reload()
|
||||
|
||||
|
@ -262,6 +264,18 @@ class AuthSrv(object):
|
|||
v.uread = mread[dst]
|
||||
v.uwrite = mwrite[dst]
|
||||
|
||||
try:
|
||||
vfs.get("/", "*", False, True)
|
||||
if self.warn_anonwrite:
|
||||
self.warn_anonwrite = False
|
||||
self.log(
|
||||
"\033[31manyone can write to the current directory: {}\033[0m".format(
|
||||
os.getcwd()
|
||||
)
|
||||
)
|
||||
except Pebkac:
|
||||
self.warn_anonwrite = True
|
||||
|
||||
with self.mutex:
|
||||
self.vfs = vfs
|
||||
self.user = user
|
||||
|
|
|
@ -232,13 +232,17 @@ class HttpCli(object):
|
|||
if os.path.exists(fsenc(fn)):
|
||||
fn += ".{:.6f}".format(time.time())
|
||||
|
||||
with open(fn, "wb") as f:
|
||||
self.log("writing to {0}".format(fn))
|
||||
sz, sha512 = hashcopy(self.conn, p_data, f)
|
||||
if sz == 0:
|
||||
break
|
||||
try:
|
||||
with open(fn, "wb") as f:
|
||||
self.log("writing to {0}".format(fn))
|
||||
sz, sha512 = hashcopy(self.conn, p_data, f)
|
||||
if sz == 0:
|
||||
break
|
||||
|
||||
files.append([sz, sha512])
|
||||
files.append([sz, sha512])
|
||||
|
||||
except FileNotFoundError:
|
||||
raise Pebkac("create that folder before uploading to it")
|
||||
|
||||
self.parser.drop()
|
||||
|
||||
|
@ -318,7 +322,7 @@ class HttpCli(object):
|
|||
|
||||
def tx_browser(self):
|
||||
vpath = ""
|
||||
vpnodes = [["/", "/"]]
|
||||
vpnodes = [["", "/"]]
|
||||
for node in self.vpath.split("/"):
|
||||
if not vpath:
|
||||
vpath = node
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
<h1 id="path">
|
||||
{%- for n in vpnodes[:-1] %}
|
||||
<a href="{{ n[0] }}">{{ n[1] }}</a>
|
||||
<a href="/{{ n[0] }}">{{ n[1] }}</a>
|
||||
{%- endfor %}
|
||||
<span>{{ vpnodes[-1][1] }}</span>
|
||||
</h1>
|
||||
|
|
|
@ -25,7 +25,7 @@ head -c $((2*1024*1024*1024)) /dev/zero | openssl enc -aes-256-ctr -pass pass:hu
|
|||
## testing multiple parallel uploads
|
||||
## usage: para | tee log
|
||||
|
||||
para() { for s in 1 2 3 4 5 6 7 8 12 16 24 32 48 64; do echo $s; for r in {1..4}; do for ((n=0;n<s;n++)); do curl -sF "f=@garbage.file" http://127.0.0.1:1234/32 2>&1 & done; wait; echo; done; done; }
|
||||
para() { for s in 1 2 3 4 5 6 7 8 12 16 24 32 48 64; do echo $s; for r in {1..4}; do for ((n=0;n<s;n++)); do curl -sF "act=bput" -F "f=@garbage.file" http://127.0.0.1:1234/ 2>&1 & done; wait; echo; done; done; }
|
||||
|
||||
|
||||
##
|
||||
|
|
Loading…
Reference in a new issue