Pleroma-Servers are now detected and displayed in the statistics

This commit is contained in:
Michael 2017-08-29 16:40:08 +00:00
parent c948e4cdc3
commit 1893c3df16
3 changed files with 15 additions and 5 deletions

View File

@ -1146,6 +1146,7 @@ function poco_check_server($server_url, $network = "", $force = false) {
}
// Test for Mastodon
$orig_version = $version;
$serverret = z_fetch_url($server_url."/api/v1/instance");
if ($serverret["success"] && ($serverret["body"] != '')) {
$data = json_decode($serverret["body"]);
@ -1157,6 +1158,9 @@ function poco_check_server($server_url, $network = "", $force = false) {
$network = NETWORK_OSTATUS;
}
}
if (strstr($orig_version, 'Pleroma')) {
$platform = 'Pleroma';
}
}
if (!$failure) {
@ -1169,7 +1173,9 @@ function poco_check_server($server_url, $network = "", $force = false) {
$version = $data->version;
$network = NETWORK_DIASPORA;
}
$site_name = $data->site_name;
if (!empty($data->site_name)) {
$site_name = $data->site_name;
}
switch ($data->register_policy) {
case "REGISTER_OPEN":
$register_policy = REGISTER_OPEN;
@ -1249,9 +1255,11 @@ function poco_check_server($server_url, $network = "", $force = false) {
$version = preg_replace("=(.+)-(.{4,})=ism", "$1", $version);
}
$site_name = $data->name;
if (!empty($data->name)) {
$site_name = $data->name;
}
if (isset($data->network)) {
if (!empty($data->network)) {
$platform = $data->network;
}

View File

@ -1425,6 +1425,7 @@ function prepare_body(&$item, $attach = false, $preview = false) {
$title .= ' ' . $mtch[2] . ' ' . t('bytes');
if (($filetype == 'image') AND ($item['network'] == NETWORK_OSTATUS)) {
/// @todo Respect the spoiler for mastodon
$icon = '<img class="attached" src="'.$the_url.'" alt="" title="'.$title.'">';
$s .= '<br><a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attached" target="_blank" >' . $icon . '</a>';
} else {

View File

@ -441,7 +441,7 @@ function admin_page_federation(App $a) {
// off one % two of them are needed in the query
// Add more platforms if you like, when one returns 0 known nodes it is not
// displayed on the stats page.
$platforms = array('Friendi%%a', 'Diaspora', '%%red%%', 'Hubzilla', 'BlaBlaNet', 'GNU Social', 'StatusNet', 'Mastodon');
$platforms = array('Friendi%%a', 'Diaspora', '%%red%%', 'Hubzilla', 'BlaBlaNet', 'GNU Social', 'StatusNet', 'Mastodon', 'Pleroma');
$colors = array('Friendi%%a' => '#ffc018', // orange from the logo
'Diaspora' => '#a1a1a1', // logo is black and white, makes a gray
'%%red%%' => '#c50001', // fire red from the logo
@ -449,7 +449,8 @@ function admin_page_federation(App $a) {
'BlaBlaNet' => '#3B5998', // blue from the navbar at blablanet-dot-com
'GNU Social'=> '#a22430', // dark red from the logo
'StatusNet' => '#789240', // the green from the logo (red and blue have already others
'Mastodon' => '#1a9df9'); // blue from the Mastodon logo
'Mastodon' => '#1a9df9', // blue from the Mastodon logo
'Pleroma' => '#E46F0F'); // Orange from the text that is used on Pleroma instances
$counts = array();
$total = 0;