From ac6c4b13f56ab82e2906bbff63a3127fe8f8e255 Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 2 Mar 2022 21:20:19 +0100 Subject: [PATCH] add plaintext volume listing --- copyparty/httpcli.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index afc6bbad..454231aa 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -1732,6 +1732,31 @@ class HttpCli(object): vstate = {} vs = {"scanning": None, "hashq": None, "tagq": None, "mtpq": None} + if self.uparam.get("ls") in ["v", "t", "txt"]: + if self.uname == "*": + txt = "howdy stranger (you're not logged in)" + else: + txt = "welcome back {}".format(self.uname) + + if vstate: + txt += "\nstatus:" + for k in ["scanning", "hashq", "tagq", "mtpq"]: + txt += " {}({})".format(k, vs[k]) + + if rvol: + txt += "\nyou can browse:" + for v in rvol: + txt += "\n " + v + + if wvol: + txt += "\nyou can upload to:" + for v in wvol: + txt += "\n " + v + + txt = txt.encode("utf-8", "replace") + b"\n" + self.reply(txt, mime="text/plain; charset=utf-8") + return True + html = self.j2( "splash", this=self,