Commit 504a3b31 authored by Armando Lüscher's avatar Armando Lüscher

Merge branch 'allservices' into 'develop'

Allservices

See merge request !211
parents 46c5f3f3 2a67c204
......@@ -2,6 +2,7 @@
The format is based on [Keep a Changelog] and this project adheres to [Semantic Versioning].
## [Unreleased]
:exclamation: DB migrations required! (see [SQL migration script][2.4.0-sql-migration])
### Added
- Added bootstrapping to simplify initialisation of config and database
- Config syntax has changed to array style (#155)
......@@ -10,6 +11,7 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
- Podmin can choose at what fail score to send the notice out
- Podmin email shares details on why pod is failing
- Only retrieve location data for remote servers / IPs
- Fontawesome for icons
### Changed
- Introduce proper changelog format (#189)
- Moved DB migration scripts into `db` folder
......@@ -23,6 +25,7 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
- Score now goes to -5000 before a pod is removed so dead pods get checked a while then removed for good
- Move functions to dedicated file to allow reuse
- Backup script rewrite
- Store services as json array
### Deprecated
### Removed
### Fixed
......@@ -84,8 +87,9 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
### Fixed
- Fix ipv6
[2.2.0-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.1.4-2.2.0.sql
[2.4.0-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.3.0-2.4.0.sql
[2.3.0-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.2.0-2.3.0.sql
[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.3.1]: https://git.feneas.org/diasporg/Poduptime/compare/2.3.0...2.3.1
......
......@@ -25,35 +25,8 @@
}
.smlogo {
width: 16px;
height: 16px;
background: url('/images/smlogo.png') 0 0;
display: inline-block;
margin: 0;
}
.smlogo-twitter {
background-position: 0 -776px;
}
.smlogo-facebook {
background-position: 0 -824px;
}
.smlogo-tumblr {
background-position: 0 -792px;
}
.smlogo-wordpress {
background-position: 0 -656px;
}
.smlogo-xmpp {
background: none;
}
.smlogo-xmpp img {
vertical-align: unset;
display: inline-block;
}
#map {
......
ALTER TABLE pods ADD services jsonb;
ALTER TABLE pods DROP COLUMN service_facebook, DROP COLUMN service_wordpress, DROP COLUMN service_tumblr, DROP COLUMN service_twitter;
ALTER TABLE pods ADD podmin_notify_level int DEFAULT 50;
......@@ -138,17 +138,10 @@ foreach ($pods as $pod) {
$local_posts = $jsonssl->usage->localPosts ?? 0;
$comment_counts = $jsonssl->usage->localComments ?? 0;
$service_xmpp = ($jsonssl->metadata->xmppChat ?? false) === true;
$service_facebook = false;
$service_twitter = false;
$service_tumblr = false;
$service_wordpress = false;
if (json_last_error() === 0) {
(!$jsonssl->software->version) || $score += 1;
if (is_array($jsonssl->services->outbound)) {
$service_facebook = in_array('facebook', $jsonssl->services->outbound, true);
$service_twitter = in_array('twitter', $jsonssl->services->outbound, true);
$service_tumblr = in_array('tumblr', $jsonssl->services->outbound, true);
$service_wordpress = in_array('wordpress', $jsonssl->services->outbound, true);
$services = json_encode($jsonssl->services->outbound);
}
}
......@@ -396,7 +389,6 @@ foreach ($pods as $pod) {
$p['state'] = $state;
$p['lat'] = $lat;
$p['long'] = $long;
$p['detectedlanguage'] = $detectedlanguage;
$p['userrating'] = $user_rating;
$p['masterversion'] = $masterversion;
$p['weightedscore'] = $weightedscore;
......@@ -411,12 +403,10 @@ foreach ($pods as $pod) {
$p['active_users_monthly'] = $active_users_monthly;
$p['local_posts'] = $local_posts;
$p['name'] = $name;
$p['detectedlanguage'] = $detectedlanguage;
$p['comment_counts'] = $comment_counts;
$p['service_facebook'] = $service_facebook;
$p['service_tumblr'] = $service_tumblr;
$p['service_twitter'] = $service_twitter;
$p['service_wordpress'] = $service_wordpress;
$p['service_xmpp'] = $service_xmpp;
$p['services'] = $services;
$p['softwarename'] = $softwarename;
}
......
......@@ -30,11 +30,8 @@ CREATE TABLE pods (
uptime_alltime numeric(5,2),
status smallint DEFAULT 1,
latency smallint,
service_facebook boolean,
service_twitter boolean,
service_tumblr boolean,
service_wordpress boolean,
service_xmpp boolean,
services jsonb,
token text,
publickey text,
tokenexpire timestamp,
......
......@@ -35,6 +35,7 @@ $fullview = false;
<link rel="stylesheet" href="node_modules/ion-rangeslider/css/ion.rangeSlider.skinHTML5.css"/>
<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"/>
<meta property="og:url" content="https://<?php echo $_SERVER['HTTP_HOST'] ?>"/>
<meta property="og:title" content="Social Network Pod Finder"/>
<meta property="og:type" content="website"/>
......
......@@ -4,6 +4,7 @@
"description": "Poduptime is software to get live stats and data on listed Diaspora Pods.",
"main": "index.php",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.2.0",
"bootstrap": "^4.1.3",
"chart.js": "^2.7.2",
"featherlight": "^1.7.13",
......@@ -14,7 +15,6 @@
"popper.js": "^1.14.3",
"tablesorter": "^2.30.7"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
......
......@@ -17,7 +17,7 @@ $sql = "
SELECT
to_char(date_checked, 'yyyy MM') AS yymm,
count(*) AS total_checks,
round(avg(online::INT),2)*100 AS uptime,
round(avg(online::INT),4)*100 AS uptime,
round(avg(latency),2) * 1000 AS latency
FROM checks
WHERE domain = ?
......
......@@ -58,7 +58,7 @@ $country_code = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? '';
<th class="columnSelector-false"><div data-toggle="tooltip" title="Version of software this pod runs">Version</div></th>
<th class="columnSelector-false filter-select" data-priority="3"><div data-toggle="tooltip" title="Type of software this pod runs">Software</div></th>
<th data-priority="1"><div data-toggle="tooltip" title="Percent of the time the pod is online.">Uptime</div></th>
<th class="columnSelector-false filter-select"<div data-toggle="tooltip" title="Does this pod offer ipv6 connection.">IPv6</div></th>
<th class="columnSelector-false filter-select"><div data-toggle="tooltip" title="Does this pod offer ipv6 connection.">IPv6</div></th>
<th class="columnSelector-false"><div data-toggle="tooltip" title="Average connection latency time in ms from Los Angeles.">Latency</div></th>
<th class="filter-select" data-priority="2"><div data-toggle="tooltip" title="Does this pod allow new users.">Signups</div></th>
<th data-priority="2" data-selector-name="Total Users"><div data-toggle="tooltip" title="Number of total users on this pod.">Users</div></th>
......@@ -75,12 +75,7 @@ $country_code = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? '';
<th class="columnSelector-false" data-priority="5"><div data-toggle="tooltip" title="Pod City, based on IP Geolocation.">City</div></th>
<th class="columnSelector-false" data-priority="5"><div data-toggle="tooltip" title="Pod State, based on IP Geolocation.">State</div></th>
<th class="columnSelector-false filter-select"><div data-toggle="tooltip" title="Pod language detected from their main page text.">Language</div></th>
<th data-priority="3" data-selector-name="All Services"><div data-toggle="tooltip" title="External Social Networks this pod can post to." class="filter-false">Services</div></th>
<th class="columnSelector-false filter-select"><div data-toggle="tooltip" title="External post to Facebook.">Facebook</div></th>
<th class="columnSelector-false filter-select"><div data-toggle="tooltip" title="External post to Twitter.">Twitter</div></th>
<th class="columnSelector-false filter-select"><div data-toggle="tooltip" title="External post to Tumblr.">Tumblr</div></th>
<th class="columnSelector-false filter-select"><div data-toggle="tooltip" title="External post to Wordpress.">Wordpress</div></th>
<th class="columnSelector-false filter-select"><div data-toggle="tooltip" title="Supports Jabber/XMPP for chat.">XMPP</div></th>
<th data-placeholder="Try: facebook AND twitter" class="filter-match" data-priority="3" data-selector-name="All Services"><div data-toggle="tooltip" title="External Social Networks this pod can post to." class="filter-false">Services</div></th>
<th data-priority="6" data-selector-name="Podmin Info"><div data-toggle="tooltip" title="Click for more information about this pod from the pod host (podmin).">Info</div></th>
</tr>
</thead>
......
......@@ -24,7 +24,7 @@ if ($country_code) {
try {
$pods = R::getAll("
SELECT domain, signup, name, lat, long, softwarename, uptime_alltime, active_users_halfyear, service_facebook, service_twitter, service_tumblr, service_wordpress, service_xmpp
SELECT domain, signup, name, lat, long, softwarename, uptime_alltime, active_users_halfyear, services, service_xmpp
FROM pods
WHERE long != ''
AND lat != ''
......@@ -52,11 +52,41 @@ try {
$i++ > 0 && print ',';
$feat = '';
$pod['service_facebook'] && $feat .= '<div class="smlogo smlogo-facebook" title="Publish to Facebook"></div>';
$pod['service_twitter'] && $feat .= '<div class="smlogo smlogo-twitter" title="Publish to Twitter"></div>';
$pod['service_tumblr'] && $feat .= '<div class="smlogo smlogo-tumblr" title="Publish to Tumblr"></div>';
$pod['service_wordpress'] && $feat .= '<div class="smlogo smlogo-wordpress" title="Publish to WordPress"></div>';
$pod['service_xmpp'] && $feat .= '<div class="smlogo smlogo-xmpp"><img src="/images/icon-xmpp.png" width="16" height="16" title="XMPP chat server" alt="XMPP chat server"></div>';
$services = json_decode($pod['services'] ?? '[]') ?: [];
// Special case for XMPP, which is not an official service, but listed in the same cell.
($pod['service_xmpp'] ?? false) && $services[] = 'xmpp';
$services_list = [
'facebook' => ['fa' => 'fab fa-facebook-f', 'title' => 'Publish to Facebook'],
'twitter' => ['fa' => 'fab fa-twitter', 'title' => 'Publish to Twitter'],
'tumblr' => ['fa' => 'fab fa-tumblr', 'title' => 'Publish to Tumblr'],
'wordpress' => ['fa' => 'fab fa-wordpress-simple', 'title' => 'Publish to WordPress'],
'xmpp' => ['fa' => 'fas fa-comments', 'title' => 'XMPP chat server'],
'appnet' => ['fa' => 'fas fa-th', 'title' => 'Publish to App.net'],
'atom1.0' => ['fa' => 'fas fa-rss', 'title' => 'Publish to Atom'],
'blogger' => ['fa' => 'fab fa-blogger-b', 'title' => 'Publish to Blogger'],
'gnusocial' => ['fa' => 'fab fa-grunt', 'title' => 'Publish to GNUSocial'],
'google' => ['fa' => 'fab fa-google', 'title' => 'Publish to Google+'],
'libertree' => ['fa' => 'fas fa-tree', 'title' => 'Publish to Libertree'],
'linkedin' => ['fa' => 'fab fa-linkedin-in', 'title' => 'Publish to LinkedIn'],
'livejournal' => ['fa' => 'fas fa-pencil-alt', 'title' => 'Publish to Live Journal'],
'pinterest' => ['fa' => 'fab fa-pinterest-p', 'title' => 'Publish to Pinterest'],
'pumpio' => ['fa' => 'fas fa-greater-than', 'title' => 'Publish to Pump.io'],
];
foreach ($services as $service) {
// Make sure we have this service in the list.
if (!isset($services_list[$service])) {
continue;
}
$feat .= sprintf(
'<div class="smlogo mr-sm-1"><i class="%1$s" data-toggle="tooltip" title="%2$s"></i></div>',
$services_list[$service]['fa'],
$services_list[$service]['title']
);
}
$pod_name = htmlentities($pod['name'] ?? '', ENT_QUOTES);
$signup = $pod['signup'] ? 'yes' : 'no';
......
......@@ -16,7 +16,7 @@ $iso = new Matriphe\ISO639\ISO639;
try {
$pods = R::getAll('
SELECT domain, dnssec, podmin_statement, sslexpire, masterversion, shortversion, softwarename, daysmonitored, monthsmonitored, score, signup, name, country, countryname, city, state, detectedlanguage, uptime_alltime, active_users_halfyear, active_users_monthly, service_facebook, service_twitter, service_tumblr, service_wordpress, service_xmpp, latency, date_updated, ipv6, total_users, local_posts, comment_counts, userrating, status
SELECT domain, dnssec, podmin_statement, sslexpire, masterversion, shortversion, softwarename, daysmonitored, monthsmonitored, score, signup, name, country, countryname, city, state, detectedlanguage, uptime_alltime, active_users_halfyear, active_users_monthly, services, service_xmpp, latency, date_updated, ipv6, total_users, local_posts, comment_counts, userrating, status
FROM pods
WHERE status < ?
AND score > 0
......@@ -81,19 +81,45 @@ foreach ($pods as $pod) {
echo '<td>' . $pod['city'] . '</td>';
echo '<td>' . $pod['state'] . '</td>';
echo '<td data-toggle="tooltip" title="' . ($pod['detectedlanguage'] ? $iso->languageByCode1($pod['detectedlanguage']) : '') . '">' . ($pod['detectedlanguage'] ? strtoupper($pod['detectedlanguage']) : '') . '</td>';
$services = json_decode($pod['services'] ?? '[]') ?: [];
// Special case for XMPP, which is not an official service, but listed in the same cell.
($pod['service_xmpp'] ?? false) && $services[] = 'xmpp';
$services_list = [
'facebook' => ['fa' => 'fab fa-facebook-f', 'title' => 'Publish to Facebook'],
'twitter' => ['fa' => 'fab fa-twitter', 'title' => 'Publish to Twitter'],
'tumblr' => ['fa' => 'fab fa-tumblr', 'title' => 'Publish to Tumblr'],
'wordpress' => ['fa' => 'fab fa-wordpress-simple', 'title' => 'Publish to WordPress'],
'xmpp' => ['fa' => 'fas fa-comments', 'title' => 'XMPP chat server'],
'appnet' => ['fa' => 'fas fa-th', 'title' => 'Publish to App.net'],
'atom1.0' => ['fa' => 'fas fa-rss', 'title' => 'Publish to Atom'],
'blogger' => ['fa' => 'fab fa-blogger-b', 'title' => 'Publish to Blogger'],
'gnusocial' => ['fa' => 'fab fa-grunt', 'title' => 'Publish to GNUSocial'],
'google' => ['fa' => 'fab fa-google', 'title' => 'Publish to Google+'],
'libertree' => ['fa' => 'fas fa-tree', 'title' => 'Publish to Libertree'],
'linkedin' => ['fa' => 'fab fa-linkedin-in', 'title' => 'Publish to LinkedIn'],
'livejournal' => ['fa' => 'fas fa-pencil-alt', 'title' => 'Publish to Live Journal'],
'pinterest' => ['fa' => 'fab fa-pinterest-p', 'title' => 'Publish to Pinterest'],
'pumpio' => ['fa' => 'fas fa-greater-than', 'title' => 'Publish to Pump.io'],
];
echo '<td class="text-truncate">';
$pod['service_facebook'] && print '<div class="smlogo smlogo-facebook" data-toggle="tooltip" title="Publish to Facebook"></div>';
$pod['service_twitter'] && print '<div class="smlogo smlogo-twitter" data-toggle="tooltip" title="Publish to Twitter"></div>';
$pod['service_tumblr'] && print '<div class="smlogo smlogo-tumblr" data-toggle="tooltip" title="Publish to Tumblr"></div>';
$pod['service_wordpress'] && print '<div class="smlogo smlogo-wordpress" data-toggle="tooltip" title="Publish to WordPress"></div>';
$pod['service_xmpp'] && print '<div class="smlogo smlogo-xmpp"><img src="/images/icon-xmpp.png" width="16" height="16" data-toggle="tooltip" title="XMPP chat server" alt="XMPP chat server"></div>';
echo '</td>';
echo '<td>' . ($pod['service_facebook'] ? 'Yes' : 'No') . '</td>';
echo '<td>' . ($pod['service_twitter'] ? 'Yes' : 'No') . '</td>';
echo '<td>' . ($pod['service_tumblr'] ? 'Yes' : 'No') . '</td>';
echo '<td>' . ($pod['service_wordpress'] ? 'Yes' : 'No') . '</td>';
echo '<td>' . ($pod['service_xmpp'] ? 'Yes' : 'No') . '</td>';
foreach ($services as $service) {
// Make sure we have this service in the list.
if (!isset($services_list[$service])) {
continue;
}
printf(
'<div class="smlogo mr-sm-1"><i class="%1$s" data-toggle="tooltip" title="%2$s"></i><div class="hidden">%3$s</div></div>',
$services_list[$service]['fa'],
$services_list[$service]['title'],
$service
);
}
echo '</td>';
$podmin_statement = htmlentities($pod['podmin_statement'] ?? '', ENT_QUOTES);
echo '<td>' . ($podmin_statement ? '<a href="#" data-featherlight="<p>' . $podmin_statement . '</p>">&#128172;</a>' : '&nbsp;') . '</td></tr>';
}
......@@ -2,6 +2,10 @@
# yarn lockfile v1
"@fortawesome/fontawesome-free@^5.2.0":
version "5.2.0"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.2.0.tgz#50cd9856774351c56c0b1b0db4efe122d7913e58"
bootstrap@^4.1.3:
version "4.1.3"
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.1.3.tgz#0eb371af2c8448e8c210411d0cb824a6409a12be"
......@@ -61,8 +65,8 @@ moment@^2.10.2:
resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66"
popper.js@^1.14.3:
version "1.14.3"
resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.14.3.tgz#1438f98d046acf7b4d78cd502bf418ac64d4f095"
version "1.14.4"
resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.14.4.tgz#8eec1d8ff02a5a3a152dd43414a15c7b79fd69b6"
tablesorter@^2.30.7:
version "2.30.7"
......
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