diff --git a/MANIFEST.in b/MANIFEST.in index c5444a5..9f979c9 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,3 +2,4 @@ include *.md LICENSE recursive-include doc * recursive-include basicswap/templates * +recursive-include basicswap/static * diff --git a/basicswap/__init__.py b/basicswap/__init__.py index 517d50f..1939488 100644 --- a/basicswap/__init__.py +++ b/basicswap/__init__.py @@ -1,3 +1,3 @@ name = "basicswap" -__version__ = "0.0.7" +__version__ = "0.0.8" diff --git a/basicswap/http_server.py b/basicswap/http_server.py index aae11d3..1d9780b 100644 --- a/basicswap/http_server.py +++ b/basicswap/http_server.py @@ -794,6 +794,12 @@ class HttpHandler(BaseHTTPRequestHandler): summary=summary ), 'UTF-8') + def page_404(self, url_split): + template = env.get_template('404.html') + return bytes(template.render( + title=self.server.title, + ), 'UTF-8') + def putHeaders(self, status_code, content_type): self.send_response(status_code) if self.server.allow_cors: @@ -820,6 +826,28 @@ class HttpHandler(BaseHTTPRequestHandler): if self.server.swap_client.debug is True: traceback.print_exc() return js_error(self, str(ex)) + + if len(url_split) > 1 and url_split[1] == 'static': + try: + static_path = os.path.join(os.path.dirname(__file__), 'static') + + if url_split[2] == 'favicon-32.png': + self.putHeaders(status_code, 'image/png') + with open(os.path.join(static_path, 'favicon-32.png'), 'rb') as fp: + return fp.read() + elif url_split[2] == 'style.css': + self.putHeaders(status_code, 'text/css') + with open(os.path.join(static_path, 'style.css'), 'rb') as fp: + return fp.read() + else: + self.putHeaders(status_code, 'text/html') + return self.page_404(url_split) + except Exception as ex: + self.putHeaders(status_code, 'text/html') + if self.server.swap_client.debug is True: + traceback.print_exc() + return self.page_error(str(ex)) + try: self.putHeaders(status_code, 'text/html') if len(url_split) > 1: diff --git a/basicswap/static/favicon-32.png b/basicswap/static/favicon-32.png new file mode 100644 index 0000000..5ec715a Binary files /dev/null and b/basicswap/static/favicon-32.png differ diff --git a/basicswap/static/style.css b/basicswap/static/style.css new file mode 100644 index 0000000..d3d2ba9 --- /dev/null +++ b/basicswap/static/style.css @@ -0,0 +1,10 @@ + +.padded_row td +{ + padding-top:1.5em; +} + +.bold +{ + font-weight:bold; +} diff --git a/basicswap/templates/404.html b/basicswap/templates/404.html new file mode 100644 index 0000000..a520bde --- /dev/null +++ b/basicswap/templates/404.html @@ -0,0 +1,6 @@ +{% include 'header.html' %} + +

404 Page Not Found

+ +

home

+ diff --git a/basicswap/templates/header.html b/basicswap/templates/header.html index d244993..281b57d 100644 --- a/basicswap/templates/header.html +++ b/basicswap/templates/header.html @@ -4,6 +4,8 @@ {% if refresh %} {% endif %} + + {{ title }} diff --git a/basicswap/templates/offer_confirm.html b/basicswap/templates/offer_confirm.html index 0ba9398..c0801cb 100644 --- a/basicswap/templates/offer_confirm.html +++ b/basicswap/templates/offer_confirm.html @@ -15,7 +15,7 @@ -- New Address -- -Coin From +Coin From {% for c in coins %} {{ c[1] }} @@ -54,7 +54,7 @@ {% endif %} -Contract locked (hrs){% if data.swap_style != 'xmr' %}Participate txn will be locked for half the time.{% endif %} +Contract locked (hrs){% if data.swap_style != 'xmr' %}Participate txn will be locked for half the time.{% endif %} Auto Accept Bids @@ -71,5 +71,4 @@ {% endif %} -

home

diff --git a/basicswap/templates/offer_new_2.html b/basicswap/templates/offer_new_2.html index 0e03b4e..26902ea 100644 --- a/basicswap/templates/offer_new_2.html +++ b/basicswap/templates/offer_new_2.html @@ -15,7 +15,7 @@ -- New Address -- -Coin From +Coin From {% endif %} -Coin To +Coin To {% endif %} -Contract locked (hrs)Participate txn will be locked for half the time. +Contract locked (hrs)Participate txn will be locked for half the time. Auto Accept Bids @@ -63,5 +63,4 @@ -

home