server: Serve more static directories.
This commit is contained in:
parent
7a3b41a11b
commit
6cc54d9c61
@ -701,25 +701,37 @@ class HttpHandler(BaseHTTPRequestHandler):
|
|||||||
try:
|
try:
|
||||||
static_path = os.path.join(os.path.dirname(__file__), 'static')
|
static_path = os.path.join(os.path.dirname(__file__), 'static')
|
||||||
|
|
||||||
if url_split[2] == 'favicon-32.png':
|
if len(url_split) > 3 and url_split[2] == 'sequence_diagrams':
|
||||||
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()
|
|
||||||
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:
|
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 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] == '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()
|
return fp.read()
|
||||||
else:
|
else:
|
||||||
self.putHeaders(status_code, 'text/html')
|
self.putHeaders(status_code, 'text/html')
|
||||||
return self.page_404(url_split)
|
return self.page_404(url_split)
|
||||||
except Exception as ex:
|
except FileNotFoundError:
|
||||||
self.putHeaders(status_code, 'text/html')
|
self.putHeaders(status_code, 'text/html')
|
||||||
|
return self.page_404(url_split)
|
||||||
|
except Exception as ex:
|
||||||
if self.server.swap_client.debug is True:
|
if self.server.swap_client.debug is True:
|
||||||
self.server.swap_client.log.error(traceback.format_exc())
|
self.server.swap_client.log.error(traceback.format_exc())
|
||||||
|
self.putHeaders(status_code, 'text/html')
|
||||||
return self.page_error(str(ex))
|
return self.page_error(str(ex))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
Before Width: | Height: | Size: 715 B After Width: | Height: | Size: 715 B |
@ -30,7 +30,7 @@
|
|||||||
<table>
|
<table>
|
||||||
<tr><th>Name</th><th>Type</th></tr>
|
<tr><th>Name</th><th>Type</th></tr>
|
||||||
{% for s in strategies %}
|
{% for s in strategies %}
|
||||||
<tr><td><a class="monospace" href=/automationstrategy/{{ s[0] }}>{{ s[1] }}</td><td>{{ s[2] }}</td></tr>
|
<tr><td><a class="monospace" href=/automationstrategy/{{ s[0] }}>{{ s[1] }}</a></td><td>{{ s[2] }}</td></tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
{% if refresh %}
|
{% if refresh %}
|
||||||
<meta http-equiv="refresh" content="{{ refresh }}">
|
<meta http-equiv="refresh" content="{{ refresh }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<link type="text/css" media="all" href="/static/style.css" rel="stylesheet">
|
<link type="text/css" media="all" href="/static/css/simple/style.css" rel="stylesheet">
|
||||||
<link rel=icon sizes="32x32" type="image/png" href="/static/favicon-32.png">
|
<link rel=icon sizes="32x32" type="image/png" href="/static/images/favicon-32.png">
|
||||||
<title>{{ title }}</title>
|
<title>{{ title }}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -60,8 +60,8 @@
|
|||||||
</select></td></tr>
|
</select></td></tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<tr><td>Rate</td><td><input type="text" id="rate" name="rate" value="{{ data.rate }}" readonly></td></tr>
|
<tr><td>Rate</td><td><input type="text" id="rate" name="rate" value="{{ data.rate }}" readonly></td></tr>
|
||||||
<tr><td>Amount Variable</td><td colspan=3><input type="checkbox" id="amt_var" name="amt_var_" value="av" {% if data.amt_var==true %} checked="true"{% endif %} disabled></td></tr>
|
<tr><td>Amount Variable</td><td colspan=3><input type="checkbox" id="amt_var" name="amt_var_" value="av" {% if data.amt_var==true %} checked=checked{% endif %} disabled></td></tr>
|
||||||
<tr><td>Rate Variable</td><td colspan=3><input type="checkbox" id="rate_var" name="rate_var_" value="rv" {% if data.rate_var==true %} checked="true"{% endif %} disabled></td></tr>
|
<tr><td>Rate Variable</td><td colspan=3><input type="checkbox" id="rate_var" name="rate_var_" value="rv" {% if data.rate_var==true %} checked=checked{% endif %} disabled></td></tr>
|
||||||
|
|
||||||
<tr class="padded_row"><td>Offer valid (hrs)</td><td><input type="number" name="validhrs" min="1" max="48" value="{{ data.validhrs }}" readonly></td></tr>
|
<tr class="padded_row"><td>Offer valid (hrs)</td><td><input type="number" name="validhrs" min="1" max="48" value="{{ data.validhrs }}" readonly></td></tr>
|
||||||
{% if data.debug_ui == true %}
|
{% if data.debug_ui == true %}
|
||||||
|
@ -37,9 +37,9 @@
|
|||||||
</select>
|
</select>
|
||||||
</td><td>Amount To</td><td><input type="text" id="amt_to" name="amt_to" value="{{ data.amt_to }}" onchange="set_rate('amt_to');"></td><td>The amount you will receive.</td></tr>
|
</td><td>Amount To</td><td><input type="text" id="amt_to" name="amt_to" value="{{ data.amt_to }}" onchange="set_rate('amt_to');"></td><td>The amount you will receive.</td></tr>
|
||||||
|
|
||||||
<tr><td>Rate</td><td><input type="text" id="rate" name="rate" value="{{ data.rate }}" onchange="set_rate('rate');"></td><td>Lock Rate: <input type="checkbox" id="rate_lock" name="rate_lock" value="rl" checked="true"></td></tr>
|
<tr><td>Rate</td><td><input type="text" id="rate" name="rate" value="{{ data.rate }}" onchange="set_rate('rate');"></td><td>Lock Rate: <input type="checkbox" id="rate_lock" name="rate_lock" value="rl" checked=checked></td></tr>
|
||||||
<tr><td>Amount Variable</td><td><input type="checkbox" id="amt_var" name="amt_var" value="av" {% if data.amt_var==true %} checked="true"{% endif %}></td></tr>
|
<tr><td>Amount Variable</td><td><input type="checkbox" id="amt_var" name="amt_var" value="av" {% if data.amt_var==true %} checked=checked{% endif %}></td></tr>
|
||||||
<tr><td>Rate Variable</td><td><input type="checkbox" id="rate_var" name="rate_var" value="rv" {% if data.rate_var==true %} checked="true"{% endif %}></td></tr>
|
<tr><td>Rate Variable</td><td><input type="checkbox" id="rate_var" name="rate_var" value="rv" {% if data.rate_var==true %} checked=checked{% endif %}></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<input name="continue" type="submit" value="Continue">
|
<input name="continue" type="submit" value="Continue">
|
||||||
|
@ -57,8 +57,8 @@
|
|||||||
</select></td></tr>
|
</select></td></tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<tr><td>Rate</td><td><input type="text" id="rate" name="rate" value="{{ data.rate }}" readonly></td></tr>
|
<tr><td>Rate</td><td><input type="text" id="rate" name="rate" value="{{ data.rate }}" readonly></td></tr>
|
||||||
<tr><td>Amount Variable</td><td colspan=3><input type="checkbox" id="amt_var" name="amt_var_" value="av" {% if data.amt_var==true %} checked="true"{% endif %} disabled></td></tr>
|
<tr><td>Amount Variable</td><td colspan=3><input type="checkbox" id="amt_var" name="amt_var_" value="av" {% if data.amt_var==true %} checked=checked{% endif %} disabled></td></tr>
|
||||||
<tr><td>Rate Variable</td><td colspan=3><input type="checkbox" id="rate_var" name="rate_var_" value="rv" {% if data.rate_var==true %} checked="true"{% endif %} disabled></td></tr>
|
<tr><td>Rate Variable</td><td colspan=3><input type="checkbox" id="rate_var" name="rate_var_" value="rv" {% if data.rate_var==true %} checked=checked{% endif %} disabled></td></tr>
|
||||||
|
|
||||||
|
|
||||||
<tr class="padded_row"><td>Offer valid (hrs)</td><td><input type="number" name="validhrs" min="1" max="48" value="{{ data.validhrs }}"></td></tr>
|
<tr class="padded_row"><td>Offer valid (hrs)</td><td><input type="number" name="validhrs" min="1" max="48" value="{{ data.validhrs }}"></td></tr>
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<tr><td><input type="submit" name="newaddr_{{ w.cid }}" value="New Deposit Address"></td><td colspan=2>{{ w.deposit_address }}</td></tr>
|
<tr><td><input type="submit" name="newaddr_{{ w.cid }}" value="New Deposit Address"></td><td colspan=2>{{ w.deposit_address }}</td></tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<tr><td><input type="submit" name="withdraw_{{ w.cid }}" value="Withdraw" onclick="return confirmWithdrawal();"></td><td>Amount: <input type="text" name="amt_{{ w.cid }}" value="{{ w.wd_value }}"></td><td>Address: <input type="text" name="to_{{ w.cid }}" value="{{ w.wd_address }}"></td><td>Subtract fee: <input type="checkbox" name="subfee_{{ w.cid }}" {% if w.wd_subfee==true %} checked="true"{% endif %}></td></tr>
|
<tr><td><input type="submit" name="withdraw_{{ w.cid }}" value="Withdraw" onclick="return confirmWithdrawal();"></td><td>Amount: <input type="text" name="amt_{{ w.cid }}" value="{{ w.wd_value }}"></td><td>Address: <input type="text" name="to_{{ w.cid }}" value="{{ w.wd_address }}"></td><td>Subtract fee: <input type="checkbox" name="subfee_{{ w.cid }}" {% if w.wd_subfee==true %} checked=checked{% endif %}></td></tr>
|
||||||
{% if w.cid == '1' %}
|
{% if w.cid == '1' %}
|
||||||
<tr><td>Type From, To</td><td>
|
<tr><td>Type From, To</td><td>
|
||||||
<select name="withdraw_type_from_{{ w.cid }}">
|
<select name="withdraw_type_from_{{ w.cid }}">
|
||||||
|
Loading…
Reference in New Issue
Block a user