Commit 414e8eb2 authored by dmorley's avatar dmorley

add support for xmpp and move from diaspora only to all federated pods that support nodeinfo

parent 25404421
......@@ -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;
......
......@@ -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<br>";
$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<br>";
$valid=1;
}
......
......@@ -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."<br>";}
//$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."<br>";}
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."<br>";}
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."<br>";}
//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."<br>";}
if ($debug) {echo " <br> Version code: ".$dver."<br>";}
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());
}
......
......@@ -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
......
<!doctype html><html><head><meta charset="utf-8"><title>Diaspora Pod Uptime Status - Find your new social home on a hosted pod</title>
<!doctype html><html><head><meta charset="utf-8"><title>Federated Pod Uptime Status - Find your new social home on a hosted pod</title>
<meta name="keywords" content="diaspora, podupti.me, diasp, diasporg, diasp.org, facebook, open source social, open source facebook, open source social network" />
<meta name="description" content="Diaspora Pod Live Status. Find a Diaspora pod to sign up for, rate pods, find one close to you!" />
<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
......@@ -41,7 +41,7 @@ $cleanup = isset($_GET['cleanup'])?$_GET['cleanup']:null;
<div class="row">
<div class="span5">
<h2 id="title">
Diaspora Pods
Federated Social Pods
</h2>
</div>
<div class="span2" style="margin-top:8px;">
......@@ -121,7 +121,7 @@ EOF;
Data last refreshed at: <?php echo date("F d Y H:i:s.", filemtime($lastfile)) ?> Pacific Time<br>
Poduptime is run by <a href="https://diasp.org/u/davidmorley" target=_new>David Morley</a> and is open source on <a href="https://github.com/diasporg/Poduptime">GitHub</a> Feel free to contribute with pull requests or bug reports!<br>
Questions on how this works? <a href="https://github.com/diasporg/Poduptime/wiki">Wiki</a><br>
<a href="https://diasporafoundation.org/">More about Diaspora</a>
<a href="https://diasporafoundation.org/">More about Diaspora</a><br><a href="http://friendica.com/">More about Friendica</a><br><a href="http://hubzilla.org/">More about Hubzilla(redmatrix)</a>
</div>
<div id="howto" style="display:none; margin-left:50px">
<br>
......
......@@ -19,7 +19,7 @@ $tt=0;
$numrows = pg_num_rows($result);
echo "<meta property='og:title' content='";
echo $numrows;
echo " #Diaspora Pods listed, Come see the privacy aware social network.' />";
echo " Federated Pods listed, Come see the privacy aware social networks.' />";
echo $numrows;
?>
pods that are open for signup now.
......@@ -30,7 +30,7 @@ Show as: <a href="?mapview=true">Map</a> | <a href="/">Simple Table</a> | <a hre
<table id="myTable" class="tablesorter zebra-striped" style="width:750px; !important">
<thead>
<tr>
<th width="220px">Diaspora Pod<a class="tipsy" title="A pod is a site for you to set up your account.">?</a></th>
<th width="220px">Federated Pod<a class="tipsy" title="A pod is a site for you to set up your account.">?</a></th>
<th>Uptime %<a class="tipsy" title="Percent of the time the pod is online for <?php echo date("F") ?>.">?</a></th>
<th>Active Users<a class="tipsy" title="Number of users active last 6 months on this pod.">?</a></th>
<th>Location<a class="tipsy" title="Pod location, based on IP Geolocation">?</a></th>
......@@ -52,8 +52,8 @@ $class="red";
$tip="This pod does not offer SSL";
}
$verdiff = str_replace(".", "", $row["masterversion"]) - str_replace('.', '', $row["shortversion"]);
$tip.="\n This pod {$row["name"]} has been watched for {$row["monthsmonitored"]} months and its average ping time is {$row["responsetimelast7"]} with uptime of {$row["uptimelast7"]}% this month and was last checked on {$row["dateupdated"]}. ";
$tip.="On a score of -20 to +20 this pod is a {$row["score"]} right now";
$tip.="\n This {$row["softwarename"]} pod {$row["name"]} has been watched for {$row["monthsmonitored"]} months and with an uptime of {$row["uptimelast7"]}% this month and was last checked on {$row["dateupdated"]}. ";
$tip.="On a scale of -20 to +20 this pod is a {$row["score"]} right now";
echo "<tr><td><a class='$class' target='new' href='". $method . $row["domain"] ."'>" . $row["domain"] . " <div title='$tip' class='tipsy' style='display: inline-block'>?</div></a></td>";
"</div></td>";
......@@ -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 "<div id='twitter' class='smlogo'></div>";}
if ($row["service_tumblr"] == "t") {echo "<div id='tumblr' class='smlogo'></div>";}
if ($row["service_wordpress"] == "t") {echo "<div id='wordpress' class='smlogo'></div>";}
if ($row["xmpp"] == "t") {echo "<div id='xmpp'><img src='/images/icon-xmpp.png' width='16px' height='16px' title='XMPP chat server' alt='XMPP chat server'></div>";}
echo "</td></tr>\n";
if ($tt == 4) {
echo <<<EOF
......
......@@ -18,7 +18,7 @@ $tt=0;
$numrows = pg_num_rows($result);
echo "<meta property='og:title' content='";
echo $numrows;
echo " #Diaspora Pods listed, Come see the privacy aware social network.' />";
echo " federated Pods listed, Come see the privacy aware social networks.' />";
echo $numrows;
?>
<style>
......@@ -34,10 +34,10 @@ Show as: <a href="?mapview=true">Map</a> | <a href="/">Simple Table</a> | <a hre
<table id="myTable" class="tablesorter zebra-striped" width="98%">
<thead>
<tr>
<th width="220px">Diaspora Pod<a class="tipsy" title="A pod is a site for you to set up your account.">?</a></th>
<th>Version<a class="tipsy" title="Version of Diaspora this pod runs">?</a></th>
<th width="220px">Federated Pod<a class="tipsy" title="A pod is a site for you to set up your account.">?</a></th>
<th>Version<a class="tipsy" title="Version of software this pod runs">?</a></th>
<th>Uptime<a class="tipsy" title="Percent of the time the pod is online for <?php echo date("F") ?>.">?</a></th>
<th>Responsetime</th>
<th>IPv6</th>
<th>Signups</th>
<th>Total Users<a class="tipsy" title="Number of total users on this pod.">?</a></th>
<th>Active Last 6<a class="tipsy" title="Number of users active last 6 months on this pod.">?</a></th>
......@@ -68,8 +68,8 @@ $tip="This pod does not offer SSL";
$verdiff = str_replace(".", "", $row["masterversion"]) - str_replace('.', '', $row["shortversion"]);
$tip.="\n This pod {$row["name"]} has been watched for {$row["monthsmonitored"]} months and its average ping time is {$row["responsetimelast7"]} with uptime of {$row["uptimelast7"]}% this month and was last checked on {$row["dateupdated"]}. ";
$tip.="On a score of -20 to +20 this pod is a {$row["score"]} right now";
$tip.="\n This {$row["softwarename"]} pod {$row["name"]} has been watched for {$row["monthsmonitored"]} months with an uptime of {$row["uptimelast7"]}% this month and was last checked on {$row["dateupdated"]}. ";
$tip.="On a scale of -20 to +20 this pod is a {$row["score"]} right now";
echo "<tr><td><a class='$class' target='new' href='". $method . $row["domain"] ."'>" . $row["domain"] . " <div title='$tip' class='tipsy' style='display: inline-block'>?</div></a></td>";
"</div></td>";
......@@ -84,7 +84,7 @@ else
if ($row["shortversion"] == $row["masterversion"] && $row["shortversion"] != "") {$classver = "green";} elseif ($verdiff > 6) {$classver = "red";} else {$classver = "black";}
echo "<td class='$classver'><div title='{$pre} codename: {$row["longversion"]} master version is: {$row["masterversion"]}' class='tipsy'>{$version}</div></td>";
echo "<td>" . $row["uptimelast7"] . "%</td>";
echo "<td>" . $row["responsetimelast7"] . "</td>";
echo "<td>" . $row["ipv6"] . "</td>";
if ($row["signup"] == 1) {$signup="Open";} else {$signup="Closed";}
echo "<td>" . $signup . "</td>";
echo "<td>" . $row["total_users"] . "</td>";
......@@ -114,6 +114,7 @@ echo "✪";
if ($row["service_twitter"] == "t") {echo "<div id='twitter' class='smlogo'></div>";}
if ($row["service_tumblr"] == "t") {echo "<div id='tumblr' class='smlogo'></div>";}
if ($row["service_wordpress"] == "t") {echo "<div id='wordpress' class='smlogo'></div>";}
if ($row["xmpp"] == "t") {echo "<div id='xmpp'><img src='/images/icon-xmpp.png' width='16px' height='16px' title='XMPP chat server' alt='XMPP chat server'></div>";}
echo "</td></tr>\n";
if ($tt == 5) {
echo <<<EOF
......
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