Merge pull request #3669 from annando/pleroma

Pleroma servers are now detected and displayed in the statistics
This commit is contained in:
Tobias Diekershoff 2017-08-29 22:49:17 +02:00 committed by GitHub
commit 51a070ecf3
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 // Test for Mastodon
$orig_version = $version;
$serverret = z_fetch_url($server_url."/api/v1/instance"); $serverret = z_fetch_url($server_url."/api/v1/instance");
if ($serverret["success"] && ($serverret["body"] != '')) { if ($serverret["success"] && ($serverret["body"] != '')) {
$data = json_decode($serverret["body"]); $data = json_decode($serverret["body"]);
@ -1157,6 +1158,9 @@ function poco_check_server($server_url, $network = "", $force = false) {
$network = NETWORK_OSTATUS; $network = NETWORK_OSTATUS;
} }
} }
if (strstr($orig_version, 'Pleroma')) {
$platform = 'Pleroma';
}
} }
if (!$failure) { if (!$failure) {
@ -1169,7 +1173,9 @@ function poco_check_server($server_url, $network = "", $force = false) {
$version = $data->version; $version = $data->version;
$network = NETWORK_DIASPORA; $network = NETWORK_DIASPORA;
} }
if (!empty($data->site_name)) {
$site_name = $data->site_name; $site_name = $data->site_name;
}
switch ($data->register_policy) { switch ($data->register_policy) {
case "REGISTER_OPEN": case "REGISTER_OPEN":
$register_policy = 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); $version = preg_replace("=(.+)-(.{4,})=ism", "$1", $version);
} }
if (!empty($data->name)) {
$site_name = $data->name; $site_name = $data->name;
}
if (isset($data->network)) { if (!empty($data->network)) {
$platform = $data->network; $platform = $data->network;
} }

View file

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

View file

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