Skip to content

Commit

Permalink
fix: cannot access settings page if Tailscale disabled (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaser authored Oct 19, 2024
1 parent 368a4da commit 4b31558
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Tag="gears"
$tailscale_config = $tailscale_config ?? Tailscale\Helpers::getPluginConfig();
$tr = $tr ?? new Tailscale\Translator();

if(!isset($tailscale_output)) {
echo("Tailscale output not defined");
if (( ! isset($var)) || ( ! isset($display))) {
echo("Missing required WebGUI variables");
return;
}
?>
<style>
.fileTree {
background:
<?= $tailscale_output['background_color']; ?>
<?= strstr('white,azure', $display['theme']) ? '#f2f2f2' : '#1c1c1c' ?>
;
width: 300px;
max-height: 150px;
Expand Down Expand Up @@ -160,7 +160,7 @@ Tag="gears"
</script>
<script>
$(function() {
<?= $tailscale_output['attach_file_tree']; ?>
<?= ($var['fsState'] == 'Started') ? "$('#taildropdir').fileTreeAttach();" : "" ?>

if ($.cookie('tailscale_view_mode') == 'advanced') {
$('.advanced').show();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';

if (( ! isset($var)) || ( ! isset($display))) {
throw new Exception("Missing required WebGUI variables");
if (( ! isset($var))) {
echo("Missing required WebGUI variables");
return;
}

require_once "{$docroot}/plugins/tailscale/include/common.php";
Expand All @@ -19,9 +19,6 @@
$tailscale_output['status_info'] = $tailscaleInfo->getStatusInfo();
$tailscale_output['connection_info'] = $tailscaleInfo->getConnectionInfo();

$tailscale_output['attach_file_tree'] = ($var['fsState'] == 'Started') ? "$('#taildropdir').fileTreeAttach();" : "";
$tailscale_output['background_color'] = strstr('white,azure', $display['theme']) ? '#f2f2f2' : '#1c1c1c';

$tailscale_output['lock_enabled'] = $tailscaleInfo->getTailscaleLockEnabled();
$tailscale_output['lock_signed'] = $tailscaleInfo->getTailscaleLockSigned();
$tailscale_output['lock_signing'] = $tailscaleInfo->getTailscaleLockSigning();
Expand Down

0 comments on commit 4b31558

Please sign in to comment.