diff --git a/basicswap/http_server.py b/basicswap/http_server.py index 26348c9..a4bc8db 100644 --- a/basicswap/http_server.py +++ b/basicswap/http_server.py @@ -701,25 +701,37 @@ class HttpHandler(BaseHTTPRequestHandler): 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: + if len(url_split) > 3 and url_split[2] == 'sequence_diagrams': + with open(os.path.join(static_path, 'sequence_diagrams', url_split[3]), 'rb') as fp: + self.putHeaders(status_code, 'image/svg+xml') 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: + elif len(url_split) > 3 and url_split[2] == 'images': + filename = os.path.join(*url_split[3:]) + _, extension = os.path.splitext(filename) + mime_type = {'.svg': 'image/svg+xml', + '.png': 'image/png', + '.jpg': 'image/jpeg', + }.get(extension, '') + if mime_type == '': + raise ValueError('Unknown file type ' + filename) + with open(os.path.join(static_path, 'images', filename), 'rb') as fp: + self.putHeaders(status_code, mime_type) return fp.read() - elif len(url_split) > 3 and url_split[2] == 'sequence_diagrams': - self.putHeaders(status_code, 'image/svg+xml') - with open(os.path.join(static_path, 'sequence_diagrams', url_split[3]), 'rb') as fp: + elif len(url_split) > 3 and url_split[2] == 'css': + filename = os.path.join(*url_split[3:]) + with open(os.path.join(static_path, 'css', filename), 'rb') as fp: + self.putHeaders(status_code, 'text/css; charset=utf-8') return fp.read() else: self.putHeaders(status_code, 'text/html') return self.page_404(url_split) - except Exception as ex: + except FileNotFoundError: self.putHeaders(status_code, 'text/html') + return self.page_404(url_split) + except Exception as ex: if self.server.swap_client.debug is True: self.server.swap_client.log.error(traceback.format_exc()) + self.putHeaders(status_code, 'text/html') return self.page_error(str(ex)) try: diff --git a/basicswap/static/style.css b/basicswap/static/css/simple/style.css similarity index 100% rename from basicswap/static/style.css rename to basicswap/static/css/simple/style.css diff --git a/basicswap/static/favicon-32.png b/basicswap/static/images/favicon-32.png similarity index 100% rename from basicswap/static/favicon-32.png rename to basicswap/static/images/favicon-32.png diff --git a/basicswap/templates/automation_strategies.html b/basicswap/templates/automation_strategies.html index 3412c17..769a069 100644 --- a/basicswap/templates/automation_strategies.html +++ b/basicswap/templates/automation_strategies.html @@ -30,7 +30,7 @@ {% for s in strategies %} - + {% endfor %}
NameType
{{ s[1] }}{{ s[2] }}
{{ s[1] }}{{ s[2] }}
diff --git a/basicswap/templates/header.html b/basicswap/templates/header.html index 281b57d..4311018 100644 --- a/basicswap/templates/header.html +++ b/basicswap/templates/header.html @@ -4,8 +4,8 @@ {% if refresh %} {% endif %} - - + + {{ title }} diff --git a/basicswap/templates/offer_confirm.html b/basicswap/templates/offer_confirm.html index d3710dc..00b486b 100644 --- a/basicswap/templates/offer_confirm.html +++ b/basicswap/templates/offer_confirm.html @@ -60,8 +60,8 @@ {% endif %} Rate -Amount Variable -Rate Variable +Amount Variable +Rate Variable Offer valid (hrs) {% if data.debug_ui == true %} diff --git a/basicswap/templates/offer_new_1.html b/basicswap/templates/offer_new_1.html index 9fb20ec..7083ce2 100644 --- a/basicswap/templates/offer_new_1.html +++ b/basicswap/templates/offer_new_1.html @@ -37,9 +37,9 @@ Amount ToThe amount you will receive. -RateLock Rate: -Amount Variable -Rate Variable +RateLock Rate: +Amount Variable +Rate Variable diff --git a/basicswap/templates/offer_new_2.html b/basicswap/templates/offer_new_2.html index de6023e..e3836a0 100644 --- a/basicswap/templates/offer_new_2.html +++ b/basicswap/templates/offer_new_2.html @@ -57,8 +57,8 @@ {% endif %} Rate -Amount Variable -Rate Variable +Amount Variable +Rate Variable Offer valid (hrs) diff --git a/basicswap/templates/wallet.html b/basicswap/templates/wallet.html index fd265bb..9b418a2 100644 --- a/basicswap/templates/wallet.html +++ b/basicswap/templates/wallet.html @@ -49,7 +49,7 @@ {% else %} {{ w.deposit_address }} {% endif %} -Amount: Address: Subtract fee: +Amount: Address: Subtract fee: {% if w.cid == '1' %} Type From, To