|
|
@ -100,7 +100,7 @@ class HttpHandler(BaseHTTPRequestHandler): |
|
|
|
form_id = form_data[b'formid'][0].decode('utf-8') |
|
|
|
form_id = form_data[b'formid'][0].decode('utf-8') |
|
|
|
if self.server.last_form_id.get(name, None) == form_id: |
|
|
|
if self.server.last_form_id.get(name, None) == form_id: |
|
|
|
messages.append('Prevented double submit for form {}.'.format(form_id)) |
|
|
|
messages.append('Prevented double submit for form {}.'.format(form_id)) |
|
|
|
else: |
|
|
|
return None |
|
|
|
self.server.last_form_id[name] = form_id |
|
|
|
self.server.last_form_id[name] = form_id |
|
|
|
return form_data |
|
|
|
return form_data |
|
|
|
|
|
|
|
|
|
|
@ -184,7 +184,8 @@ class HttpHandler(BaseHTTPRequestHandler): |
|
|
|
explorer = -1 |
|
|
|
explorer = -1 |
|
|
|
action = -1 |
|
|
|
action = -1 |
|
|
|
messages = [] |
|
|
|
messages = [] |
|
|
|
form_data = self.checkForm(post_string, 'explorers', messages) |
|
|
|
err_messages = [] |
|
|
|
|
|
|
|
form_data = self.checkForm(post_string, 'explorers', err_messages) |
|
|
|
if form_data: |
|
|
|
if form_data: |
|
|
|
|
|
|
|
|
|
|
|
explorer = form_data[b'explorer'][0].decode('utf-8') |
|
|
|
explorer = form_data[b'explorer'][0].decode('utf-8') |
|
|
@ -211,6 +212,8 @@ class HttpHandler(BaseHTTPRequestHandler): |
|
|
|
|
|
|
|
|
|
|
|
template = env.get_template('explorers.html') |
|
|
|
template = env.get_template('explorers.html') |
|
|
|
return self.render_template(template, { |
|
|
|
return self.render_template(template, { |
|
|
|
|
|
|
|
'messages': messages, |
|
|
|
|
|
|
|
'err_messages': err_messages, |
|
|
|
'explorers': listAvailableExplorers(swap_client), |
|
|
|
'explorers': listAvailableExplorers(swap_client), |
|
|
|
'explorer': explorer, |
|
|
|
'explorer': explorer, |
|
|
|
'actions': listExplorerActions(swap_client), |
|
|
|
'actions': listExplorerActions(swap_client), |
|
|
@ -227,7 +230,8 @@ class HttpHandler(BaseHTTPRequestHandler): |
|
|
|
coin_type = -1 |
|
|
|
coin_type = -1 |
|
|
|
coin_id = -1 |
|
|
|
coin_id = -1 |
|
|
|
messages = [] |
|
|
|
messages = [] |
|
|
|
form_data = self.checkForm(post_string, 'rpc', messages) |
|
|
|
err_messages = [] |
|
|
|
|
|
|
|
form_data = self.checkForm(post_string, 'rpc', err_messages) |
|
|
|
if form_data: |
|
|
|
if form_data: |
|
|
|
try: |
|
|
|
try: |
|
|
|
coin_id = int(form_data[b'coin_type'][0]) |
|
|
|
coin_id = int(form_data[b'coin_type'][0]) |
|
|
@ -273,6 +277,8 @@ class HttpHandler(BaseHTTPRequestHandler): |
|
|
|
coins.append((-4, 'Monero Wallet')) |
|
|
|
coins.append((-4, 'Monero Wallet')) |
|
|
|
|
|
|
|
|
|
|
|
return self.render_template(template, { |
|
|
|
return self.render_template(template, { |
|
|
|
|
|
|
|
'messages': messages, |
|
|
|
|
|
|
|
'err_messages': err_messages, |
|
|
|
'coins': coins, |
|
|
|
'coins': coins, |
|
|
|
'coin_type': coin_id, |
|
|
|
'coin_type': coin_id, |
|
|
|
'result': result, |
|
|
|
'result': result, |
|
|
@ -286,18 +292,20 @@ class HttpHandler(BaseHTTPRequestHandler): |
|
|
|
|
|
|
|
|
|
|
|
result = None |
|
|
|
result = None |
|
|
|
messages = [] |
|
|
|
messages = [] |
|
|
|
form_data = self.checkForm(post_string, 'wallets', messages) |
|
|
|
err_messages = [] |
|
|
|
|
|
|
|
form_data = self.checkForm(post_string, 'wallets', err_messages) |
|
|
|
if form_data: |
|
|
|
if form_data: |
|
|
|
if have_data_entry(form_data, 'reinit_xmr'): |
|
|
|
if have_data_entry(form_data, 'reinit_xmr'): |
|
|
|
try: |
|
|
|
try: |
|
|
|
swap_client.initialiseWallet(Coins.XMR) |
|
|
|
swap_client.initialiseWallet(Coins.XMR) |
|
|
|
messages.append('Done.') |
|
|
|
messages.append('Done.') |
|
|
|
except Exception as a: |
|
|
|
except Exception as a: |
|
|
|
messages.append('Failed.') |
|
|
|
err_messages.append('Failed.') |
|
|
|
|
|
|
|
|
|
|
|
template = env.get_template('debug.html') |
|
|
|
template = env.get_template('debug.html') |
|
|
|
return self.render_template(template, { |
|
|
|
return self.render_template(template, { |
|
|
|
'messages': messages, |
|
|
|
'messages': messages, |
|
|
|
|
|
|
|
'err_messages': err_messages, |
|
|
|
'result': result, |
|
|
|
'result': result, |
|
|
|
'summary': summary, |
|
|
|
'summary': summary, |
|
|
|
}) |
|
|
|
}) |
|
|
@ -319,7 +327,8 @@ class HttpHandler(BaseHTTPRequestHandler): |
|
|
|
summary = swap_client.getSummary() |
|
|
|
summary = swap_client.getSummary() |
|
|
|
|
|
|
|
|
|
|
|
messages = [] |
|
|
|
messages = [] |
|
|
|
form_data = self.checkForm(post_string, 'settings', messages) |
|
|
|
err_messages = [] |
|
|
|
|
|
|
|
form_data = self.checkForm(post_string, 'settings', err_messages) |
|
|
|
if form_data: |
|
|
|
if form_data: |
|
|
|
for name, c in swap_client.settings['chainclients'].items(): |
|
|
|
for name, c in swap_client.settings['chainclients'].items(): |
|
|
|
if have_data_entry(form_data, 'apply_' + name): |
|
|
|
if have_data_entry(form_data, 'apply_' + name): |
|
|
@ -389,6 +398,7 @@ class HttpHandler(BaseHTTPRequestHandler): |
|
|
|
template = env.get_template('settings.html') |
|
|
|
template = env.get_template('settings.html') |
|
|
|
return self.render_template(template, { |
|
|
|
return self.render_template(template, { |
|
|
|
'messages': messages, |
|
|
|
'messages': messages, |
|
|
|
|
|
|
|
'err_messages': err_messages, |
|
|
|
'chains': chains_formatted, |
|
|
|
'chains': chains_formatted, |
|
|
|
'summary': summary, |
|
|
|
'summary': summary, |
|
|
|
}) |
|
|
|
}) |
|
|
@ -412,10 +422,11 @@ class HttpHandler(BaseHTTPRequestHandler): |
|
|
|
|
|
|
|
|
|
|
|
page_data = {} |
|
|
|
page_data = {} |
|
|
|
messages = [] |
|
|
|
messages = [] |
|
|
|
|
|
|
|
err_messages = [] |
|
|
|
smsgaddresses = [] |
|
|
|
smsgaddresses = [] |
|
|
|
|
|
|
|
|
|
|
|
listaddresses = True |
|
|
|
listaddresses = True |
|
|
|
form_data = self.checkForm(post_string, 'smsgaddresses', messages) |
|
|
|
form_data = self.checkForm(post_string, 'smsgaddresses', err_messages) |
|
|
|
if form_data: |
|
|
|
if form_data: |
|
|
|
edit_address_id = None |
|
|
|
edit_address_id = None |
|
|
|
for key in form_data: |
|
|
|
for key in form_data: |
|
|
@ -473,6 +484,7 @@ class HttpHandler(BaseHTTPRequestHandler): |
|
|
|
template = env.get_template('smsgaddresses.html') |
|
|
|
template = env.get_template('smsgaddresses.html') |
|
|
|
return self.render_template(template, { |
|
|
|
return self.render_template(template, { |
|
|
|
'messages': messages, |
|
|
|
'messages': messages, |
|
|
|
|
|
|
|
'err_messages': err_messages, |
|
|
|
'data': page_data, |
|
|
|
'data': page_data, |
|
|
|
'smsgaddresses': smsgaddresses, |
|
|
|
'smsgaddresses': smsgaddresses, |
|
|
|
'network_addr': network_addr, |
|
|
|
'network_addr': network_addr, |
|
|
@ -487,7 +499,8 @@ class HttpHandler(BaseHTTPRequestHandler): |
|
|
|
|
|
|
|
|
|
|
|
page_data = {'identity_address': identity_address} |
|
|
|
page_data = {'identity_address': identity_address} |
|
|
|
messages = [] |
|
|
|
messages = [] |
|
|
|
form_data = self.checkForm(post_string, 'identity', messages) |
|
|
|
err_messages = [] |
|
|
|
|
|
|
|
form_data = self.checkForm(post_string, 'identity', err_messages) |
|
|
|
if form_data: |
|
|
|
if form_data: |
|
|
|
if have_data_entry(form_data, 'edit'): |
|
|
|
if have_data_entry(form_data, 'edit'): |
|
|
|
page_data['show_edit_form'] = True |
|
|
|
page_data['show_edit_form'] = True |
|
|
@ -498,7 +511,7 @@ class HttpHandler(BaseHTTPRequestHandler): |
|
|
|
swap_client.updateIdentity(identity_address, new_label) |
|
|
|
swap_client.updateIdentity(identity_address, new_label) |
|
|
|
messages.append('Updated') |
|
|
|
messages.append('Updated') |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
messages.append('Error') |
|
|
|
err_messages.append(str(e)) |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
identity = swap_client.getIdentity(identity_address) |
|
|
|
identity = swap_client.getIdentity(identity_address) |
|
|
@ -517,6 +530,7 @@ class HttpHandler(BaseHTTPRequestHandler): |
|
|
|
template = env.get_template('identity.html') |
|
|
|
template = env.get_template('identity.html') |
|
|
|
return self.render_template(template, { |
|
|
|
return self.render_template(template, { |
|
|
|
'messages': messages, |
|
|
|
'messages': messages, |
|
|
|
|
|
|
|
'err_messages': err_messages, |
|
|
|
'data': page_data, |
|
|
|
'data': page_data, |
|
|
|
'summary': summary, |
|
|
|
'summary': summary, |
|
|
|
}) |
|
|
|
}) |
|
|
|