mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
give curl colored (yet sortable) plaintext listings
This commit is contained in:
parent
cfd24604d5
commit
b0e755d410
|
@ -2654,7 +2654,11 @@ class HttpCli(object):
|
|||
"dbwt": None,
|
||||
}
|
||||
|
||||
if self.uparam.get("ls") in ["v", "t", "txt"]:
|
||||
fmt = self.uparam.get("ls", "")
|
||||
if not fmt and self.ua.startswith("curl/"):
|
||||
fmt = "v"
|
||||
|
||||
if fmt in ["v", "t", "txt"]:
|
||||
if self.uname == "*":
|
||||
txt = "howdy stranger (you're not logged in)"
|
||||
else:
|
||||
|
@ -2974,7 +2978,7 @@ class HttpCli(object):
|
|||
biggest = 0
|
||||
|
||||
if arg == "v":
|
||||
fmt = "\033[0;7;36m{{}} {{:>{}}}\033[0m {{}}"
|
||||
fmt = "\033[0;7;36m{{}}{{:>{}}}\033[0m {{}}"
|
||||
nfmt = "{}"
|
||||
biggest = 0
|
||||
f2 = "".join(
|
||||
|
@ -2994,7 +2998,7 @@ class HttpCli(object):
|
|||
a = x["dt"].replace("-", " ").replace(":", " ").split(" ")
|
||||
x["dt"] = f2.format(*list(a))
|
||||
sz = humansize(x["sz"], True)
|
||||
x["sz"] = "\033[0;3{}m{:>5}".format(ctab.get(sz[-1:], 0), sz)
|
||||
x["sz"] = "\033[0;3{}m {:>5}".format(ctab.get(sz[-1:], 0), sz)
|
||||
else:
|
||||
fmt = "{{}} {{:{},}} {{}}"
|
||||
nfmt = "{:,}"
|
||||
|
@ -3145,6 +3149,10 @@ class HttpCli(object):
|
|||
is_ls = "ls" in self.uparam
|
||||
is_js = self.args.force_js or self.cookies.get("js") == "y"
|
||||
|
||||
if not is_ls and self.ua.startswith("curl/"):
|
||||
self.uparam["ls"] = "v"
|
||||
is_ls = True
|
||||
|
||||
tpl = "browser"
|
||||
if "b" in self.uparam:
|
||||
tpl = "browser2"
|
||||
|
|
Loading…
Reference in a new issue