This repository was archived by the owner on Jul 31, 2025. It is now read-only.
forked from dkaser/unraid-tailscale-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatus.php
More file actions
76 lines (65 loc) · 2.57 KB
/
Copy pathStatus.php
File metadata and controls
76 lines (65 loc) · 2.57 KB
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
<?php
namespace Tailscale;
use EDACerton\PluginUtils\Translator;
if ( ! defined(__NAMESPACE__ . '\PLUGIN_ROOT') || ! defined(__NAMESPACE__ . '\PLUGIN_NAME')) {
throw new \RuntimeException("Common file not loaded.");
}
$tr = $tr ?? new Translator(PLUGIN_ROOT);
$tailscaleConfig = $tailscaleConfig ?? new Config();
if ( ! $tailscaleConfig->Enable) {
echo($tr->tr("tailscale_disabled"));
return;
}
?>
<script src="/webGui/javascript/jquery.tablesorter.widgets.js"></script>
<script>
function controlsDisabled(val) {
$('#statusTable_refresh').prop('disabled', val);
$('input.ping').prop('disabled', val);
}
function showStatus() {
controlsDisabled(true);
$.post('/plugins/tailscale/include/data/Status.php',{action: 'get',mullvad: $("#statusTable_mullvad").prop('checked'), shared: $("#statusTable_shared").prop('checked')},function(data){
clearTimeout(timers.refresh);
$("#statusTable").trigger("destroy");
$('#statusTable').html(data.html);
$('#statusTable').tablesorter({
widthFixed : true,
sortList: [[0,0]],
sortAppend: [[0,0]],
widgets: ['stickyHeaders','filter','zebra'],
widgetOptions: {
// on black and white, offset is height of #menu
// on azure and gray, offset is height of #header
stickyHeaders_offset: ($('#menu').height() < 50) ? $('#menu').height() : $('#header').height(),
filter_columnFilters: true,
filter_reset: '.reset',
filter_liveSearch: true,
zebra: ["normal-row","alt-row"]
}
});
$('div.spinner.fixed').hide('fast');
controlsDisabled(false);
},"json");
}
async function pingHost(host) {
$('div.spinner.fixed').show('fast');
controlsDisabled(true);
var res = await $.post('/plugins/tailscale/include/data/Status.php',{action: 'ping', host: host});
$("#status_pingout").html("<strong>Ping response:</strong><br>" + res);
showStatus();
}
showStatus();
</script>
<table id='statusTable' class="unraid statusTable tablesorter"><tr><td><div class="spinner"></div></td></tr></table><br>
<table>
<tr>
<td style="vertical-align: top">
<input type="button" id="statusTable_refresh" value="Refresh" onclick="showStatus()">
<button type="button" class="reset">Reset Filters</button>
<input type="checkbox" id="statusTable_mullvad" onChange="showStatus()">Display inactive Mullvad nodes
<input type="checkbox" id="statusTable_shared" onChange="showStatus()">Display inactive shared-in nodes
</td>
<td><div id="status_pingout" style="float: right;"></div></td>
</tr>
</table>