Commit d44b0412 authored by David Morley's avatar David Morley Committed by GitHub

Moarfix (#94)

* fix bad pods getting other pods data

* maybe easier to read this way

* changes

* xmpp
parent 27f94b2e
......@@ -4,12 +4,13 @@ Poduptime is software to get live stats and data on listed Diaspora Pods.
Dependencies:
```
php7.0 php7.0-curl php7.0-pgsql php-geoip php7.0-cli php7.0-common php7.0-json php7.0-readline
php7.0 php7.0-curl php7.0-pgsql php-geoip php7.0-cli php7.0-common php7.0-json php7.0-readline php-cgi
git
curl
postgresql postgresql-contrib
wget
dnsutils
bind9
npm
nodejs nodejs-legacy
```
......
......@@ -56,4 +56,7 @@ background-size: 25px 37px;
.icon {
color: red;
}
table {
empty-cells: show;
}
......@@ -9,6 +9,8 @@ $softwares = [
'diaspora' => ['url' => 'https://raw.githubusercontent.com/diaspora/diaspora/master/config/defaults.yml', 'regex' => '/number:.*"(.*)"/'],
'friendica' => ['url' => 'https://raw.githubusercontent.com/friendica/friendica/master/boot.php', 'regex' => '/define.*\'FRIENDICA_VERSION\'.*\'(.*)\'/'],
'redmatrix' => ['url' => 'https://raw.githubusercontent.com/redmatrix/hubzilla/master/boot.php', 'regex' => '/define.*\'STD_VERSION\'.*\'(.*)\'/'],
'socialhome' => ['url' => 'https://raw.githubusercontent.com/jaywink/socialhome/master/bower.json', 'regex' => '/version":.*"(.*)"/'],
'social-relay' => ['url' => 'https://raw.githubusercontent.com/jaywink/social-relay/master/social_relay/config.py', 'regex' => '/VERSION.*"(.*)"/'],
];
foreach ($softwares as $software => $details) {
......
......@@ -77,6 +77,7 @@ while ($row = pg_fetch_assoc($result)) {
$sql_errors = 'INSERT INTO checks (domain, online, error, ttl) VALUES ($1, $2, $3, $4)';
$result_errors = pg_query_params($dbh, $sql_errors, [$domain, 0, $outputsslerror, $ttl]);
$result_errors || die('Error in SQL query: ' . pg_last_error());
continue;
}
if ($jsonssl !== null) {
......@@ -97,7 +98,7 @@ while ($row = pg_fetch_assoc($result)) {
$service_twitter = in_array('twitter', $jsonssl->services->outbound, true);
$service_tumblr = in_array('tumblr', $jsonssl->services->outbound, true);
$service_wordpress = in_array('wordpress', $jsonssl->services->outbound, true);
$service_xmpp = $jsonssl->metadata->xmppChat === true ?? false;
$service_xmpp = ($jsonssl->metadata->xmppChat ?? false) === true;
$status = 'Up';
$sql_checks = 'INSERT INTO checks (domain, online, ttl, total_users, local_posts, comment_counts, shortversion) VALUES ($1, $2, $3, $4, $5, $6, $7)';
......@@ -113,21 +114,23 @@ while ($row = pg_fetch_assoc($result)) {
_debug('Signup Open', $signup);
$iplookupv4 = [];
$ip = '';
exec(escapeshellcmd('delv @' . $dnsserver . ' ' . $domain), $iplookupv4);
if ($iplookupv4) {
_debug('Iplookupv4', $iplookupv4, true);
$dnssec = in_array('; fully validated', $iplookupv4, true) ?? false;
$getaonly = array_values(preg_grep('/\s+IN\s+A\s+.*/', $iplookupv4));
if ($iplookupv4) {
preg_match('/A\s(.*)/', $getaonly[0], $aversion);
$ip = trim($aversion[1]);
$ip = trim($aversion[1]) ?? '';
}
$iplookupv6 = [];
$ipv6 = null;
exec(escapeshellcmd('delv @' . $dnsserver . ' ' . $domain . ' AAAA '), $iplookupv6);
if ($iplookupv6) {
_debug('Iplookupv6', $iplookupv6, true);
$getaaaaonly = array_values(preg_grep('/\s+IN\s+AAAA\s+.*/', $iplookupv6));
preg_match('/A\s(.*)/', $getaaaaonly[0], $aaaaversion);
$ipv6 = trim($aaaaversion[1]);
if ($getaaaaonly) {
preg_match('/AAAA\s(.*)/', $getaaaaonly[0], $aaaaversion);
$ipv6 = trim($aaaaversion[1]) ?? '';
}
$ip || $score -= 2;
......
......@@ -55,7 +55,7 @@ $numrows = pg_num_rows($result);
$version = $row['shortversion'];
$pre = 'This pod runs pre release development code';
} elseif (!$row['shortversion']) {
$version = '0';
$version = '';
$pre = 'This pod runs unknown code';
} else {
$version = $row['shortversion'];
......@@ -70,15 +70,15 @@ $numrows = pg_num_rows($result);
}
echo '<td class="' . $classver . '"><div title="' . $pre . ' version: ' . $row['shortversion'] . ' master version is: ' . $row['masterversion'] . '" data-toggle="tooltip" data-placement="bottom">' . $version . '</div></td>';
echo '<td>' . $row['softwarename'] . '</td>';
echo '<td>' . $row['uptime_alltime'] . '%</td>';
echo '<td>' . ($row['uptime_alltime'] > 0 ? $row['uptime_alltime'].'%' : '') . '</td>';
echo '<td>' . ($row['ipv6'] === 't' ? '&#10003;' : '') . '</td>';
echo '<td>' . $row['responsetime'] . '</td>';
echo '<td>' . ($row['responsetime'] > 0 ? $row['responsetime'] : '') . '</td>';
echo '<td>' . ($row['signup'] === 't' ? '&#10003;' : '') . '</td>';
echo '<td>' . $row['total_users'] . '</td>';
echo '<td>' . $row['active_users_halfyear'] . '</td>';
echo '<td>' . $row['active_users_monthly'] . '</td>';
echo '<td>' . $row['local_posts'] . '</td>';
echo '<td>' . $row['comment_counts'] . '</td>';
echo '<td>' . ($row['total_users'] > 0 ? $row['total_users'] : '') . '</td>';
echo '<td>' . ($row['active_users_halfyear'] > 0 ? $row['active_users_halfyear'] : '') . '</td>';
echo '<td>' . ($row['active_users_monthly'] > 0 ? $row['active_users_monthly'] : '') . '</td>';
echo '<td>' . ($row['local_posts'] > 0 ? $row['local_posts'] : '') . '</td>';
echo '<td>' . ($row['comment_counts'] > 0 ? $row['comment_counts'] : '') . '</td>';
$moreurl = '/showstats.php?domain=' . $row['domain'];
echo '<td><div title="Last Check ' . $row['date_updated'] . '" data-toggle="tooltip" data-placement="bottom">' . $row['monthsmonitored'] . '</div></td>';
echo '<td><a rel="facebox" href="rate.php?domain=' . $row['domain'] . '">' . $row['userrating'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment