-
Notifications
You must be signed in to change notification settings - Fork 234
/
device.jinja
99 lines (98 loc) · 3.1 KB
/
device.jinja
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{% extends "base.jinja" %}
{% block main %}
<h1>{{ device.name }}</h1>
<form action="./" method="POST">
<div class="row">
{% include "device/components/device_type.jinja" %}
<button type="submit" class="btn hidden" id="settype" name="action" value="settype" style="height:15px; align-self:center;">Update</button>
</div>
</form>
<br>
<div class="table-holder">
<table>
<thead>
<tr>
<th>Network</th><th>Purpose</th><th>Derivation</th><th></th><th>Key</th><th>Actions</th>
</tr>
</thead>
<tbody>
{% for key in device.keys %}
<tr>
<td>
{% from "components/bitcoin_svg.jinja" import bitcoin_svg %}
{% if key.xpub.startswith("xpub") %}
{{ bitcoin_svg('main', 16) }} Main
{% else %}
{{ bitcoin_svg('test', 16) }} Test
{% endif %}
</td>
<td>{{ key.purpose }}</td>
<td>{{ key.derivation }}</td>
<td width="10" class="qr-trigger">
<img src="/static/img/qr_tiny.svg"/>
<qr-code class="qr-popup" value="{{key}}" width="200"></qr-code>
</td>
<td class="xpub scroll">
<span class="explorer-link" onclick="copyText('{{ key }}', 'Copied key: {{ key }}')">{{ key }}</span>
</td>
<td width="80px">
<form action="./" method="POST">
<input type="hidden" name="key" value="{{ key.original }}">
<button type="submit" name="action" value="delete_key" class="btn danger hovering">Delete</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="spacer"></div>
<div class="row">
{% if device.device_type != 'bitcoincore' %}
<form action="./" method="POST">
<button id="add_keys" type="submit" name="action" value="add_keys" class="btn centered">Add more keys</button>
</form>
{% endif %}
<form action="./" method="POST">
<button type="submit" name="action" value="forget" class="btn danger centered">Forget the device</button>
</form>
{# TODO: Add wallets used in #}
</div>
<br>
{% if wallets %}
<h1>Wallets Using This Device</h1>
<div class="row overflow">
{% for wallet in wallets %}
<a href="{{ url_for('wallet', wallet_alias=wallet.alias) }}" style="text-decoration: none;">
<div class="small-card radio">
{% if wallet.is_multisig %}
<img src="/static/img/multisig_icon.svg" width="18px">
{% else %}
<img src="/static/img/simple_icon.svg" width="18px">
{% endif %}
{{ wallet.name }}
</div>
</a>
{% endfor %}
</div>
{% endif %}
{% endblock %}
{% block scripts %}
<script>
document.addEventListener("DOMContentLoaded", function(){
var deviceType = document.getElementById("device_type");
if (deviceType != null) {
deviceType.value = '{{ device.device_type }}';
}
deviceType.addEventListener("change", function() {
var setTypeButton = document.getElementById("settype");
if (deviceType.value != '{{ device.device_type }}') {
setTypeButton.style.display = 'block';
} else {
setTypeButton.style.display = 'none';
}
}, false);
});
</script>
{% endblock %}