Skip to content

Commit

Permalink
fix: html validation
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaser committed Nov 6, 2024
1 parent c0e1983 commit 65b8898
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ function showLog(log) {
</script>
<span><span class='lite label'>Log size:&nbsp;&nbsp;<input type='number' id='max' value='' placeholder='<?= $max;?>'></span><?= $select;?></span>
<input type="button" value="Refresh" onclick="showLog(logfile)">
<?php if (file_exists('/usr/local/emhttp/plugins/plugin-diagnostics/download.php')) { ?> <input type="button" value="<?= $tr->tr("settings.diagnostics"); ?>" onclick="window.open('/plugins/plugin-diagnostics/download.php?plugin=tailscale','_blank')" /><?php } ?>
<?php if (file_exists('/usr/local/emhttp/plugins/plugin-diagnostics/download.php')) { ?> <input type="button" value="<?= $tr->tr("settings.diagnostics"); ?>" onclick="window.open('/plugins/plugin-diagnostics/download.php?plugin=tailscale','_blank')"><?php } ?>
<pre class='u'></pre>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
showStatus('tailscaled');
});
</script>
<link type="text/css" rel="stylesheet" href="/plugins/tailscale/style.css">
<?php
if ( ! $tailscaleConfig->Enable) {
echo($tr->tr("tailscale_disabled"));
Expand Down
29 changes: 7 additions & 22 deletions src/usr/local/emhttp/plugins/tailscale/include/Pages/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,14 @@
return;
}
?>
<style>
.fileTree {
background:
<?= strstr('white,azure', $display['theme']) ? '#f2f2f2' : '#1c1c1c'; ?>
;
width: 300px;
max-height: 150px;
overflow-y: scroll;
overflow-x: hidden;
position: absolute;
z-index: 100;
display: none
}
.advanced{display:none}
</style>
<link type="text/css" rel="stylesheet" href="<?= Utils::auto_v('/webGui/styles/jquery.filetree.css');?>">
<link type="text/css" rel="stylesheet" href="<?= Utils::auto_v('/webGui/styles/jquery.switchbutton.css');?>">
<span class="status vhshift"><input type="checkbox" class="advancedview"></span>
<form method="POST" action="/update.php" target="progressFrame">
<input type="hidden" name="#file"
value="tailscale/tailscale.cfg" />
<input type="hidden" name="#cleanup" value="" />
<input type="hidden" name="#command" value="/usr/local/emhttp/plugins/tailscale/restart.sh" />
value="tailscale/tailscale.cfg">
<input type="hidden" name="#cleanup" value="">
<input type="hidden" name="#command" value="/usr/local/emhttp/plugins/tailscale/restart.sh">

<h3><?= $tr->tr("settings.system_settings"); ?></h3>

Expand Down Expand Up @@ -149,7 +134,7 @@
<h3><?= $tr->tr("settings.restart"); ?></h3>

<form method="POST" action="/update.php" target="progressFrame">
<input type="hidden" name="#command" value="/usr/local/emhttp/plugins/tailscale/restart.sh" />
<input type="hidden" name="#command" value="/usr/local/emhttp/plugins/tailscale/restart.sh">
<dl>
<dt><?= $tr->tr("settings.context.restart"); ?></dt>
<dd>
Expand All @@ -162,7 +147,7 @@
<h3><?= $tr->tr("settings.diagnostics"); ?></h3>

<form method="GET" action="/plugins/plugin-diagnostics/download.php" target="_blank">
<input type="hidden" name="plugin" value="tailscale" />
<input type="hidden" name="plugin" value="tailscale">
<dl>
<dt><?= $tr->tr("settings.context.diagnostics"); ?></dt>
<dd>
Expand All @@ -177,7 +162,7 @@
<h3><?= $tr->tr("settings.erase"); ?></h3>

<form method="POST" action="/update.php" target="progressFrame">
<input type="hidden" name="#command" value="/usr/local/emhttp/plugins/tailscale/erase.sh" />
<input type="hidden" name="#command" value="/usr/local/emhttp/plugins/tailscale/erase.sh">
<dl>
<dt><?= $tr->tr("settings.context.erase"); ?></dt>
<dd>
Expand All @@ -195,7 +180,7 @@
</dd>
</dl>

<script src="<?= Utils::auto_v('/webGui/javascript/jquery.filetree.js');?>" charset="utf-8"></script>
<script src="<?= Utils::auto_v('/webGui/javascript/jquery.filetree.js');?>"></script>
<script src="<?= Utils::auto_v('/webGui/javascript/jquery.switchbutton.js');?>"></script>
<script>
function requestErase(e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,6 @@ function showStatus() {
}
showStatus();
</script>
<style type="text/css">
/* rows hidden by filtering (needed for child rows) */
.tablesorter .filtered {
display: none;
}
.tablesorter-filter.disabled {
display: none;
}
</style>

<table id='statusTable' class="unraid statusTable tablesorter"><tr><td><div class="spinner"></div></td></tr></table><br>
<table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public function getStatusInfo(): StatusInfo
$statusInfo->KeyExpiration = isset($status->Self->KeyExpiry) ? $status->Self->KeyExpiry : $this->tr("disabled");
$statusInfo->Online = isset($status->Self->Online) ? ($status->Self->Online ? $this->tr("yes") : $this->tr("no")) : $this->tr("unknown");
$statusInfo->InNetMap = isset($status->Self->InNetworkMap) ? ($status->Self->InNetworkMap ? $this->tr("yes") : $this->tr("no")) : $this->tr("unknown");
$statusInfo->Tags = isset($status->Self->Tags) ? implode("<br />", $status->Self->Tags) : "";
$statusInfo->Tags = isset($status->Self->Tags) ? implode("<br>", $status->Self->Tags) : "";
$statusInfo->LoggedIn = isset($prefs->LoggedOut) ? ($prefs->LoggedOut ? $this->tr("no") : $this->tr("yes")) : $this->tr("unknown");
$statusInfo->TsHealth = isset($status->Health) ? implode("<br />", $status->Health) : "";
$statusInfo->TsHealth = isset($status->Health) ? implode("<br>", $status->Health) : "";
$statusInfo->LockEnabled = $this->getTailscaleLockEnabled() ? $this->tr("yes") : $this->tr("no");

if ($this->getTailscaleLockEnabled()) {
Expand All @@ -87,9 +87,9 @@ public function getConnectionInfo(): ConnectionInfo

$info->HostName = isset($status->Self->HostName) ? $status->Self->HostName : $this->tr("unknown");
$info->DNSName = isset($status->Self->DNSName) ? $status->Self->DNSName : $this->tr("unknown");
$info->TailscaleIPs = isset($status->TailscaleIPs) ? implode("<br />", $status->TailscaleIPs) : $this->tr("unknown");
$info->TailscaleIPs = isset($status->TailscaleIPs) ? implode("<br>", $status->TailscaleIPs) : $this->tr("unknown");
$info->MagicDNSSuffix = isset($status->MagicDNSSuffix) ? $status->MagicDNSSuffix : $this->tr("unknown");
$info->AdvertisedRoutes = isset($prefs->AdvertiseRoutes) ? implode("<br />", $prefs->AdvertiseRoutes) : $this->tr("none");
$info->AdvertisedRoutes = isset($prefs->AdvertiseRoutes) ? implode("<br>", $prefs->AdvertiseRoutes) : $this->tr("none");
$info->AcceptRoutes = isset($prefs->RouteAll) ? ($prefs->RouteAll ? $this->tr("yes") : $this->tr("no")) : $this->tr("unknown");
$info->AcceptDNS = isset($prefs->CorpDNS) ? ($prefs->CorpDNS ? $this->tr("yes") : $this->tr("no")) : $this->tr("unknown");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
continue;
}

$rows .= "<tr><td><input type='checkbox' name='#arg[]' value='{$lockKey}' /></td><td>{$lockHost}</td><td>{$lockKey}</td></tr>";
$rows .= "<tr><td><input type='checkbox' name='#arg[]' value='{$lockKey}'></td><td>{$lockHost}</td><td>{$lockKey}</td></tr>";
}

$output = <<<EOT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
$txBytes = $peer->Traffic ? $peer->TxBytes : "";
$rxBytes = $peer->Traffic ? $peer->RxBytes : "";
$pingHost = ($peer->SharedUser || $peer->Active || ! $peer->Online || $peer->Mullvad) ? "" : "<input type='button' class='ping' value='Ping' onclick='pingHost(\"{$peer->Name}\")'>";
$ips = implode("<br />", $peer->IP);
$ips = implode("<br>", $peer->IP);

$rows .= <<<EOT
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function loadFilteredPeers() {
</script>

<form method="POST" action="/update.php" target="progressFrame">
<input type="hidden" name="#command" value="/usr/local/emhttp/plugins/tailscale/approve-nodes.php" />
<input type="hidden" name="#command" value="/usr/local/emhttp/plugins/tailscale/approve-nodes.php">
<table id='lockTable' class="unraid lockTable tablesorter"><tr><td>&nbsp;</td></tr></table><br>

<input type="submit" id="lockTable_signnode" name="#apply" value="<?= $tr->tr('Sign'); ?>">
Expand Down
15 changes: 15 additions & 0 deletions src/usr/local/emhttp/plugins/tailscale/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.tablesorter .filtered {
display: none;
}
.tablesorter-filter.disabled {
display: none;
}
.fileTree {
width: 300px;
max-height: 150px;
overflow-y: scroll;
overflow-x: hidden;
position: absolute;
z-index: 100;
display: none
}

0 comments on commit 65b8898

Please sign in to comment.