Browse Source

update peers table add online status check

main
ghost 11 months ago
parent
commit
bdfade8ca2
  1. 50
      js/network.js
  2. 48
      network.html
  3. 48
      uk/network.html

50
js/network.js

@ -1,53 +1,35 @@
function peerLookupYggdrasil(element) { function peerLookup(element) {
// Get online status var host = $(element).data('host');
// @TODO var port = $(element).data('port');
// If provided, set special status
if ($(element).data('yggdrasil').length > 0) {
$(element).children('td:eq(0)').find('i').removeClass('c-5');
$(element).children('td:eq(0)').find('i').addClass('c-6');
}
}
function peerLookupIpv6(element) {
// Get online status // Get online status
// @TODO
// Get country
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: 'https://ipapi.co/' + $(element).data('ipv4') + '/json', url: 'https://api.twisterarmy.dedyn.io/socket.php?host=' + host + '&port=' + port,
dataType: 'json', dataType: 'json',
success: function (result) { success: function (result) {
if (result.country_code && result.country_code != '' && result.country_code != 'undefined') { if (result.success) {
// Set country // Set online
$(element).children('td:eq(1)').text(result.country_code); $(element).children('td:eq(0)').find('i').removeClass('c-5');
$(element).children('td:eq(0)').find('i').addClass('c-7');
} }
} }
}); });
}
function peerLookupIpv4(element) {
// Get online status
// @TODO
// Get country // Get country
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: 'https://ipapi.co/' + $(element).data('ipv4') + '/json', url: 'https://ipapi.co/' + host + '/json',
dataType: 'json', dataType: 'json',
success: function (result) { success: function (result) {
if (result.country_code && result.country_code != '' && result.country_code != 'undefined') { if (result.country_code && result.country_code != '' && result.country_code != 'undefined') {
// Set country // Set country
$(element).children('td:eq(1)').text(result.country_code); $(element).children('td:eq(2)').text(result.country_code);
} }
} }
}); });
@ -107,16 +89,8 @@ $(document).ready(function() {
}); });
// Check peers // Check peers
$('#peers tr[data-yggdrasil]').each(function() { $('#peers tr[data-peer]').each(function() {
peerLookupYggdrasil(this); peerLookup(this);
});
$('#peers tr[data-ipv6]').each(function() {
peerLookupIpv6(this);
});
$('#peers tr[data-ipv4]').each(function() {
peerLookupIpv4(this);
}); });
/* /*

48
network.html

@ -24,7 +24,7 @@
<script src="/js/jquery.vmap.js"></script> <script src="/js/jquery.vmap.js"></script>
<script src="/js/jquery.vmap.world.js"></script> <script src="/js/jquery.vmap.world.js"></script>
--> -->
<script src="/js/network.js?v=4"></script> <script src="/js/network.js?v=5"></script>
</head> </head>
<body class="bg-c-1 bg-img-1 c-0"> <body class="bg-c-1 bg-img-1 c-0">
<div class="bg-c-2 bg-img-2 c-1 of-hidden position-fixed z-i-99 position-t-0 position-x-0"> <div class="bg-c-2 bg-img-2 c-1 of-hidden position-fixed z-i-99 position-t-0 position-x-0">
@ -149,21 +149,45 @@
<table class="w-100-100" id="peers"> <table class="w-100-100" id="peers">
<tr> <tr>
<th class="t-center bb-2 b-c-6 py-16 px-8">Status</th> <th class="t-center bb-2 b-c-6 py-16 px-8">Status</th>
<th class="t-left pl-26 bb-2 b-c-6 py-16 px-8">Address</th>
<th class="t-center bb-2 b-c-6 py-16 px-8">Location</th> <th class="t-center bb-2 b-c-6 py-16 px-8">Location</th>
<th class="t-left pl-26 bb-2 b-c-6 py-16 px-8">IPv4</th> <th class="t-left pl-26 bb-2 b-c-6 py-16 px-8">Comment</th>
<th class="t-left bb-2 b-c-6 py-16 px-8">IPv6</th>
<th class="t-left bb-2 b-c-6 py-16 px-8">Yggdrasil</th>
<th class="t-center bb-2 b-c-6 py-16 px-8">Port TCP</th>
<th class="t-center bb-2 b-c-6 py-16 px-8">Port UDP+TCP</th>
</tr> </tr>
<tr data-ipv4="94.140.114.241" data-ipv6="2a02:7aa0:4000::f2" data-yggdrasil="301:23b4:991a:634d::33"> <tr data-peer="94.140.114.241:28333" data-host="94.140.114.241" data-port="28333">
<td class="t-center bb-2 b-c-6 py-16 px-8"><i class="bi-circle-fill mr-6 f-size-10 p-16 c-5"></i></td> <td class="t-center bb-2 b-c-6 py-16 px-8"><i class="bi-circle-fill mr-6 f-size-10 p-16 c-5"></i></td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">94.140.114.241:28333</td>
<td class="t-center bb-2 b-c-6 py-16 px-8">-</td> <td class="t-center bb-2 b-c-6 py-16 px-8">-</td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">94.140.114.241</td> <td class="t-left pl-26 bb-2 b-c-6 p-8">Clearnet / TCP</td>
<td class="t-left bb-2 b-c-6 p-8">2a02:7aa0:4000::f2</td> </tr>
<td class="t-left bb-2 b-c-6 p-8">301:23b4:991a:634d::33</td> <tr data-peer="94.140.114.241:28333" data-host="94.140.114.241" data-port="29333">
<td class="t-center bb-2 b-c-6 p-8">28333</td> <td class="t-center bb-2 b-c-6 py-16 px-8"><i class="bi-circle-fill mr-6 f-size-10 p-16 c-5"></i></td>
<td class="t-center bb-2 b-c-6 p-8">29333</td> <td class="t-left pl-26 bb-2 b-c-6 p-8">94.140.114.241:29333</td>
<td class="t-center bb-2 b-c-6 py-16 px-8">-</td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">Clearnet / UDP+TCP</td>
</tr>
<tr data-peer="[2a02:7aa0:4000::f2]:28333" data-host="2a02:7aa0:4000::f2" data-port="28333">
<td class="t-center bb-2 b-c-6 py-16 px-8"><i class="bi-circle-fill mr-6 f-size-10 p-16 c-5"></i></td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">[2a02:7aa0:4000::f2]:28333</td>
<td class="t-center bb-2 b-c-6 py-16 px-8">-</td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">Clearnet / TCP</td>
</tr>
<tr data-peer="[2a02:7aa0:4000::f2]:29333" data-host="2a02:7aa0:4000::f2" data-port="29333">
<td class="t-center bb-2 b-c-6 py-16 px-8"><i class="bi-circle-fill mr-6 f-size-10 p-16 c-5"></i></td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">[2a02:7aa0:4000::f2]:29333</td>
<td class="t-center bb-2 b-c-6 py-16 px-8">-</td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">Clearnet / UDP+TCP</td>
</tr>
<tr data-peer="[301:23b4:991a:634d::33]:28333" data-host="301:23b4:991a:634d::33" data-port="28333">
<td class="t-center bb-2 b-c-6 py-16 px-8"><i class="bi-circle-fill mr-6 f-size-10 p-16 c-5"></i></td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">[301:23b4:991a:634d::33]:28333</td>
<td class="t-center bb-2 b-c-6 py-16 px-8">-</td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">Yggdrasil / TCP</td>
</tr>
<tr data-peer="[301:23b4:991a:634d::33]:29333" data-host="301:23b4:991a:634d::33" data-port="29333">
<td class="t-center bb-2 b-c-6 py-16 px-8"><i class="bi-circle-fill mr-6 f-size-10 p-16 c-5"></i></td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">[301:23b4:991a:634d::33]:29333</td>
<td class="t-center bb-2 b-c-6 py-16 px-8">-</td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">Yggdrasil / UDP+TCP</td>
</tr> </tr>
</table> </table>
</div> </div>

48
uk/network.html

@ -25,7 +25,7 @@
<script src="/js/jquery.vmap.js"></script> <script src="/js/jquery.vmap.js"></script>
<script src="/js/jquery.vmap.world.js"></script> <script src="/js/jquery.vmap.world.js"></script>
--> -->
<script src="/js/network.js?v=3"></script> <script src="/js/network.js?v=5"></script>
</head> </head>
<body class="bg-c-1 bg-img-1 c-0"> <body class="bg-c-1 bg-img-1 c-0">
<div class="bg-c-2 bg-img-2 c-1 of-hidden position-fixed z-i-99 position-t-0 position-x-0"> <div class="bg-c-2 bg-img-2 c-1 of-hidden position-fixed z-i-99 position-t-0 position-x-0">
@ -150,21 +150,45 @@
<table class="w-100-100" id="peers"> <table class="w-100-100" id="peers">
<tr> <tr>
<th class="t-center bb-2 b-c-6 py-16 px-8">Статус</th> <th class="t-center bb-2 b-c-6 py-16 px-8">Статус</th>
<th class="t-left pl-26 bb-2 b-c-6 py-16 px-8">Адреса</th>
<th class="t-center bb-2 b-c-6 py-16 px-8">Розташування</th> <th class="t-center bb-2 b-c-6 py-16 px-8">Розташування</th>
<th class="t-left pl-26 bb-2 b-c-6 py-16 px-8">IPv4</th> <th class="t-left pl-26 bb-2 b-c-6 py-16 px-8">Коментар</th>
<th class="t-left bb-2 b-c-6 py-16 px-8">IPv6</th>
<th class="t-left bb-2 b-c-6 py-16 px-8">Yggdrasil</th>
<th class="t-center bb-2 b-c-6 py-16 px-8">Порт TCP</th>
<th class="t-center bb-2 b-c-6 py-16 px-8">Порт UDP+TCP</th>
</tr> </tr>
<tr data-ipv4="94.140.114.241" data-ipv6="2a02:7aa0:4000::f2" data-yggdrasil="301:23b4:991a:634d::33"> <tr data-peer="94.140.114.241:28333" data-host="94.140.114.241" data-port="28333">
<td class="t-center bb-2 b-c-6 py-16 px-8"><i class="bi-circle-fill mr-6 f-size-10 p-16 c-5"></i></td> <td class="t-center bb-2 b-c-6 py-16 px-8"><i class="bi-circle-fill mr-6 f-size-10 p-16 c-5"></i></td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">94.140.114.241:28333</td>
<td class="t-center bb-2 b-c-6 py-16 px-8">-</td> <td class="t-center bb-2 b-c-6 py-16 px-8">-</td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">94.140.114.241</td> <td class="t-left pl-26 bb-2 b-c-6 p-8">Інтернет / TCP</td>
<td class="t-left bb-2 b-c-6 p-8">2a02:7aa0:4000::f2</td> </tr>
<td class="t-left bb-2 b-c-6 p-8">301:23b4:991a:634d::33</td> <tr data-peer="94.140.114.241:28333" data-host="94.140.114.241" data-port="29333">
<td class="t-center bb-2 b-c-6 p-8">28333</td> <td class="t-center bb-2 b-c-6 py-16 px-8"><i class="bi-circle-fill mr-6 f-size-10 p-16 c-5"></i></td>
<td class="t-center bb-2 b-c-6 p-8">29333</td> <td class="t-left pl-26 bb-2 b-c-6 p-8">94.140.114.241:29333</td>
<td class="t-center bb-2 b-c-6 py-16 px-8">-</td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">Інтернет / UDP+TCP</td>
</tr>
<tr data-peer="[2a02:7aa0:4000::f2]:28333" data-host="2a02:7aa0:4000::f2" data-port="28333">
<td class="t-center bb-2 b-c-6 py-16 px-8"><i class="bi-circle-fill mr-6 f-size-10 p-16 c-5"></i></td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">[2a02:7aa0:4000::f2]:28333</td>
<td class="t-center bb-2 b-c-6 py-16 px-8">-</td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">Інтернет / TCP</td>
</tr>
<tr data-peer="[2a02:7aa0:4000::f2]:29333" data-host="2a02:7aa0:4000::f2" data-port="29333">
<td class="t-center bb-2 b-c-6 py-16 px-8"><i class="bi-circle-fill mr-6 f-size-10 p-16 c-5"></i></td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">[2a02:7aa0:4000::f2]:29333</td>
<td class="t-center bb-2 b-c-6 py-16 px-8">-</td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">Інтернет / UDP+TCP</td>
</tr>
<tr data-peer="[301:23b4:991a:634d::33]:28333" data-host="301:23b4:991a:634d::33" data-port="28333">
<td class="t-center bb-2 b-c-6 py-16 px-8"><i class="bi-circle-fill mr-6 f-size-10 p-16 c-5"></i></td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">[301:23b4:991a:634d::33]:28333</td>
<td class="t-center bb-2 b-c-6 py-16 px-8">-</td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">Yggdrasil / TCP</td>
</tr>
<tr data-peer="[301:23b4:991a:634d::33]:29333" data-host="301:23b4:991a:634d::33" data-port="29333">
<td class="t-center bb-2 b-c-6 py-16 px-8"><i class="bi-circle-fill mr-6 f-size-10 p-16 c-5"></i></td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">[301:23b4:991a:634d::33]:29333</td>
<td class="t-center bb-2 b-c-6 py-16 px-8">-</td>
<td class="t-left pl-26 bb-2 b-c-6 p-8">Yggdrasil / UDP+TCP</td>
</tr> </tr>
</table> </table>
</div> </div>

Loading…
Cancel
Save