-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.html
73 lines (61 loc) · 1.83 KB
/
index.html
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
<html>
<head>
<title>dinero-printer</title>
</head>
<style>
body {
padding: 10px 10px 0 10px;
height: 100%;
margin: 0;
font-family: system, -apple-system, ".SFNSDisplay-Regular", "Helvetica Neue", Helvetica, "Segoe UI", sans-serif;
font-size: 13px;
line-height: 1.6;
color: #333;
background-color: #ececec;
overflow: hidden;
}
label {
display: block;
}
input {
width: 100%;
height: 30px;
line-height: 30px;
padding: 0 10px;
}
textarea {
width: 100%;
height: 80px;
margin: 0;
}
</style>
<body>
<h2>Dinero Printer</h2>
<p><label>You API key</label><input id="apiKey" onInput="updateOption(this, 'apiKey')" /></p>
<p><label>Your org Id</label><input id="orgId" onInput="updateOption(this, 'orgId')" /></p>
<p><label>Auto launch at boot</label><input id="autoStartEnabled" type="checkbox" value="true" onChange="updateOption(this, 'autoStartEnabled')" /></p>
<h2>Log</h2>
<textarea id="log"></textarea>
<script>
const electron = require('electron')
const ipc = electron.ipcRenderer
function updateOption(elmTarget, property) {
var value = elmTarget.value
if(elmTarget.type === 'checkbox') {
value = (elmTarget.checked === true) ? true : false
}
ipc.send('updateOption', property, value)
}
ipc.on('optionsUpdated', (evt, options) => {
document.getElementById('orgId').value = options.properties.orgId
document.getElementById('apiKey').value = options.properties.apiKey
document.getElementById('autoStartEnabled').checked = options.properties.autoStartEnabled
})
ipc.on('logUpdated', (evt, log) => {
document.getElementById('log').value = log
})
ipc.send('getOptions')
ipc.send('getLog')
</script>
</body>
</html>