diff --git a/copyparty/__version__.py b/copyparty/__version__.py index 9192b076..bf6440a4 100644 --- a/copyparty/__version__.py +++ b/copyparty/__version__.py @@ -1,7 +1,7 @@ # coding: utf-8 -VERSION = (0, 2, 0) -BUILD_DT = (2019, 7, 8) +VERSION = (0, 2, 1) +BUILD_DT = (2020, 1, 19) S_VERSION = ".".join(map(str, VERSION)) S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 22585a3f..6f22f48e 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -9,13 +9,15 @@ import json from datetime import datetime import calendar import mimetypes -import cgi from .__init__ import E, PY2 from .util import * # noqa # pylint: disable=unused-wildcard-import if not PY2: unicode = str + from html import escape as html_escape +else: + from cgi import escape as html_escape class HttpCli(object): @@ -192,11 +194,8 @@ class HttpCli(object): self.vpath = None return self.tx_mounts() - if self.readable: - return self.tx_browser() - else: - return self.tx_upper() - + return self.tx_browser() + def handle_post(self): self.log("POST " + self.req) @@ -445,7 +444,7 @@ class HttpCli(object): html = self.conn.tpl_msg.render( h2='return to /{}'.format( - quotep(self.vpath), cgi.escape(self.vpath, quote=True) + quotep(self.vpath), html_escape(self.vpath, quote=False) ), pre=msg, ) @@ -609,12 +608,6 @@ class HttpCli(object): self.reply(html.encode("utf-8")) return True - def tx_upper(self): - # return html for basic uploader; - # js rewrites to up2k unless uparam['b'] - self.loud_reply("TODO jupper {}".format(self.vpath)) - return True - def tx_browser(self): vpath = "" vpnodes = [["", "/"]] @@ -625,9 +618,9 @@ class HttpCli(object): else: vpath += "/" + node - vpnodes.append([quotep(vpath) + "/", cgi.escape(node)]) + vpnodes.append([quotep(vpath) + "/", html_escape(node, quote=False)]) - vn, rem = self.auth.vfs.get(self.vpath, self.uname, True, False) + vn, rem = self.auth.vfs.get(self.vpath, self.uname, self.readable, self.writable) abspath = vn.canonical(rem) if not os.path.exists(fsenc(abspath)): @@ -665,7 +658,7 @@ class HttpCli(object): dt = datetime.utcfromtimestamp(inf.st_mtime) dt = dt.strftime("%Y-%m-%d %H:%M:%S") - item = [margin, quotep(href), cgi.escape(fn, quote=True), sz, dt] + item = [margin, quotep(href), html_escape(fn, quote=False), sz, dt] if is_dir: dirs.append(item) else: @@ -687,6 +680,7 @@ class HttpCli(object): vpnodes=vpnodes, files=dirs, can_upload=self.writable, + can_read=self.readable, ts=ts, prologue=logues[0], epilogue=logues[1], diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index efd75007..007a5d2f 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -36,11 +36,12 @@ body { padding: .35em .5em .2em .5em; border-radius: 0 .3em .3em 0; box-shadow: .1em .1em .4em #222; - margin: 1em 0; + margin: 2em 0 1em 0; font-size: 1.4em; } #files { border-collapse: collapse; + margin-top: 1em; } #files tbody a { display: block; diff --git a/copyparty/web/browser.html b/copyparty/web/browser.html index 954c2426..9592ac50 100644 --- a/copyparty/web/browser.html +++ b/copyparty/web/browser.html @@ -13,16 +13,17 @@
- {%- if can_upload %} - {%- include 'upload.html' %} - {%- endif %} -