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 pathInfo.php
More file actions
52 lines (43 loc) · 2.05 KB
/
Info.php
File metadata and controls
52 lines (43 loc) · 2.05 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
<?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;
}
$tailscaleInfo = $tailscaleInfo ?? new Info($tr);
$tailscaleStatusInfo = $tailscaleInfo->getStatusInfo();
?>
<table class="unraid t1">
<thead>
<tr>
<td><?= $tr->tr('status'); ?></td>
<td> </td>
</tr>
</thead>
<tbody>
<?php
$lockTranslate = $tr->tr("tailscale_lock");
echo Utils::printRow($tr->tr("info.version"), $tailscaleStatusInfo->TsVersion);
echo Utils::printRow($tr->tr("info.health"), $tailscaleStatusInfo->TsHealth);
echo Utils::printRow($tr->tr("info.login"), $tailscaleStatusInfo->LoggedIn);
echo Utils::printRow($tr->tr("info.netmap"), $tailscaleStatusInfo->InNetMap);
echo Utils::printRow($tr->tr("info.online"), $tailscaleStatusInfo->Online);
echo Utils::printRow($tr->tr("info.key_expire"), $tailscaleStatusInfo->KeyExpiration);
echo Utils::printRow($tr->tr("info.tags"), $tailscaleStatusInfo->Tags);
echo Utils::printRow("{$lockTranslate}: " . $tr->tr("enabled"), $tailscaleStatusInfo->LockEnabled);
echo Utils::printRow($tr->tr("info.connected_via"), $tailscaleInfo->connectedViaTS() ? $tr->tr("yes") : $tr->tr("no"));
if ($tailscaleStatusInfo->LockInfo != null) {
echo Utils::printRow("{$lockTranslate}: " . $tr->tr("info.lock.signed"), $tailscaleStatusInfo->LockInfo->LockSigned);
echo Utils::printRow("{$lockTranslate}: " . $tr->tr("info.lock.signing"), $tailscaleStatusInfo->LockInfo->LockSigning);
echo Utils::printRow("{$lockTranslate}: " . $tr->tr("info.lock.node_key"), $tailscaleStatusInfo->LockInfo->NodeKey);
echo Utils::printRow("{$lockTranslate}: " . $tr->tr("info.lock.public_key"), $tailscaleStatusInfo->LockInfo->PubKey);
}
?>
</tbody>
</table>