diff --git a/css/newstyle.css b/css/newstyle.css index da1c1ea41cc72dc871e49928d068969151a6c725..dbd85519c91df2f00dd463a9fbd25a31298a5404 100644 --- a/css/newstyle.css +++ b/css/newstyle.css @@ -49,6 +49,11 @@ background-position: 0 -792px; background-position: 0 -656px; position: absolute; } +#xmpp { +background-position: 0 -656px; +display: inline-block; +} + #map { height: 580px; } .mycluster { width: 35px; diff --git a/db/add.php b/db/add.php index e9121b9825ec916586cc00cba8e2b5a6d0957a8c..7e976410651d1ec0157d6509dea27851592b22e7 100644 --- a/db/add.php +++ b/db/add.php @@ -44,30 +44,30 @@ echo "API key already exists";die; //curl the header of pod with and without https $chss = curl_init(); - curl_setopt($chss, CURLOPT_URL, "https://".$_POST['domain']."/users/sign_in"); + curl_setopt($chss, CURLOPT_URL, "https://".$_POST['domain']."/nodeinfo/1.0"); curl_setopt($chss, CURLOPT_POST, 1); - curl_setopt($chss, CURLOPT_HEADER, 1); + curl_setopt($chss, CURLOPT_HEADER, 0); curl_setopt($chss, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($chss, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($chss, CURLOPT_NOBODY, 1); + curl_setopt($chss, CURLOPT_NOBODY, 0); $outputssl = curl_exec($chss); curl_close($chss); $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, "http://".$_POST['domain']."/users/sign_in"); + curl_setopt($ch, CURLOPT_URL, "http://".$_POST['domain']."/nodeinfo/1.0"); curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_HEADER, 1); + curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_NOBODY, 1); + curl_setopt($ch, CURLOPT_NOBODY, 0); $output = curl_exec($ch); curl_close($ch); -if (stristr($outputssl, 'Set-Cookie: _diaspora_session=')) { +if (stristr($outputssl, 'nodeName')) { echo "Your pod has ssl and is valid
"; $valid=1; } -if (stristr($output, 'Set-Cookie: _diaspora_session=')) { +if (stristr($output, 'nodeName')) { echo "Your pod does not have ssl but is a valid pod
"; $valid=1; } diff --git a/db/pull.php b/db/pull.php index 1ec1b2bbc688a73949ca7767036c30d3af8bb2bf..30cc0de14e22e9774a9d5eb642695f77055a01e0 100644 --- a/db/pull.php +++ b/db/pull.php @@ -97,11 +97,12 @@ unset($service_wordpess); unset($dver); unset($dverr); unset($xdver); +unset($xmppchat); +unset($softwarename); $chss = curl_init(); - - curl_setopt($chss, CURLOPT_URL, "https://".$domain."/statistics.json"); + curl_setopt($chss, CURLOPT_URL, "https://".$domain."/nodeinfo/1.0"); curl_setopt($chss, CURLOPT_POST, 0); - curl_setopt($chss, CURLOPT_HEADER, 1); + curl_setopt($chss, CURLOPT_HEADER, 0); curl_setopt($chss, CURLOPT_CONNECTTIMEOUT, 35); curl_setopt($chss, CURLOPT_TIMEOUT, 35); curl_setopt($chss, CURLOPT_RETURNTRANSFER, 1); @@ -110,9 +111,9 @@ unset($xdver); curl_close($chss); $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, "http://".$domain."/statistics.json"); + curl_setopt($ch, CURLOPT_URL, "http://".$domain."/nodeinfo/1.0"); curl_setopt($ch, CURLOPT_POST, 0); - curl_setopt($ch, CURLOPT_HEADER, 1); + curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 35); curl_setopt($ch, CURLOPT_TIMEOUT, 35); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); @@ -120,83 +121,38 @@ unset($xdver); $output = curl_exec($ch); curl_close($ch); if ($debug) {print $output;} -if ($debug) {print $outputssl;} -if (stristr($outputssl, 'registrations_open')) { -//parse header data -$secure="true"; -if ($debug) {echo "Secure: ".$secure."
";} -//$hidden="no"; -$score = $score +1; -preg_match('/X-Git-Update: (.*?)\n/',$outputssl,$xgitdate); -$gitdate = trim($xgitdate[1]); -//$gitdate = strtotime($gitdate); -preg_match('/X-Git-Revision: (.*?)\n/',$outputssl,$xgitrev); -$gitrev = trim($xgitrev[1]); -if ($debug) {echo "GitRevssl: ".$gitrev."
";} -preg_match('/X-Runtime: (.*?)\n/',$outputssl,$xruntime); -$runtime = isset($xruntime[1])?trim($xruntime[1]):null; -preg_match('/Server: (.*?)\n/',$outputssl,$xserver); -$server = isset($xserver[1])?trim($xserver[1]):null; -preg_match('/Content-Encoding: (.*?)\n/',$outputssl,$xencoding); -if ($xencoding) {$encoding = trim($xencoding[1]);} else {$encoding = null;} -//get new json -preg_match_all("/{(.*?)}/", $outputssl, $jsonssl_array); -$jsonssl = json_decode($jsonssl_array[0][0]); -if ($jsonssl->registrations_open === true) {$registrations_open=1;} -$xdver = isset($jsonssl->version)?$jsonssl->version:0; -$dverr = split("-",trim($xdver)); -$dver = $dverr[0]; -if ($debug) {echo "(s)Version code: ".$dver."
";} -if (!$dver) {$score = $score-2;} -$name = isset($jsonssl->name)?$jsonssl->name:"null"; -$total_users = isset($jsonssl->total_users)?$jsonssl->total_users:0; -$active_users_halfyear = isset($jsonssl->active_users_halfyear)?$jsonssl->active_users_halfyear:0; -$active_users_monthly = isset($jsonssl->active_users_monthly)?$jsonssl->active_users_monthly:0; -$local_posts = isset($jsonssl->local_posts)?$jsonssl->local_posts:0; -$comment_counts = isset($jsonssl->local_comments)?$jsonssl->local_comments:0; -$service_facebook = !empty($jsonssl->facebook)?$jsonssl->facebook:'false'; -$service_twitter = !empty($jsonssl->twitter)?$jsonssl->twitter:'false'; -$service_tumblr = !empty($jsonssl->tumblr)?$jsonssl->tumblr:'false'; -$service_wordpress = !empty($jsonssl->wordpress)?$jsonssl->wordpress:'false'; -} elseif (stristr($output, 'registrations_open')) { -"not";$secure="false"; -//$hidden="no"; +if ($debug) {var_dump($outputssl);} +if ($outputssl) {$secure="true";$outputresults=$outputssl;} elseif ($output) {$secure="false";$outputresults=$output;} +if (stristr($outputresults, 'openRegistrations')) { $score = $score +1; -//parse header data -preg_match('/X-Git-Update: (.*?)\n/',$output,$xgitdate); -$gitdate = isset($xgitdate[1])?trim($xgitdate[1]):null; -preg_match('/X-Git-Revision: (.*?)\n/',$output,$xgitrev); -$gitrev = isset($xgitrev[1])?trim($xgitrev[1]):null; -preg_match('/X-Runtime: (.*?)\n/',$output,$xruntime); -$runtime = isset($xruntime[1])?trim($xruntime[1]):null; -preg_match('/Server: (.*?)\n/',$output,$xserver); -$server = isset($xserver[1])?trim($xserver[1]):null; -preg_match('/Content-Encoding: (.*?)\n/',$output,$xencoding); -$encoding = isset($xencoding[1])?trim($xencoding[1]):null; -preg_match_all("/{(.*?)}/", $output, $jsonssl_array); -$jsonssl = json_decode($jsonssl_array[0][0]); -if ($jsonssl->registrations_open === true) {$registrations_open=1;} -$xdver = isset($jsonssl->version)?$jsonssl->version:0; +if ($debug) {echo "Secure: ".$secure."
";} +//get new json from nodeinfo +$jsonssl = json_decode($outputresults); +var_dump($jsonssl); +if ($jsonssl->openRegistrations === true) {$registrations_open=1;} +$xdver = isset($jsonssl->software->version)?$jsonssl->software->version:0; $dverr = split("-",trim($xdver)); $dver = $dverr[0]; -if ($debug) {echo "Version code: ".$dver."
";} +if ($debug) {echo "
Version code: ".$dver."
";} if (!$dver) {$score = $score-2;} -$name = isset($jsonssl->name)?$jsonssl->name:"null"; -$total_users = isset($jsonssl->total_users)?$jsonssl->total_users:0; -$active_users_halfyear = isset($jsonssl->active_users_halfyear)?$jsonssl->active_users_halfyear:0; -$active_users_monthly = isset($jsonssl->active_users_monthly)?$jsonssl->active_users_monthly:0; -$local_posts = isset($jsonssl->local_posts)?$jsonssl->local_posts:0; -$comment_counts = isset($jsonssl->local_comments)?$jsonssl->local_comments:0; -$service_facebook = !empty($jsonssl->facebook)?$jsonssl->facebook:'false'; -$service_twitter = !empty($jsonssl->twitter)?$jsonssl->twitter:'false'; -$service_tumblr = !empty($jsonssl->tumblr)?$jsonssl->tumblr:'false'; -$service_wordpress = !empty($jsonssl->wordpress)?$jsonssl->wordpress:'false'; +$softwarename = isset($jsonssl->software->name)?$jsonssl->software->name:"null"; +$name = isset($jsonssl->metadata->nodeName)?$jsonssl->metadata->nodeName:"null"; +$total_users = isset($jsonssl->usage->users->total)?$jsonssl->usage->users->total:0; +$active_users_halfyear = isset($jsonssl->usage->users->activeHalfyear)?$jsonssl->usage->users->activeHalfyear:0; +$active_users_monthly = isset($jsonssl->usage->users->activeMonth)?$jsonssl->usage->users->activeMonth:0; +$local_posts = isset($jsonssl->usage->localPosts)?$jsonssl->usage->localPosts:0; +$comment_counts = isset($jsonssl->usage->localComments)?$jsonssl->usage->localComments:0; +if (array_search('facebook', $jsonssl->services->outbound) !== false) {$service_facebook='true';} else {$service_facebook='false';} +if (array_search('twitter', $jsonssl->services->outbound) !== false) {$service_twitter='true';} else {$service_twitter='false';} +if (array_search('tumblr', $jsonssl->services->outbound) !== false) {$service_tumblr='true';} else {$service_tumblr='false';} +if (array_search('wordpress', $jsonssl->services->outbound) !== false) {$service_wordpress='true';} else {$service_wordpress='false';} +if ($jsonssl->metadata->xmppChat === true) {$xmpp = 'true';} else {$xmpp = 'false';} + } else { $secure="false"; $score = $score - 1; $dver =".connect error"; $dverr=0; -//$hidden="yes"; //no diaspora cookie on either, lets set this one as hidden and notify someone its not really a pod //could also be a ssl pod with a bad cert, I think its ok to call that a dead pod now } @@ -332,10 +288,10 @@ $weightedscore = ($uptime + $score + ($active_users_monthly/19999) - ((10 - $wei uptimelast7=$10, status=$11, dateLaststats=$12, dateUpdated=$13, responsetimelast7=$14, score=$15, adminrating=$16, country=$17, city=$18, state=$19, lat=$20, long=$21, postalcode='', connection=$22, whois=$23, userrating=$24, longversion=$25, shortversion=$26, masterversion=$27, signup=$28, total_users=$29, active_users_halfyear=$30, active_users_monthly=$31, local_posts=$32, name=$33, -comment_counts=$35, service_facebook=$36, service_tumblr=$37, service_twitter=$38, service_wordpress=$39, weightedscore=$40 +comment_counts=$35, service_facebook=$36, service_tumblr=$37, service_twitter=$38, service_wordpress=$39, weightedscore=$40, xmpp=$41, softwarename=$42 WHERE domain=$34"; - $result = pg_query_params($dbh, $sql, array($gitdate, $encoding, $secure, $hidden, $runtime, $gitrev, $ipnum, $ipv6, $months, $uptime, $live, $pingdomdate, $timenow, $responsetime, $score, $adminrating, $country, $city, $state, $lat, $long, $dver, $whois, $userrating, $xdver, $dver, $masterversion, $signup, $total_users, $active_users_halfyear, $active_users_monthly, $local_posts, $name, $domain, $comment_counts, $service_facebook, $service_tumblr, $service_twitter, $service_wordpress, $weightedscore)); + $result = pg_query_params($dbh, $sql, array($gitdate, $encoding, $secure, $hidden, $runtime, $gitrev, $ipnum, $ipv6, $months, $uptime, $live, $pingdomdate, $timenow, $responsetime, $score, $adminrating, $country, $city, $state, $lat, $long, $dver, $whois, $userrating, $xdver, $dver, $masterversion, $signup, $total_users, $active_users_halfyear, $active_users_monthly, $local_posts, $name, $domain, $comment_counts, $service_facebook, $service_tumblr, $service_twitter, $service_wordpress, $weightedscore, $xmpp, $softwarename)); if (!$result) { die("Error in SQL query3: " . pg_last_error()); } diff --git a/db/tables.sql b/db/tables.sql index 52edac00989c40c8d4c98a8e9018aca0345abe22..2e18c137989e29ff4367d5fb48d4097f6ac1f014 100644 --- a/db/tables.sql +++ b/db/tables.sql @@ -2,6 +2,7 @@ CREATE TABLE pods ( id serial8 UNIQUE PRIMARY KEY, domain text UNIQUE NOT NULL, name text, + softwarename text, score int DEFAULT 10, weightedscore numeric(5,2) DEFAULT 10, adminrating decimal DEFAULT 10, @@ -44,6 +45,7 @@ CREATE TABLE pods ( tokenexpire timestamp, comment_counts int, weight int DEFAULT 10, + xmpp booleen, dateUpdated timestamp DEFAULT current_timestamp, dateLaststats timestamp DEFAULT current_timestamp, dateCreated timestamp DEFAULT current_timestamp diff --git a/images/icon-xmpp.png b/images/icon-xmpp.png new file mode 100644 index 0000000000000000000000000000000000000000..471f6b621f00dfa1bbd90fcefb07958a6d2d0a2a Binary files /dev/null and b/images/icon-xmpp.png differ diff --git a/index.php b/index.php index 3e6feb2b1f24e6e18b125636cf09d8404c052664..0936abbc301b780588cdb7ef77d7b9244fc7eff4 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,4 @@ -Diaspora Pod Uptime Status - Find your new social home on a hosted pod +Federated Pod Uptime Status - Find your new social home on a hosted pod @@ -41,7 +41,7 @@ $cleanup = isset($_GET['cleanup'])?$_GET['cleanup']:null;

- Diaspora Pods + Federated Social Pods

@@ -121,7 +121,7 @@ EOF; Data last refreshed at: Pacific Time
Poduptime is run by David Morley and is open source on GitHub Feel free to contribute with pull requests or bug reports!
Questions on how this works? Wiki
- More about Diaspora + More about Diaspora
More about Friendica
More about Hubzilla(redmatrix)
"; @@ -69,6 +69,7 @@ $tip.="On a score of -20 to +20 this pod is a {$row["score"]} right now"; if ($row["service_twitter"] == "t") {echo "";} if ($row["service_tumblr"] == "t") {echo "";} if ($row["service_wordpress"] == "t") {echo "";} + if ($row["xmpp"] == "t") {echo "
XMPP chat server
";} echo "\n"; if ($tt == 4) { echo <<"; +echo " federated Pods listed, Come see the privacy aware social networks.' />"; echo $numrows; ?>