Commit a18b81d4 authored by dmorley's avatar dmorley

Merge branch 'develop' into 'master'

2.6.0 release merge

See merge request diasporg/Poduptime!236
parents 431043d0 87b18790
Pipeline #1457 passed with stage
in 2 minutes and 45 seconds
......@@ -9,6 +9,30 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
### Fixed
### Security
## [2.6.0] - 2019-04-13
:exclamation: DB migrations required! (see [SQL migration script][2.6.0-sql-migration])
### Added
- store protocols that pods support
- hide software names you don't want on table/go - leaving in stats for now
### Changed
- add.php test for pod meta like update.php
- use meta table for updating monthly stats not the diasp.org hack
### Deprecated
### Removed
### Fixed
- init call on new setup sets up the needed items
- missing tables.sql item from version 2.5.2
- missing table on tables.sql
- link to osada repo updated
- use any valid nodeinfo pod
- softwares are in config.php now so it is not hardcoded to add and update git repos
- some UI issues with more than 1000 pods listed
- uptime and growth charts per pod to be unlimited timespan
- use dig command vs delv as ecdsa keys are not being detected properly by delv
- stats page human readabe dates/times
- system deleted fix
### Security
## [2.5.2] - 2019-01-29
:exclamation: DB migrations required! (see [SQL migration script][2.5.2-sql-migration])
### Added
......@@ -153,6 +177,7 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
### Fixed
- Fix ipv6
[2.6.0-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.5.2-2.6.0.sql
[2.5.2-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.5.0-2.5.2.sql
[2.5.0-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.4.1-2.5.0.sql
[2.4.1-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.4.0-2.4.1.sql
......@@ -161,6 +186,7 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
[2.2.0-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.1.4-2.2.0.sql
[Unreleased]: https://git.feneas.org/diasporg/Poduptime/compare/master...develop
[2.6.0]: https://git.feneas.org/diasporg/Poduptime/compare/2.5.2...2.6.0
[2.5.2]: https://git.feneas.org/diasporg/Poduptime/compare/2.5.1...2.5.2
[2.5.1]: https://git.feneas.org/diasporg/Poduptime/compare/2.5.0...2.5.1
[2.5.0]: https://git.feneas.org/diasporg/Poduptime/compare/2.4.2...2.5.0
......
......@@ -8,7 +8,7 @@ Environmental items you need (debian based system assumed):
OS Dependencies:
```
php7.2 php7.2-curl php7.2-pgsql php7.2-bcmath php-geoip php7.2-cli php7.2-common php7.2-bcmath php7.2-json php7.2-readline php7.2-mbstring php7.2-xml php-cgi git curl postgresql postgresql-contrib dnsutils bind9 npm nodejs composer
php7.2 php7.2-curl php7.2-pgsql php7.2-bcmath php-geoip php7.2-cli php7.2-common php7.2-fpm php7.2-bcmath php7.2-json php7.2-readline php7.2-mbstring php7.2-xml php-cgi git curl postgresql postgresql-contrib dnsutils bind9 npm nodejs composer
```
Yarn is a separate install: https://yarnpkg.com
......@@ -41,10 +41,14 @@ Import database schema
psql -U podupuser podupdb < db/tables.sql
```
Configure your webserver (nginx example)
```
see file http-server-config.example
```
1. Edit `config.php` to add your DB and file settings
2. Touch add.log in location you configured in config.php
3. Create your backup folder
4. Add a pod and run `php db/update.php init`
2. Create your backup folder
3. Add a pod and run `php db/update.php init`
# To Use:
......@@ -65,7 +69,6 @@ psql -U podupuser podupdb < db/migrations/xxx.sql (see db/migrations/README.md f
# Status
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/e4fdde7b4ec34c56a86938d3ba6e3983)](https://www.codacy.com/app/diasporg/Poduptime?utm_source=git.feneas.org&amp;utm_medium=referral&amp;utm_content=diasporg/Poduptime&amp;utm_campaign=Badge_Grade)
[![pipeline status](https://git.feneas.org/diasporg/Poduptime/badges/develop/pipeline.svg)](https://git.feneas.org/diasporg/Poduptime/commits/develop)
[![coverage report](https://git.feneas.org/diasporg/Poduptime/badges/develop/coverage.svg)](https://git.feneas.org/diasporg/Poduptime/commits/develop)
......
......@@ -46,16 +46,16 @@
},
{
"name": "composer/ca-bundle",
"version": "1.1.3",
"version": "1.1.4",
"source": {
"type": "git",
"url": "https://github.com/composer/ca-bundle.git",
"reference": "8afa52cd417f4ec417b4bfe86b68106538a87660"
"reference": "558f321c52faeb4828c03e7dc0cfe39a09e09a2d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/8afa52cd417f4ec417b4bfe86b68106538a87660",
"reference": "8afa52cd417f4ec417b4bfe86b68106538a87660",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/558f321c52faeb4828c03e7dc0cfe39a09e09a2d",
"reference": "558f321c52faeb4828c03e7dc0cfe39a09e09a2d",
"shasum": ""
},
"require": {
......@@ -98,7 +98,7 @@
"ssl",
"tls"
],
"time": "2018-10-18T06:09:13+00:00"
"time": "2019-01-28T09:30:10+00:00"
},
{
"name": "detectlanguage/detectlanguage",
......@@ -807,16 +807,16 @@
},
{
"name": "symfony/translation",
"version": "v4.2.2",
"version": "v4.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "939fb792d73f2ce80e6ae9019d205fc480f1c9a0"
"reference": "23fd7aac70d99a17a8e6473a41fec8fab3331050"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/939fb792d73f2ce80e6ae9019d205fc480f1c9a0",
"reference": "939fb792d73f2ce80e6ae9019d205fc480f1c9a0",
"url": "https://api.github.com/repos/symfony/translation/zipball/23fd7aac70d99a17a8e6473a41fec8fab3331050",
"reference": "23fd7aac70d99a17a8e6473a41fec8fab3331050",
"shasum": ""
},
"require": {
......@@ -876,7 +876,7 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2019-01-03T09:07:35+00:00"
"time": "2019-01-27T23:11:39+00:00"
}
],
"packages-dev": [
......
......@@ -49,4 +49,30 @@ return [
//detectlanguage.com api key
'dlkey' => '',
//softwares and git repos we support
'softwares' => [
'diaspora' => ['repo' => 'diaspora/diaspora', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'friendica' => ['repo' => 'friendica/friendica', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'hubzilla' => ['repo' => 'hubzilla%2fcore', 'gitsite' => 'framagit.org', 'gittype' => 'gitlab', 'devbranch' => 'dev'],
'pleroma' => ['repo' => 'pleroma%2fpleroma', 'gitsite' => 'git.pleroma.social', 'gittype' => 'gitlab', 'devbranch' => 'develop'],
'socialhome' => ['repo' => 'socialhome%2fsocialhome', 'gitsite' => 'git.feneas.org', 'gittype' => 'gitlab', 'devbranch' => ''],
'social-relay' => ['repo' => 'jaywink%2fsocial-relay', 'gitsite' => 'git.feneas.org', 'gittype' => 'gitlab', 'devbranch' => ''],
'writefreely' => ['repo' => 'writeas/writefreely', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'ganggo' => ['repo' => 'ganggo%2fganggo', 'gitsite' => 'git.feneas.org', 'gittype' => 'gitlab', 'devbranch' => ''],
'funkwhale' => ['repo' => 'funkwhale%2ffunkwhale', 'gitsite' => 'code.eliotberriot.com', 'gittype' => 'gitlab', 'devbranch' => 'develop'],
'osada' => ['repo' => 'zot%2fosada', 'gitsite' => 'framagit.org', 'gittype' => 'gitlab', 'devbranch' => 'dev'],
'funkwhale' => ['repo' => 'funkwhale%2ffunkwhale', 'gitsite' => 'dev.funkwhale.audio', 'gittype' => 'gitlab', 'devbranch' => 'develop'],
'gnusocial' => ['repo' => 'gnu%2fgnu-social', 'gitsite' => 'git.gnu.io', 'gittype' => 'gitlab', 'devbranch' => 'nightly'],
'pixelfed' => ['repo' => 'pixelfed/pixelfed', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'dev'],
'wordpress' => ['repo' => 'Wordpress/Wordpress', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => ''],
'misskey' => ['repo' => 'syuilo/misskey', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'speechmore' => ['repo' => 'speechmore%2fspeechmore', 'gitsite' => 'gitlab.fancy.org.uk', 'gittype' => 'gitlab', 'devbranch' => ''],
'peertube' => ['repo' => 'Chocobozzz/PeerTube', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'plume' => ['repo' => 'Plume-org/Plume', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => ''],
'rustodon' => ['repo' => 'rustodon/rustodon', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => ''],
],
//hidden software word strings from table view - %(one)% OR %(one|two|three)%
'hidden-softwares' => '%(relay)%',
];
......@@ -173,7 +173,7 @@ a {
text-decoration: none;
transition: background-color .3s;
cursor: pointer;
width: 170px;
width: 200px;
height: 30px;
}
......@@ -225,7 +225,7 @@ a {
.loadingtable {
width: 100%;
height: 100%;
background: #fff;
background-color: rgba(78,137,164,.8);
position: fixed;
margin: 0;
padding: 0;
......@@ -233,20 +233,26 @@ a {
}
.signal {
border: 5px solid #333;
border-radius: 30px;
height: 30px;
left: 20%;
margin: -15px 0 0 -15px;
border: 6px solid #ffffff;
border-radius: 50px;
height: 40px;
left: 5%;
margin: -20px 0 0 -20px;
opacity: 0;
position: absolute;
top: 20%;
width: 30px;
animation: pulsate 1s ease-out;
top: 24%;
width: 40px;
animation: pulsate 2s ease-in-out;
animation-iteration-count: infinite;
}
.loadingmessage {
left: 1%;
position: absolute;
top: 19%;
color: #ffffff;
}
@keyframes pulsate {
0% {
transform: scale(.1);
......@@ -286,3 +292,7 @@ a {
}
.tooltip { pointer-events: none; }
.navbar-custom {
background-color: rgba(78,137,164,.4);
}
......@@ -82,13 +82,20 @@ EOF;
}
if (!$stop) {
$link = 'https://' . $_domain . '/nodeinfo/1.0';
$nodeinfo = curl('https://' . $_domain . '/.well-known/nodeinfo');
if ($info = json_decode($nodeinfo['body'] ?: '', true)) {
$link = max($info['links'])['href'];
$nodeinfo_meta = curl("https://{$_domain}/.well-known/nodeinfo");
// Default link to fetch node info.
$nodeinfo_url = "https://{$_domain}/nodeinfo/1.0";
if ($info = json_decode($nodeinfo_meta['body'] ?: '', true)) {
if (count($info['links'], COUNT_RECURSIVE) === 2) {
$nodeinfo_url = $info['links']['href'];
} else {
$nodeinfo_url = max($info['links'])['href'];
}
}
$output = curl($link, true);
$output = curl($nodeinfo_url, true);
if ($output['body'] && stripos($output['body'], 'openRegistrations') !== false) {
echo 'Your pod has ssl and is valid<br>';
......@@ -125,6 +132,6 @@ if (!$stop) {
echo 'Data successfully inserted! Your pod will be checked and live on the list in a few hours!';
} else {
echo 'Could not validate your pod, check your setup!<br>Take a look at <a href="' . $link . '">your /nodeinfo</a>';
echo 'Could not validate your pod, check your setup!<br>Take a look at your <a href="' . $nodeinfo_url . '">nodeinfo</a>';
}
}
ALTER TABLE pods ADD protocols jsonb;
\ No newline at end of file
......@@ -32,6 +32,7 @@ CREATE TABLE pods (
latency smallint,
service_xmpp boolean,
services jsonb,
protocols jsonb,
token text,
publickey text,
tokenexpire timestamp,
......@@ -96,6 +97,16 @@ CREATE TABLE masterversions (
date_checked timestamp DEFAULT current_timestamp
);
CREATE TABLE monthlystats (
id serial8 UNIQUE PRIMARY KEY,
total_users int,
total_posts int,
total_comments int,
total_pods int,
total_uptime int,
date_checked timestamp DEFAULT current_timestamp
);
CREATE TABLE meta (
id serial8 UNIQUE PRIMARY KEY,
name text,
......@@ -110,3 +121,4 @@ INSERT INTO meta (name) VALUES('federation_updated');
INSERT INTO meta (name) VALUES('statstable_updated');
INSERT INTO meta (name) VALUES('backup');
INSERT INTO meta (name) VALUES('pods_updated');
INSERT INTO meta (name) VALUES('sitemap_updated');
\ No newline at end of file
......@@ -15,31 +15,15 @@ if (!is_cli()) {
exit;
}
$softwares = [
'diaspora' => ['repo' => 'diaspora/diaspora', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'friendica' => ['repo' => 'friendica/friendica', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'hubzilla' => ['repo' => 'hubzilla%2fcore', 'gitsite' => 'framagit.org', 'gittype' => 'gitlab', 'devbranch' => 'dev'],
'pleroma' => ['repo' => 'pleroma%2fpleroma', 'gitsite' => 'git.pleroma.social', 'gittype' => 'gitlab', 'devbranch' => 'develop'],
'socialhome' => ['repo' => 'jaywink/socialhome', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => ''],
'social-relay' => ['repo' => 'jaywink/social-relay', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => ''],
'writefreely' => ['repo' => 'writeas/writefreely', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'ganggo' => ['repo' => 'ganggo%2fganggo', 'gitsite' => 'git.feneas.org', 'gittype' => 'gitlab', 'devbranch' => ''],
'funkwhale' => ['repo' => 'funkwhale%2ffunkwhale', 'gitsite' => 'code.eliotberriot.com', 'gittype' => 'gitlab', 'devbranch' => 'develop'],
'osada' => ['repo' => 'macgirvin%2fosada', 'gitsite' => 'framagit.org', 'gittype' => 'gitlab', 'devbranch' => 'dev'],
];
$opts = [
'http' => ['method' => 'GET', 'header' => ['User-Agent: Poduptime']],
];
$softwares = c('softwares');
foreach ($softwares as $software => $details) {
if ($details['gittype'] === 'github') {
$context = stream_context_create($opts);
$releasejson = json_decode(file_get_contents('https://' . $details['gitsite'] . '/repos/' . $details['repo'] . '/releases/latest', false, $context));
$rjson = curl('https://' . $details['gitsite'] . '/repos/' . $details['repo'] . '/releases/latest');
$releasejson = json_decode($rjson['body'] ?: '');
if ($details['devbranch']) {
$commitjson = json_decode(file_get_contents('https://' . $details['gitsite'] . '/repos/' . $details['repo'] . '/commits/' . $details['devbranch'], false, $context));
} else {
$commitjson = '';
$cjson = curl('https://' . $details['gitsite'] . '/repos/' . $details['repo'] . '/commits/' . $details['devbranch']);
$commitjson = json_decode($cjson['body'] ?: '');
}
if ($masterversion = $releasejson->tag_name ? str_replace('v', '', $releasejson->tag_name) : '') {
try {
......@@ -58,12 +42,11 @@ foreach ($softwares as $software => $details) {
}
}
} elseif ($details['gittype'] === 'gitlab') {
$context = stream_context_create($opts);
$releasejson = json_decode(file_get_contents('https://' . $details['gitsite'] . '/api/v4/projects/' . $details['repo'] . '/repository/tags', false, $context));
$rjson = curl('https://' . $details['gitsite'] . '/api/v4/projects/' . $details['repo'] . '/repository/tags');
$releasejson = json_decode($rjson['body'] ?: '');
if ($details['devbranch']) {
$commitjson = json_decode(file_get_contents('https://' . $details['gitsite'] . '/api/v4/projects/' . $details['repo'] . '/repository/commits/' . $details['devbranch'], false, $context));
} else {
$commitjson = '';
$cjson = curl('https://' . $details['gitsite'] . '/api/v4/projects/' . $details['repo'] . '/repository/commits/' . $details['devbranch']);
$commitjson = json_decode($cjson['body'] ?: '');
}
if ($masterversion = $releasejson[0]->name ? str_replace('v', '', $releasejson[0]->name) : '') {
try {
......
......@@ -15,14 +15,28 @@ if (!is_cli()) {
exit;
}
try {
$total_runs = R::getAll("
SELECT
count(value),
to_char(date_created, 'yyyy-mm') as yymm
FROM meta
WHERE name = 'pods_updated'
GROUP BY yymm
");
} catch (\RedBeanPHP\RedException $e) {
debug('Error in SQL query: ' . sprintf($e->getMessage()));
}
try {
$monthly_totals = R::getAll("
SELECT
to_char(date_checked, 'yyyy-mm') AS yymm,
sum(total_users) / COUNT(DISTINCT CASE WHEN domain = 'diasp.org' THEN id ELSE NULL END) as users,
sum(local_posts) / COUNT(DISTINCT CASE WHEN domain = 'diasp.org' THEN id ELSE NULL END) as posts,
sum(comment_counts) / COUNT(DISTINCT CASE WHEN domain = 'diasp.org' THEN id ELSE NULL END) as comments,
count(domain) / COUNT(DISTINCT CASE WHEN domain = 'diasp.org' THEN id ELSE NULL END) as pods,
sum(total_users) as users,
sum(local_posts) as posts,
sum(comment_counts) as comments,
count(domain) as pods,
count(DISTINCT CASE WHEN domain = 'diasp.org' THEN id ELSE NULL END) as oldtotal,
count(nullif(online, false)) as uptime,
count(nullif(online, true)) as downtime
FROM checks
......@@ -36,13 +50,23 @@ foreach ($monthly_totals as $monthly) {
// Format date to timestamp.
$timestamp = $monthly['yymm'] . '-01 01:01:01-01';
$total = $monthly['oldtotal'];
foreach ($total_runs as $runs) {
if ($monthly['yymm'] === $runs['yymm']) {
$total = $runs['count'];
break;
}
}
if ($total === 0) {
$total = 1;
}
try {
$p = R::findOrCreate('monthlystats', ['date_checked' => $timestamp]);
$p['total_users'] = $monthly['users'];
$p['total_posts'] = $monthly['posts'];
$p['total_comments'] = $monthly['comments'];
$p['total_pods'] = $monthly['pods'];
$p['total_users'] = round($monthly['users'] / $total);
$p['total_posts'] = round($monthly['posts'] / $total);
$p['total_comments'] = round($monthly['comments'] / $total);
$p['total_pods'] = round($monthly['pods'] / $total);
if ($monthly['downtime']) {
$p['total_uptime'] = round($monthly['downtime'] / $monthly['uptime'] * 100);
} else {
......
......@@ -33,14 +33,9 @@ $foundpods = [];
//pulling all nodes for now
$federationpods = curl('https://the-federation.info/graphql?query=%7Bnodes%7Bhost%20platform%7Bname%7Dprotocols%7Bname%7D%7D%7D&raw');
if ($pods = json_decode($federationpods['body'] ?: '', true)) {
;
foreach ($pods['data']['nodes'] ?? [] as $poddata) {
$protocols = array_column($poddata['protocols'] ?? [], 'name');
//limiting to diaspora compatible for now
if (in_array('diaspora', $protocols, true)) {
$foundpods[] = strtolower(preg_replace('(^https?://)', '', $poddata['host']));
}
$foundpods[] = strtolower(preg_replace('(^https?://)', '', $poddata['host']));
}
}
......
......@@ -29,6 +29,7 @@ if (!is_connected()) {
$time_start = microtime(true);
$debug = isset($_GET['debug']) || (isset($argv) && in_array('debug', $argv, true));
$init = isset($_GET['init']) || (isset($argv) && in_array('init', $argv, true));
$sqldebug = isset($_GET['sqldebug']) || (isset($argv) && in_array('sqldebug', $argv, true));
$develop = isset($_GET['develop']) || (isset($argv) && in_array('develop', $argv, true));
$write = !(isset($_GET['nowrite']) || (isset($argv) && in_array('nowrite', $argv, true)));
......@@ -147,7 +148,7 @@ foreach ($pods as $pod) {
preg_match_all('((?:\d(.|-)?)+(\.)\d+\.*)', $version, $sversion);
$shortversion = $sversion[0][0] ?? '0.0.0.0';
$signup = ($jsonssl->openRegistrations ?? false) === true;
$softwarename = $jsonssl->software->name ?? 'unknown';
$softwarename = strtolower($jsonssl->software->name) ?? 'unknown';
$name = $jsonssl->metadata->nodeName ?? $softwarename;
$total_users = $jsonssl->usage->users->total ?? 0;
$active_users_halfyear = $jsonssl->usage->users->activeHalfyear ?? 0;
......@@ -160,6 +161,9 @@ foreach ($pods as $pod) {
if (is_array($jsonssl->services->outbound)) {
$services = json_encode($jsonssl->services->outbound);
}
if (is_array($jsonssl->protocols)) {
$protocols = json_encode($jsonssl->protocols);
}
}
try {
......@@ -176,7 +180,8 @@ foreach ($pods as $pod) {
if ($write) {
R::store($c);
} else {
echo $c;
echo 'Data not saved, testing only';
echo $newline;
}
} catch (\RedBeanPHP\RedException $e) {
debug('Error in SQL query: ' . sprintf($e->getMessage()));
......@@ -290,7 +295,8 @@ foreach ($pods as $pod) {
if ($write) {
R::store($c);
} else {
echo $c;
echo 'Data not saved, testing only';
echo $newline;
}
} catch (\RedBeanPHP\RedException $e) {
debug('Error in SQL query: ' . sprintf($e->getMessage()));
......@@ -303,12 +309,13 @@ foreach ($pods as $pod) {
debug('Signup Open', $signup);
$dnsserver = c('dnsserver') ?: '1.1.1.1';
$delv = new NPM\Xec\Command("delv @{$dnsserver} {$domain}");
$delv->throwExceptionOnError(false);
$dig = new NPM\Xec\Command("dig @{$dnsserver} {$domain} +dnssec");
$dig->throwExceptionOnError(false);
$ip = '';
$iplookupv4 = explode(PHP_EOL, trim($delv->execute([], null, 15)->stdout));
$dnssec = in_array('; fully validated', $iplookupv4, true) ?? false;
$iplookupv4 = explode(PHP_EOL, trim($dig->execute(['A'], null, 15)->stdout));
$flags = preg_grep('/;; flags:(.*?);/', $iplookupv4);
$dnssec = (bool) preg_grep('/ad/', $flags);
$getaonly = array_values(preg_grep('/\s+IN\s+A\s+.*/', $iplookupv4));
if ($getaonly) {
......@@ -317,14 +324,15 @@ foreach ($pods as $pod) {
}
$ip || $score -= 2;
$iplookupv6 = explode(PHP_EOL, trim($delv->execute(['AAAA'], null, 15)->stdout));
$iplookupv6 = explode(PHP_EOL, trim($dig->execute(['AAAA'], null, 15)->stdout));
$ipv6 = (bool) preg_grep('/\s+IN\s+AAAA\s+.*/', $iplookupv6);
debug('IPv4', $ip);
debug('IPv6', $ipv6);
debug('DNSSEC', $dnssec);
// todo: Temporary workaround (see https://github.com/akalongman/php-ip-tools/issues/8)
if (Ip::isValid($ip) && Ip::isRemote($ip)) {
if (Ip::isValid($ip) && Ip::isRemote($ip) && $ip != '0.0.0.0') {
$geo = $reader->city($ip);
$countryname = ($geo->country->name ?? null) ?: null;
$country = ($geo->country->isoCode ?? null) ?: null;
......@@ -382,13 +390,16 @@ foreach ($pods as $pod) {
if ($score > 100) {
$score = 100;
} elseif ($score < 1) {
}
if ($score < 1) {
$weightedscore = 0;
} elseif ($score < -6000) {
}
if ($score < -6000) {
$status = PodStatus::SYSTEM_DELETED;
}
debug('Score', $score);
debug('Status', $status);
debug('Weighted Score', $weightedscore);
try {
......@@ -427,6 +438,7 @@ foreach ($pods as $pod) {
$p['comment_counts'] = $comment_counts;
$p['service_xmpp'] = $service_xmpp;
$p['services'] = $services;
$p['protocols'] = $protocols;
$p['softwarename'] = $softwarename;
}
......@@ -449,33 +461,33 @@ if (!$_domain) {
$time_end = microtime(true);
$execution_time = ($time_end - $time_start) / 60;
updateMeta('pods_update_runtime', round($execution_time));
if ($languagesupdated) {
if ($languagesupdated || $init) {
updateMeta('languages_updated');
}
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('masterversions_updated', 'date_created'))->diffInHours() > 12) {
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('masterversions_updated', 'date_created'))->diffInHours() > 12 || $init) {
require __DIR__ . '/update-masterversions.php';
}
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('statstable_updated', 'date_created'))->diffInHours() > 23) {
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('statstable_updated', 'date_created'))->diffInHours() > 23 || $init) {
require __DIR__ . '/update-monthly-stats.php';
}
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('cacert_updated', 'date_created'))->diffInHours() > 40) {
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('cacert_updated', 'date_created'))->diffInHours() > 40 || $init) {
copy('https://curl.haxx.se/ca/cacert.pem', c('cafullpath'));
updateMeta('cacert_updated');
}
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('sitemap_updated', 'date_created'))->diffInHours() > 2) {
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('sitemap_updated', 'date_created'))->diffInHours() > 2 || $init) {
require __DIR__ . '/update-sitemap.php';
}
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('geoip_updated', 'date_created'))->diffInHours() > 45) {
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('geoip_updated', 'date_created'))->diffInHours() > 45 || $init) {
copy('compress.zlib://http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz', c('geoip2db'));
updateMeta('geoip_updated');
}
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('federation_updated', 'date_created'))->diffInHours() > 9) {
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('federation_updated', 'date_created'))->diffInHours() > 9 || $init) {
require __DIR__ . '/update-remote-data.php';
}
......
......@@ -17,6 +17,8 @@ $_software = $_GET['software'] ?? '';
require_once __DIR__ . '/boot.php';
$hiddensoftwares = c('hidden-softwares');
try {
if ($_domain) {
$click = 'manualclick';
......@@ -32,9 +34,10 @@ try {
AND monthsmonitored > 1
AND softwarename = ?
AND status = ?
AND softwarename NOT SIMILAR TO ?
ORDER BY random()
LIMIT 1
', [$_software, PodStatus::UP]);
', [$_software, PodStatus::UP, $hiddensoftwares]);
$domain || die('no domains exist');
} else {
$click = 'autoclick';
......@@ -46,9 +49,10 @@ try {
AND monthsmonitored > 2
AND pods.masterversion = shortversion
AND status = ?
AND softwarename NOT SIMILAR TO ?
ORDER BY random()
LIMIT 1
', [PodStatus::UP]);
', [PodStatus::UP, $hiddensoftwares]);
$domain || die('no domains exist');
}
......
......@@ -28,8 +28,8 @@ $fullview = false;
<head>
<meta charset="utf-8">
<title>Open Source Social Network Pod Uptime Status</title>
<meta name="keywords" content="diaspora, <?php echo $input ?>, federated pods, <?php echo $_SERVER['HTTP_HOST'] ?>, friendica, hubzilla, open source social, open source social network"/>
<meta name="description" content="Diaspora Pod <?php echo $input ?> Live Status. Find a Diaspora pod to sign up for, rate pods, find one close to you!"/>
<meta name="keywords" content="diaspora, <?php echo $input ?>, federated pods, <?php echo $_SERVER['HTTP_HOST'] ?>, fediverse, federated network, friendica, hubzilla, open source social, open source social network"/>
<meta name="description" content="Federated Pod <?php echo $input ?> Live Status. Find a Federated Network pod to sign up for, rate pods, find one close to you!"/>
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="css/poduptime.css"/>
<link rel="stylesheet" href="node_modules/ion-rangeslider/css/ion.rangeSlider.css"/>
......@@ -37,10 +37,11 @@ $fullview = false;
<link rel="stylesheet" href="node_modules/featherlight/release/featherlight.min.css"/>
<link rel="stylesheet" href="node_modules/tablesorter/dist/css/theme.bootstrap_4.min.css"/>
<link rel="stylesheet" href="node_modules/@fortawesome/fontawesome-free/css/all.min.css"/>
<link rel="stylesheet" href="node_modules/fork-awesome/css/fork-awesome.min.css"/>
<meta property="og:url" content="https://<?php echo $_SERVER['HTTP_HOST'] ?>/<?php echo $input ?>"/>
<meta property="og:title" content="Social Network Pod <?php echo $input ?> Finder"/>
<meta property="og:type" content="website"/>
<meta property="og:description" content="Diaspora Pod <?php echo $input ?> Live Status. Find a Diaspora pod to sign up for, rate pods, find one close to you!"/>
<meta property="og:description" content="Federated Network Pod <?php echo $input ?> Live Status. Find a Federated Network pod to sign up for, rate pods, find one close to you!"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=yes">
<meta http-equiv="x-ua-compatible" content="ie=edge">
</head>
......@@ -57,9 +58,9 @@ $navs = [
'links' => [
['text' => 'Git', 'href' => 'https://git.feneas.org/diasporg/Poduptime', 'active' => false],
['text' => 'Contact', 'href' => 'https://dia.so/support', 'active' => false],
['text' => 'Wiki', 'href' => 'https://git.feneas.org/diasporg/Poduptime/wikis/home', 'active' => false],
['text' => 'API', 'href' => 'https://git.feneas.org/diasporg/Poduptime/wikis/API', 'active' => false],
['text' => 'How to host a pod', 'href' => 'https://fediverse.party/', 'active' => false],
['text' => 'Wiki/API', 'href' => 'https://git.feneas.org/diasporg/Poduptime/wikis/home', 'active' => false],
['text' => 'More about the Fediverse', 'href' => 'https://fediverse.party', 'active' => false],
['text' => 'Federated Networks Association', 'href' => 'https://feneas.org', 'active' => false],
],
];
?>
......@@ -69,7 +70,7 @@ $navs = [
<div class="row">
<div class="col-sm-8 col-md-7 py-4">
<h4 class="text-black">About</h4>
<p class="text-white">Poduptime helps you find a diaspora, friendica, hubzilla or socialhome pod to use and join the federated social network.</p>
<p class="text-white">Poduptime helps you find a pod to use and join the Fediverse (Federated Network). </p>
<ul class="navbar-nav">
<?php
foreach ($navs['links'] as $nav_item) {
......@@ -107,7 +108,7 @@ $navs = [
<a href="/" class="navbar-brand d-flex align-items-center">
<strong>Poduptime</strong>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarHeader" aria-controls="navbarHeader" aria-expanded="false" aria-label="Toggle navigation">
<button class="navbar-toggler navbar-custom" type="button" data-toggle="collapse" data-target="#navbarHeader" aria-controls="navbarHeader" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</div>
......
......@@ -29,7 +29,7 @@ $table
.tablesorterPager(pagerOptions);
$(document).ready(function () {
$('.columnssimple').on('click', function () {
$('table').trigger('refreshColumnSelector', true);
$('#colSelect1').prop('checked', false);
......@@ -41,7 +41,7 @@ $(document).ready(function () {
$('table').trigger('filterReset');
});
$('.columnsadvanced').on('click', function () {
$('table').trigger('refreshColumnSelector', ['columns', [2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 21, 22, 28]]);
$('table').trigger('refreshColumnSelector', ['columns', [2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 19, 22, 23, 24]]);
$('#colSelect1').prop('checked', false);
$('.columnSelectorWrapper').show().css('display', 'inline-block');
$('.columnssimple').show().css('display', 'inline-block');
......@@ -57,15 +57,15 @@ $(document).ready(function () {
$('table tbody').append(html);
$('table').trigger('update', [true]);
var columns = [];
columns[7] = 'Yes';
columns[8] = 'Yes';
if (input) {
columns[0] = input;
columns[7] = '';
columns[8] = '';
}
$('table').trigger('search', [columns]);
$('.pagerhidden').delay(900).show(200);
$('.pagerhidden').delay(300).show(800);
$('[data-toggle="tooltip"]').tooltip();
$('.loadingtable').delay(300).hide(100);
$('.loadingtable').delay(300).hide(300);
});
$('#colSelect1').prop('checked', false);
});
......@@ -115,6 +115,7 @@ function curl(string $url, bool $follow = false): array
curl_setopt($chss, CURLOPT_FAILONERROR, true);
curl_setopt($chss, CURLOPT_CERTINFO, true);
curl_setopt($chss, CURLOPT_FOLLOWLOCATION, $follow);
curl_setopt($chss, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0');