-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
177 lines (174 loc) · 5.39 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
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
<!doctype html>
<html>
<head>
<title>FIN4Xplorer Notification Server</title>
<style>
html * {
font-family: arial;
}
#eventsTable {
border-collapse: collapse;
}
#eventsTable td,
#eventsTable th {
font-size: small;
border: 1px solid silver;
padding: 7px;
}
.ethAddressRequired {
display: none;
}
</style>
<script src="/socket.io/socket.io.js"></script>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
</head>
<body>
<h3 id='welcome'>Welcome to the FIN4Notifications Server</h3>
<div>
Here you can subscribe by email to smart contract events emitted from the FIN4Xplorer application.<br>
If share only your email address, you can subscribe to events addressed to anyone. If you furthermore<br>
supply your Ethereum public address, you can subscribe to events specificially for your account.<br><br>
<small><i>
Privacy notice: one cornerstone of the web3 in general and one of our basic design principals is, that users<br>
of FIN4Xplorer don't have to expose anything from themselves other then their public address. Any link<br>
to your idendity beyond that, has to happen voluntarily and after explicit consent. When you supply your<br>
email address <b>and</b> your Ethereum public address here, you are trading the convenience of receiving<br>
notifications while not being on the site, with establishing a link between your blockchain idendity and<br>
your email address. Of course, that info lives only on our server, you can unsubscribe at any time and<br>
we are on the Rinkeby testnet for now. But servers can be hacked and log files stick around. You are<br>
most welcome to use this service (that's why we built it), we just want to make sure you understand the<br>
implications of doing so.
</i></small>
</div>
<br><br>
<table>
<tbody>
<tr>
<td>
Your email address:
</td>
<td>
<input type="text" id="email" size="60">
</td>
</tr>
<tr>
<td>
Your Ethereum public address <small>(optional)</small>:
</td>
<td>
<input type="text" id="ethAddress" size="60">
</td>
</tr>
<tr>
<td>
Contract events to subscribe to:
</td>
<td>
<br>
<table id='eventsTable'>
<tbody>
<tr>
<td>
<center><b>general</b></center>
</td>
<td class='ethAddressRequired'>
<center><b>account-specific</b></center>
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="Fin4TokenCreated" checked>
New token created
</td>
<td class='ethAddressRequired'>
<input type="checkbox" id="ClaimApproved" checked>
Claim approved<br>
<input type="checkbox" id="ClaimRejected" checked>
Claim rejected<br>
<input type="checkbox" id="VerifierApproved">
Verifier approved<br>
<input type="checkbox" id="VerifierRejected">
Verifier rejected<br>
<input type="checkbox" id="NewMessage" checked=>
New message<br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<tr>
<td colspan="2">
<br>
<input id="submitBtn" type="submit" value="Submit">
</td>
</tr>
</tbody>
</table>
<br>
<div id="info"></div>
<br><br><br>
You can also use our <a href="https://t.me/FIN4Notifications_bot">Telegram bot</a> to subscribe to events.
<script>
const display = msg => {
$('#info').html(msg);
};
let params = new window.URLSearchParams(window.location.search);
if (params.get('email')) {
$('#email').val(params.get('email'));
}
if (params.get('ethAddress')) {
$('#ethAddress').val(params.get('ethAddress'));
}
if ($('#ethAddress').val()) {
$('.ethAddressRequired').show();
}
$('#ethAddress').on('input', e => {
if($('#ethAddress').val()) {
$('.ethAddressRequired').fadeIn('slow');
} else {
$('.ethAddressRequired').fadeOut('slow');
}
});
let socket = io();
socket.emit('get-fin4-url', null);
socket.on('get-fin4-url-result', url => {
let link = '<a href="' + url + '">' + url.split('//')[1] + '</a>';
$('#welcome').html('Welcome to the FIN4Notifications Server for ' + link);
});
socket.on('email-signup-result', msg => {
display(msg);
});
$('#submitBtn').click(() => {
let email = $('#email').val();
if (!email) {
display('No email provided');
return;
}
let ethAddress = $('#ethAddress').val();
let events = {
Fin4TokenCreated: $('#Fin4TokenCreated').prop('checked'),
ClaimApproved: $('#ClaimApproved').prop('checked'),
ClaimRejected: $('#ClaimRejected').prop('checked'),
VerifierApproved: $('#VerifierApproved').prop('checked'),
VerifierRejected: $('#VerifierRejected').prop('checked'),
NewMessage: $('#NewMessage').prop('checked')
};
let checkedCount = Object.keys(events).filter(eventName => events[eventName]).length;
if ((!ethAddress && !events.Fin4TokenCreated) || (ethAddress && checkedCount === 0)) {
display('No contract events selected')
return;
}
let msg = {
email: email,
ethAddress: ethAddress,
events: events
};
display('Submitting...');
socket.emit('email-signup', msg);
console.log('Sent email-signup to server', msg);
});
</script>
</body>
</html>