Skip to content

Commit

Permalink
chore: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaser committed Aug 27, 2024
1 parent 15b27af commit e46c2e8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
33 changes: 16 additions & 17 deletions src/usr/local/emhttp/plugins/tailscale/include/daily/ping.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

function send_usage($url, $content)
{
$body = json_encode($content);
$body = json_encode($content);
$token = file_get_contents($url . '?connect');

$c = curl_init();
Expand All @@ -14,7 +14,7 @@ function send_usage($url, $content)
'Content-Type: application/json',
'Authorization: Bearer ' . $token
];

curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $body);
curl_setopt($c, CURLOPT_HTTPHEADER, $headers);
Expand All @@ -37,10 +37,9 @@ function send_usage($url, $content)

$prefs = getTailscalePrefs();

$exit = false;
$exit = false;
$subnet = false;
foreach($prefs->AdvertiseRoutes as $net)
{
foreach ($prefs->AdvertiseRoutes as $net) {
switch ($net) {
case "0.0.0.0/0":
case "::/0":
Expand All @@ -52,17 +51,17 @@ function send_usage($url, $content)
}
}

$content = array(
'clientId' => hash("crc32b", $var['flashGUID']),
'plugin' => 'tailscale',
'plugin_version' => $version['VERSION'],
'plugin_branch' => $version['BRANCH'],
'unraid_version' => $var['version'],
'bool1' => boolval($tailscale_config['ACCEPT_DNS']),
'bool2' => boolval($tailscale_config['ACCEPT_ROUTES']),
'bool3' => boolval($tailscale_config['INCLUDE_INTERFACE']),
'bool4' => $subnet,
'bool5' => $exit
$content = array(
'clientId' => hash("crc32b", $var['flashGUID']),
'plugin' => 'tailscale',
'plugin_version' => $version['VERSION'],
'plugin_branch' => $version['BRANCH'],
'unraid_version' => $var['version'],
'bool1' => boolval($tailscale_config['ACCEPT_DNS']),
'bool2' => boolval($tailscale_config['ACCEPT_ROUTES']),
'bool3' => boolval($tailscale_config['INCLUDE_INTERFACE']),
'bool4' => $subnet,
'bool5' => $exit
);

$attempts = 0;
Expand All @@ -74,7 +73,7 @@ function send_usage($url, $content)
$attempts++;

$result = send_usage($endpoint, $content);
logmsg("Usage data sent.");
logmsg("Usage data sent.");
} while (($result != '200') && ($attempts < 3));

if ($result != '200') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
sleep(5);
exec("/etc/init.d/rc.nginx start");
}
}
}

0 comments on commit e46c2e8

Please sign in to comment.