From 1ba2ad6f0bdcd4336da3d7a0b4911f7c7df0052e Mon Sep 17 00:00:00 2001 From: tecnovert Date: Sat, 2 Jan 2021 18:16:44 +0200 Subject: [PATCH] Add favicon and css, inc version. --- MANIFEST.in | 1 + basicswap/__init__.py | 2 +- basicswap/http_server.py | 28 +++++++++++++++++++++++++ basicswap/static/favicon-32.png | Bin 0 -> 715 bytes basicswap/static/style.css | 10 +++++++++ basicswap/templates/404.html | 6 ++++++ basicswap/templates/header.html | 2 ++ basicswap/templates/offer_confirm.html | 7 +++---- basicswap/templates/offer_new_2.html | 7 +++---- 9 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 basicswap/static/favicon-32.png create mode 100644 basicswap/static/style.css create mode 100644 basicswap/templates/404.html 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 0000000000000000000000000000000000000000..5ec715a42cd55f20f10a53f38bfafba11bb6b5c6 GIT binary patch literal 715 zcmV;+0yO=JP)MJu&k1fdP;LQPwX=)$VFiYNrEizp&g{OL-;Wwau?P>ND;p;!cQp$k#aVrW4Z zwPM6p5wxHSt&>br6EmG$7ZGD@Y+sT_q2#XK32e~1H`2vt89svN-q6}?A5K2pc3xdt{fwJxxkwxZ$NY-~Exx@ni zFr_p&o}7UCypI(H;B4=uxO*RrDp&EgBtB#M(&AYG%z4Gzf)w?11I$#KFKJ_L$b2v3 z?k<3tz|uPGZ|}e~8RoNK<&GQ+~P1n{SX7EnmBt%YtH}`t@~uukC;oz5;b5EADFA zMqe9t0RSuw{s(yfjFkl-`uI2lfaISiYH?)OW?T6RQL#}0r~u3g!1Q>|vum}Vq&>sr zYzxj?&!3Tok)hK}TCtS`JpuJ;Z#JLZK8kwJ!H{a8JL-YK9zF&3`yPp}7bI@1&nXtJ zrtPG)UV!nlL|ebSz%=I$jiuh~amObLp9fs4wot62AG&=R06>hsgYDHdzGf)bA>Qai zT9hH^Q%GO5vw{J{t}#j}jU{{Sc-ar_{(e?)FCa^GX}4Ve2K)FxUU9yWtT{lM_Y4d% zQ`4=JVOT#r404 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