mirror of
https://github.com/9001/copyparty.git
synced 2025-08-20 02:12:20 -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,
|
"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 == "*":
|
if self.uname == "*":
|
||||||
txt = "howdy stranger (you're not logged in)"
|
txt = "howdy stranger (you're not logged in)"
|
||||||
else:
|
else:
|
||||||
|
@ -2974,7 +2978,7 @@ class HttpCli(object):
|
||||||
biggest = 0
|
biggest = 0
|
||||||
|
|
||||||
if arg == "v":
|
if arg == "v":
|
||||||
fmt = "\033[0;7;36m{{}} {{:>{}}}\033[0m {{}}"
|
fmt = "\033[0;7;36m{{}}{{:>{}}}\033[0m {{}}"
|
||||||
nfmt = "{}"
|
nfmt = "{}"
|
||||||
biggest = 0
|
biggest = 0
|
||||||
f2 = "".join(
|
f2 = "".join(
|
||||||
|
@ -2994,7 +2998,7 @@ class HttpCli(object):
|
||||||
a = x["dt"].replace("-", " ").replace(":", " ").split(" ")
|
a = x["dt"].replace("-", " ").replace(":", " ").split(" ")
|
||||||
x["dt"] = f2.format(*list(a))
|
x["dt"] = f2.format(*list(a))
|
||||||
sz = humansize(x["sz"], True)
|
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:
|
else:
|
||||||
fmt = "{{}} {{:{},}} {{}}"
|
fmt = "{{}} {{:{},}} {{}}"
|
||||||
nfmt = "{:,}"
|
nfmt = "{:,}"
|
||||||
|
@ -3145,6 +3149,10 @@ class HttpCli(object):
|
||||||
is_ls = "ls" in self.uparam
|
is_ls = "ls" in self.uparam
|
||||||
is_js = self.args.force_js or self.cookies.get("js") == "y"
|
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"
|
tpl = "browser"
|
||||||
if "b" in self.uparam:
|
if "b" in self.uparam:
|
||||||
tpl = "browser2"
|
tpl = "browser2"
|
||||||
|
|
Loading…
Reference in a new issue