-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.html
316 lines (313 loc) · 21 KB
/
ui.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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
<!DOCTYPE html>
<html>
<head>
<title>Assembl Triton</title>
<link rel="stylesheet" href="styles.css" />
<link rel="stylesheet" href="resources/css/toastr.css" />
<script>
const { ipcRenderer, shell } = require('electron');
const prettySize = require('prettysize');
const keccak256 = require('js-sha3').keccak256;
const path = require('path');
const fs = require('fs');
const externalIp = require('public-ip');
const internalIp = require('internal-ip');
const errors = require('./resources/json/errors.json');
const toastr = require('toastr');
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-bottom-center",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
</script>
<script src="resources/js/socket.io.js"></script>
<script src="resources/js/socket.io-stream.js"></script>
<script src="resources/js/filehandler.js"></script>
<script src="resources/js/renderer.js"></script>
<script src="resources/js/screens.js"></script>
<script src="resources/js/sshkeygen.js"></script>
<script src="resources/js/stellarhandler.js"></script>
<script src="resources/js/webrtchandler.js"></script>
<script src="resources/js/websockethandler.js"></script>
<script src="resources/js/sftphandler.js"></script>
<script src="resources/js/kafkahandler.js"></script>
<script src="resources/js/httphandler.js"></script>
<script src="resources/js/nethandler.js"></script>
</head>
<body onload="domReady();">
<div class="screen" id="loading">
<table style="width: 100%; height: 100%;">
<tr>
<td style="text-align: center;">
<img class="assembl-logo-icon" src="resources/png/icon.png" /><div class="assembl-logo-text">Assembl</div>
<div class="underthelogo">
<img class="loading-svg" src="resources/svg/loading.svg" />
<!--<progress id="loading-progress" min="0" max="100" value="0"></progress>-->
<div id="loading-progress" style="display: none;"><div id="loading-progress-inner"></div></div>
<div id="loading-status">Loading...</div>
<div id="loading-details"></div>
<div id="loading-progress-text" style="display: none;"></div>
</div>
</td>
</tr>
</table>
</div>
<div class="screen" id="errorscreen" style="display: none;">
<table style="width: 100%; height: 100%;">
<tr>
<td style="text-align: center;">
<img class="assembl-icon" src="resources/svg/error.svg" />
<div class="undertheicon" id="purpose-selector">
<div style="margin-bottom: 12px;">An error occured</div>
<div style="font-size: 0.8em;"><span id="error-details" style="margin-bottom: 4px;">The error failed to load</span>. Error code <span id="error-code">0x0000</span></div>
<div id="error-fix" style="margin-bottom: 12px; font-size: 0.8em;">This should never happen. If it does, restart the application.</div>
<button type="button" class="connect-button error-btn" onclick="ipcRenderer.send('app-should-close');">Quit Assembl Triton</button>
<button type="button" class="connect-button error-btn" id="error-try-again-btn" style="display: none;" onclick="toastr.error('Cannot try again without closing Assembl Triton. Please close the application and then try again.');">Try Again</button>
</div>
</td>
</tr>
</table>
</div>
<div class="screen" id="passwordinputter" style="display: none;">
<table style="width: 100%; height: 100%;">
<tr>
<td style="text-align: center;">
<img class="assembl-logo-icon" src="resources/png/icon.png" /><div class="assembl-logo-text">Assembl</div>
<div class="underthelogo announcement-ready" id="purpose-selector">
<form id="password-form" onsubmit="passwordSubmit(event);" autocomplete="off" accept-charset="UTF-8">
<div>Enter your password:</div>
<input type="password" id="password" placeholder="Enter your password" required minlength="8" maxlength="46" />
<img src="resources/svg/info.svg" class="info-btn" title="Click for help" data-info="This password is used by Assembl to safely store your user data on your computer." />
<br />
<div id="password-error"></div>
<button type="submit" class="connect-button" id="password-btn">continue</button>
</form>
<div style="margin-top: 32px; font-size: 0.8em;">Forgot your password, or don't have one yet? <a id="start-fresh-btn" href="javascript:screens.startFreshStarter();">Start fresh</a></div>
</div>
</td>
</tr>
</table>
</div>
<div class="screen" id="freshstarter" style="display: none;">
<img class="screen-back" src="resources/svg/arrow_back.svg" onclick="screens.startPasswordInputter();" onkeydown="tabIndexFix(event, screens.startPasswordInputter);" title="Go back" alt="Go back" tabindex="0" />
<table style="width: 100%; height: 100%;">
<tr>
<td style="text-align: center;">
<img class="assembl-logo-icon" src="resources/png/icon.png" /><div class="assembl-logo-text">Assembl</div>
<div class="underthelogo announcement-ready" id="purpose-selector">
<form id="new-password-form" onsubmit="freshPasswordSubmit(event);" autocomplete="off" accept-charset="UTF-8">
<div>Enter a new password:</div>
<input type="password" id="freshpassword" placeholder="Enter a new password" required minlength="8" maxlength="46" />
<img src="resources/svg/info.svg" class="info-btn" title="Click for help" data-info="This password is used by Assembl to safely store your user data on your computer." />
<br />
<button type="submit" class="connect-button" id="fresh-btn">start</button>
</form>
</div>
</td>
</tr>
</table>
</div>
<div class="screen" id="purpose" style="display: none;">
<table style="width: 100%; height: 100%;">
<tr>
<td style="text-align: center;">
<img class="assembl-logo-icon" src="resources/png/icon.png" /><div class="assembl-logo-text">Assembl</div>
<div class="underthelogo" id="purpose-selector">
<div style="margin-bottom: 12px;">What would you like to do today?</div>
<button class="purpose-button" onclick="screens.startOptions();">Send data</button><button class="purpose-button" onclick="screens.startReceiver();">Receive data</button>
</div>
</td>
</tr>
</table>
</div>
<div class="screen" id="options" style="display: none;">
<img class="screen-back" src="resources/svg/arrow_back.svg" onclick="screens.startPurposeSelector();" onkeydown="tabIndexFix(event, screens.startPurposeSelector);" title="Go back" alt="Go back" tabindex="0" />
<table style="width: 100%; height: 100%;">
<tr>
<td style="text-align: center;">
<img class="assembl-logo-icon" src="resources/png/icon.png" /><div class="assembl-logo-text">Assembl</div>
<div class="underthelogo">
<form id="options-form" onsubmit="optionsSubmit(event);" autocomplete="off" accept-charset="UTF-8">
<div>Select a transfer method:</div>
<select id="protocol" onchange="protocolChange(this.value);">
<option value="webrtc">WebRTC (direct, slowest)</option>
<option value="websocket" selected>Websocket (proxy, slow)</option>
<option value="net">NET (direct, fast)</option>
<option value="http">HTTP (direct, fastest)</option>
</select>
<img src="resources/svg/info.svg" class="info-btn" title="Click for help" data-info="Both WebRTC and HTTP are direct and have no middleman involved. Websocket uses a proxy connection instead to transfer your files over the Assembl server." />
<script>
function protocolChange(opt) {
if (opt != "") {
fileHandler.protocolToUse = opt;
}
else {
toastr.error("Please select a valid transfer method.");
document.getElementById("protocol").value = "websocket";
}
}
fileHandler.protocolToUse = "websocket";
</script>
<div>Select an encryption option:</div>
<select id="encryption" onchange="encryptionChange(this.value);">
<option value="none">No encryption (fastest)</option>
<option value="2kbit" selected>2048-bit encryption (fast)</option>
<option value="4kbit" disabled>4096-bit encryption (slow)</option>
</select>
<img src="resources/svg/info.svg" class="info-btn" title="Click for help" data-info="Any sensitive data should always be sent with encryption enabled to be GDPR-compliant." />
<script>
function encryptionChange(opt) {
switch(opt) {
case "none":
fileHandler.useEncryption(false);
break;
case "2kbit":
fileHandler.useEncryption(true, "pgp", 2048);
break;
case "4kbit":
// TODO: implement it
fileHandler.useEncryption(true, "pgp", 4096);
break;
default:
toastr.error("Please select a valid encryption option.");
document.getElementById("encryption").value = "2kbit";
break;
}
}
fileHandler.useEncryption(true);
</script>
<div>Choose your license:</div>
<select id="license" onchange="licenseChange(this.value);">
<option value="none" selected>None</option>
<option value="cc4">Creative Commons 4 (CC BY 4.0)</option>
<option value="odbl">Open Database License (ODBL)</option>
</select>
<img src="resources/svg/info.svg" class="info-btn" title="Click for help" data-info="TODO" />
<script>
function licenseChange(opt) {
switch (opt) {
case "none":
fileHandler.license = "none";
break;
case "cc4":
fileHandler.license = "cc4";
break;
case "odbl":
fileHandler.license = "odbl";
break;
default:
toastr.error("This license is not supported right now. Please select a different one.");
document.getElementById("license").value = "none";
break;
}
}
fileHandler.license = "none";
</script>
<br />
<button type="submit" class="connect-button" id="options-submit-btn">continue</button>
</form>
</div>
</td>
</tr>
</table>
</div>
<div class="screen" id="peeridshowcase" style="display: none;">
<img class="screen-back" src="resources/svg/arrow_back.svg" onclick="screens.startOptions();" onkeydown="tabIndexFix(event, screens.startOptions);" title="Go back" alt="Go back" tabindex="0" />
<table style="width: 100%; height: 100%;">
<tr>
<td style="text-align: center;">
<img class="assembl-logo-icon" src="resources/png/icon.png" /><div class="assembl-logo-text">Assembl</div>
<div class="underthelogo">
<div>Give the following ID to the receiving party:</div>
<input type="text" id="yourpeerid" readonly onfocus="this.select();" onmousedown="this.select();" />
<img src="resources/svg/info.svg" class="info-btn" title="Click for help" data-info="Give this piece of text over to the person you wish to send files to. You can give it in any way thinkable: e-mail, text, a phone call... The other end must then input this number after selecting to receive files." />
</div>
</td>
</tr>
</table>
</div>
<div class="screen" id="dragdrop" style="display: none;">
<div id="filedropper">
<input type="file" name="fileChooser" id="fileChooser" onchange="fileHandler.readFile(this.files[0])" required>
<div id="filedropperborder"></div>
<div id="itemdropbox">
<div id="filedropperdragbg"></div>
<div id="itemdrop">Drag & drop<br /><br /><small class="fakebtn">or click here to select a file</small></div>
</div>
</div>
</div>
<div class="screen" id="fileconfirm" style="display: none;">
<img class="screen-back" src="resources/svg/arrow_back.svg" onclick="fileHandler.resetFile(); screens.startFileDropper();" onkeydown="tabIndexFix(event, function() { fileHandler.resetFile(); screens.startFileDropper(); });" title="Go back" alt="Go back" tabindex="0" />
<table style="width: 100%; height: 100%;">
<tr>
<td style="text-align: center;">
<img class="assembl-logo-icon" src="resources/png/icon.png" /><div class="assembl-logo-text">Assembl</div>
<div class="underthelogo">
<form id="fileconfirm-form" onsubmit="confirmSend(event);" autocomplete="off" accept-charset="UTF-8">
<div>Send this file to <span id="fileconfirm-recipient">unknown</span>?</div>
<small>File name</small>
<div id="fileconfirm-name"></div>
<small>File size</small>
<div id="fileconfirm-size"></div>
<small>Add a short description...</small>
<input type="text" id="fileconfirm-description" placeholder="Not required but helpful" maxlength="256" />
<img src="resources/svg/info.svg" class="info-btn" title="Click for help" data-info="A description of what the file being sent is about. This description will get added to the transfer information for future references." />
<br />
<button type="submit" class="connect-button" id="fileconfirm-button">start transfer</button>
</form>
</div>
</td>
</tr>
</table>
</div>
<div class="screen" id="receiver" style="display: none;">
<img class="screen-back" src="resources/svg/arrow_back.svg" onclick="screens.startPurposeSelector();" onkeydown="tabIndexFix(event, screens.startPurposeSelector);" title="Go back" alt="Go back" tabindex="0" />
<table style="width: 100%; height: 100%;">
<tr>
<td style="text-align: center;">
<img class="assembl-logo-icon" src="resources/png/icon.png" /><div class="assembl-logo-text">Assembl</div>
<div class="underthelogo">
<form id="receiver-input-form" onsubmit="formSubmit(event);" autocomplete="off" accept-charset="UTF-8">
<div>Enter the sender ID:</div>
<input type="text" id="senderpeerid" placeholder="ASXXXXXXXXXX" required pattern="^(AS|as)([A-z0-9]{10})$" title="The sender ID (ASXXXXXXXXXX)" maxlength="12" />
<img src="resources/svg/info.svg" class="info-btn" title="Click for help" data-info="Enter the sender ID here. The sender ID is a short piece of text of 12 characters which must be given to you by the person who will be sending you any data." />
<br />
<div id="bonjour-finder" style="display: none;">
<div>Or select someone from your local network:</div>
<select id="bonjour-finder-selector" onchange="bonjourSelectorChange(this.value);">
<option id="bonjour-finder-preset" value="preset" selected disabled>Found 0 connections on LAN</option>
</select>
<script>
function bonjourSelectorChange(val) {
document.getElementById("senderpeerid").value = val;
document.getElementById("bonjour-finder-selector").value = "preset";
}
</script>
</div>
<button type="submit" class="connect-button" id="connect-btn">connect</button>
</form>
</div>
</td>
</tr>
</table>
</div>
<div id="copyright">Assembl Triton v<span id="app-version"></span> © Assembl Inc. 2019</div>
<div id="verif" style="display: none;">
<div id="verif-conn">Connected with</div>
<div id="verif-name-holder"><a href="https://accounts.assembl.net/user/?id=unset&closebtn" target="_blank" onclick="event.preventDefault(); shell.openExternal(this.href);" id="verif-name" title="Show user overview">unknown</a></div>
</div>
<script> document.getElementById("app-version").innerHTML = ipcRenderer.sendSync('appversion-request'); </script>
</body>
</html>