Browse Source

Add favicon and css, inc version.

pivx
tecnovert 3 years ago
parent
commit
1ba2ad6f0b
No known key found for this signature in database GPG Key ID: 8ED6D8750C4E3F93
  1. 1
      MANIFEST.in
  2. 2
      basicswap/__init__.py
  3. 28
      basicswap/http_server.py
  4. BIN
      basicswap/static/favicon-32.png
  5. 10
      basicswap/static/style.css
  6. 6
      basicswap/templates/404.html
  7. 2
      basicswap/templates/header.html
  8. 7
      basicswap/templates/offer_confirm.html
  9. 7
      basicswap/templates/offer_new_2.html

1
MANIFEST.in

@ -2,3 +2,4 @@ include *.md LICENSE
recursive-include doc *
recursive-include basicswap/templates *
recursive-include basicswap/static *

2
basicswap/__init__.py

@ -1,3 +1,3 @@
name = "basicswap"
__version__ = "0.0.7"
__version__ = "0.0.8"

28
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:

BIN
basicswap/static/favicon-32.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

10
basicswap/static/style.css

@ -0,0 +1,10 @@
.padded_row td
{
padding-top:1.5em;
}
.bold
{
font-weight:bold;
}

6
basicswap/templates/404.html

@ -0,0 +1,6 @@
{% include 'header.html' %}
<p>404 Page Not Found</p>
<p><a href="/">home</a></p>
</body></html>

2
basicswap/templates/header.html

@ -4,6 +4,8 @@
{% if refresh %}
<meta http-equiv="refresh" content="{{ refresh }}">
{% endif %}
<link type="text/css" media="all" href="/static/style.css" rel="stylesheet">
<link rel=icon sizes="32x32" type="image/png" href="/static/favicon-32.png">
<title>{{ title }}</title>
</head>
<body>

7
basicswap/templates/offer_confirm.html

@ -15,7 +15,7 @@
<option{% if data.addr_from=="-1" %} selected{% endif %} value="-1">-- New Address --</option>
</select></td></tr>
<tr><td>Coin From</td><td>
<tr class="padded_row"><td class="bold">Coin From</td><td>
<select name="coin_from_" disabled><option value="-1">-- Select Coin --</option>
{% for c in coins %}
<option{% if data.coin_from==c[0] %} selected{% endif %} value="{{ c[0] }}">{{ c[1] }}</option>
@ -35,7 +35,7 @@
<tr><td>Lock Tx Spend Fee</td><td>{{ data.amt_from_lock_spend_tx_fee }} {{ data.tla_from }}</td></tr>
{% endif %}
<tr><td>Coin To</td><td>
<tr class="padded_row"><td class="bold">Coin To</td><td>
<select name="coin_to_" disabled><option value="-1">-- Select Coin --</option>
{% for c in coins %}
<option{% if data.coin_to==c[0] %} selected{% endif %} value="{{ c[0] }}">{{ c[1] }}</option>
@ -54,7 +54,7 @@
</select></td></tr>
{% endif %}
<tr><td>Contract locked (hrs)</td><td><input type="number" name="lockhrs" min="1" max="64" value="{{ data.lockhrs }}" readonly></td>{% if data.swap_style != 'xmr' %}<td colspan=2>Participate txn will be locked for half the time.</td>{% endif %}</tr>
<tr class="padded_row"><td>Contract locked (hrs)</td><td><input type="number" name="lockhrs" min="1" max="64" value="{{ data.lockhrs }}" readonly></td>{% if data.swap_style != 'xmr' %}<td colspan=2>Participate txn will be locked for half the time.</td>{% endif %}</tr>
<tr><td>Auto Accept Bids</td><td colspan=3><input type="checkbox" name="autoaccept_" value="aa" {% if data.autoaccept==true %} checked="true"{% endif %} disabled></td></tr>
</table>
@ -71,5 +71,4 @@
{% endif %}
</form>
<p><a href="/">home</a></p>
</body></html>

7
basicswap/templates/offer_new_2.html

@ -15,7 +15,7 @@
<option{% if data.addr_from=="-1" %} selected{% endif %} value="-1">-- New Address --</option>
</select></td></tr>
<tr><td>Coin From</td><td>
<tr class="padded_row"><td class="bold">Coin From</td><td>
<select name="coin_from_" disabled><option value="-1">-- Select Coin --</option>
{% for c in coins %}
<option{% if data.coin_from==c[0] %} selected{% endif %} value="{{ c[0] }}">{{ c[1] }}</option>
@ -33,7 +33,7 @@
</select></td></tr>
{% endif %}
<tr><td>Coin To</td><td>
<tr class="padded_row"><td class="bold">Coin To</td><td>
<select name="coin_to_" disabled><option value="-1">-- Select Coin --</option>
{% for c in coins %}
<option{% if data.coin_to==c[0] %} selected{% endif %} value="{{ c[0] }}">{{ c[1] }}</option>
@ -51,7 +51,7 @@
</select></td></tr>
{% endif %}
<tr><td>Contract locked (hrs)</td><td><input type="number" name="lockhrs" min="1" max="64" value="{{ data.lockhrs }}"></td><td colspan=2>Participate txn will be locked for half the time.</td></tr>
<tr class="padded_row"><td>Contract locked (hrs)</td><td><input type="number" name="lockhrs" min="1" max="64" value="{{ data.lockhrs }}"></td><td colspan=2>Participate txn will be locked for half the time.</td></tr>
<tr><td>Auto Accept Bids</td><td colspan=3><input type="checkbox" name="autoaccept" value="aa" {% if data.autoaccept==true %} checked="true"{% endif %}></td></tr>
</table>
@ -63,5 +63,4 @@
<input type="hidden" name="coin_to" value="{{ data.coin_to }}">
</form>
<p><a href="/">home</a></p>
</body></html>

Loading…
Cancel
Save