Commit 376ebb1c authored by dmorley's avatar dmorley
Browse files

Merge branch 'develop'

parents a4764051 b49902e3
Pipeline #5265 passed with stages
in 41 seconds
......@@ -2,3 +2,4 @@ bower_components
config.php
node_modules
vendor
/.yarn/
......@@ -37,12 +37,16 @@ deploy:
stage: deploy
environment:
name: development
script:
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt-get update && apt-get install -y sudo curl gnupg2
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
- echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
- apt-get update && apt-get install -y minify zip unzip php7.4 php7.4-curl php7.4-pgsql php7.4-bcmath php-geoip php7.4-cli php7.4-common php7.4-fpm php7.4-bcmath php7.4-json php7.4-readline php7.4-mbstring php7.4-xml php7.4-intl php-cgi git curl npm nodejs yarn
- apt-get update && apt-get install -y sudo curl gnupg2 npm nodejs minify zip unzip php7.4 php7.4-curl php7.4-pgsql php7.4-bcmath php-geoip php7.4-cli php7.4-common php7.4-fpm php7.4-bcmath php7.4-json php7.4-readline php7.4-mbstring php7.4-xml php7.4-intl php-cgi git yarn
- rm .yarnrc.yml
- yarn set version berry
- "echo 'nodeLinker: 'node-modules'' | tee -a .yarnrc.yml"
script:
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install
- yarn install
......
yarnPath: ".yarn/releases/yarn-berry.cjs"
nodeLinker: "node-modules"
......@@ -9,6 +9,22 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
### Fixed
### Security
## [2.8.2]
### Added
- API v2 using graphql and Siler framework
- graphiql web-ide
### Changed
- Tell robots not to follow links to pods
- Limit stats to 2019 further as old data is inconsistent
- yarn 2.0
### Deprecated
- yarn 1.0 support
- API v1 api.php
### Removed
### Fixed
- Show stats in proper order yymm
### Security
## [2.8.1]
### Added
- Allow filter on domain name in config.php
......@@ -297,6 +313,8 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
[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.8.2]: https://git.feneas.org/diasporg/Poduptime/compare/2.8.1...2.8.2
[2.8.1]: https://git.feneas.org/diasporg/Poduptime/compare/2.8.0...2.8.1
[2.8.0]: https://git.feneas.org/diasporg/Poduptime/compare/2.7.0...2.8.0
[2.7.0]: https://git.feneas.org/diasporg/Poduptime/compare/2.6.4...2.7.0
[2.6.1]: https://git.feneas.org/diasporg/Poduptime/compare/2.6.0...2.6.1
......
......@@ -16,3 +16,5 @@
This product includes GeoLite2 data created by MaxMind, available from
<a href="http://www.maxmind.com">http://www.maxmind.com</a>.
<a href="https://www.mapbox.com/about/maps/" target="_blank">&copy; Mapbox &copy; OpenStreetMap</a>
# Poduptime
Poduptime is software to get live stats and data on listed Diaspora and other Pods that support nodeinfo output.
Poduptime is software to get live stats and data on pods that support nodeinfo output.
# To Install:
......@@ -11,7 +11,7 @@ OS Dependencies:
php7.4 php7.4-curl php7.4-pgsql php7.4-bcmath php-geoip php7.4-cli php7.4-common php7.4-fpm php7.4-bcmath php7.4-json php7.4-readline php7.4-mbstring php7.4-xml php7.4-intl php-cgi git curl postgresql postgresql-contrib dnsutils bind9 npm nodejs composer
```
Yarn is a separate install: https://yarnpkg.com
Yarn is a separate install: sudo npm install -g yarn
Clone and setup:
......@@ -51,7 +51,7 @@ see file http-server-config.example
# To Use:
run `php-cgi db/update-all.php` to update your data for all pods
run `php-cgi db/update-all.php` to update your data for all pods
run `php db/update.php debug` to debug output
run `php db/update.php sqldebug` to debug sql
run `php db/update.php develop` to run without email alerts to end users
......
<?php
/**
* API access for pod data.
* API access for pod data. This is v1 and is deprecated. See /api/
*/
declare(strict_types=1);
......
#Graphql API Endpoint
Install your favorite Graphql extension on your browser and build away
<html>
<head>
<title>GraphiQL</title>
<link href="/node_modules/graphiql/graphiql.min.css" rel="stylesheet" />
</head>
<body style="margin: 0;">
<div class="graphiql-container" style="height: 2vh;">Use your favorite graphql browser extension, IDE, or graphiql below to get started.</div>
<div id="graphiql" style="height: 98vh;"></div>
<script
src="/node_modules/react/umd/react.production.min.js"
></script>
<script
src="/node_modules/react-dom/umd/react-dom.production.min.js"
></script>
<script
src="/node_modules/graphiql/graphiql.min.js"
></script>
<script>
const graphQLFetcher = graphQLParams =>
fetch('', {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(graphQLParams),
})
.then(response => response.json())
.catch(() => response.text());
ReactDOM.render(
React.createElement(GraphiQL, { fetcher: graphQLFetcher }),
document.getElementById('graphiql'),
);
</script>
</body>
</html>
<?php
use Siler\GraphQL;
use Siler\Http\Request;
use Siler\Http\Response;
require_once __DIR__ . '/../boot.php';
Response\cors();
if (Request\method_is('post')) {
$schema = include __DIR__.'/schema.php';
GraphQL\init($schema);
} else {
require 'graphiql.php';
}
<?php
use RedBeanPHP\R;
use function Siler\{array_get_str};
require_once __DIR__ . '/../boot.php';
$queryType = array(
'nodes' => function () {
return R::getAll('
SELECT
id,
domain,
name,
softwarename,
masterversion,
fullversion,
shortversion,
stats_apikey,
score,
ip,
detectedlanguage,
country,
countryname,
city,
state,
lat,
long,
email,
ipv6,
sslvalid,
monthsmonitored,
daysmonitored,
signup,
total_users,
active_users_halfyear,
active_users_monthly,
local_posts,
uptime_alltime,
status,
latency,
service_xmpp,
services,
protocols,
token,
publickey,
tokenexpire,
podmin_statement,
podmin_notify,
podmin_notify_level,
sslexpire,
dnssec,
comment_counts,
weight,
date_updated,
date_laststats,
date_created
FROM pods
');
},
'node' => function ($_, array $args) {
$domain = array_get_str($args, 'domain');
return R::getAll('
SELECT
id,
domain,
name,
softwarename,
masterversion,
fullversion,
shortversion,
stats_apikey,
score,
ip,
detectedlanguage,
country,
countryname,
city,
state,
lat,
long,
email,
ipv6,
sslvalid,
monthsmonitored,
daysmonitored,
signup,
total_users,
active_users_halfyear,
active_users_monthly,
local_posts,
uptime_alltime,
status,
latency,
service_xmpp,
services,
protocols,
token,
publickey,
tokenexpire,
podmin_statement,
podmin_notify,
podmin_notify_level,
sslexpire,
dnssec,
comment_counts,
weight,
date_updated,
date_laststats,
date_created
FROM pods
WHERE domain = ?
', [$domain]);
},
'checks' => function ($_, array $args) {
if ($args) {
$limit = array_get_str($args, 'limit');
} else {
$limit = 5000;
}
return R::getAll('
SELECT id, domain, online, error, latency, total_users, local_posts, comment_counts, shortversion, version, date_checked
FROM checks
ORDER BY date_checked DESC
LIMIT ?
', [$limit]);
},
'clicks' => function ($_, array $args) {
if ($args) {
$limit = array_get_str($args, 'limit');
} else {
$limit = 5000;
}
return R::getAll('
SELECT id, domain, manualclick, autoclick, date_clicked
FROM clicks
ORDER BY date_clicked DESC
LIMIT ?
', [$limit]);
},
'monthlystats' => function () {
return R::getAll('
SELECT id, softwarename, total_users, total_posts, total_comments, total_pods, total_uptime, date_checked
FROM monthlystats
');
},
'masterversions' => function () {
return R::getAll('
SELECT id, software, version, devlastcommit, releasedate, date_checked
FROM masterversions
');
},
);
return [
'Query' => $queryType,
];
type Node {
id: Int!
name: String
domain: String
podmin_statement: String
masterversion: String
shortversion: String
softwarename: String
daysmonitored: Int
monthsmonitored: Int
fullversion: String
score: Int
ip: String
detectedlanguage: String
country: String
countryname: String
city: String
state: String
lat: String
long: String
ipv6: Boolean
sslvalid: String
signup: Boolean
total_users: Int
active_users_halfyear: Int
active_users_monthly: Int
local_posts: Int
uptime_alltime: String
status: Int
latency: Int
service_xmpp: Boolean
services: String
protocols: String
sslexpire: String
dnssec: Boolean
comment_counts: Int
weight: Int
date_updated: String
date_laststats: String
date_created: String
}
type Click {
id: Int!
domain: String
manualclick: Int
autoclick: Int
date_clicked: String
}
type Check {
id: Int!
domain: String
online: Boolean
error: String
latency: Int
total_users: Int
local_posts: Int
comment_counts: Int
shortversion: String
version: String
date_checked: String
}
type MonthlyStat {
id: Int!
softwarename: String
total_users: Int
total_posts: Int
total_comments: Int
total_pods: Int
total_uptime: Int
date_checked: String
}
type MasterVersion {
id: Int!
software: String
version: String
devlastcommit: String
releasedate: String
date_checked: String
}
type Query {
nodes: [Node]
node (domain: String): [Node]
clicks (limit: Int): [Click]
checks (limit: Int): [Check]
monthlystats: [MonthlyStat]
masterversions: [MasterVersion]
}
<?php
use Siler\GraphQL;
$typeDefs = file_get_contents(__DIR__.'/schema.graphql');
$resolvers = include __DIR__.'/resolvers.php';
return GraphQL\schema($typeDefs, $resolvers);
This diff is collapsed.
......@@ -96,6 +96,7 @@ try {
}
setcookie('domain', $domain, Carbon::now()->addCentury()->timestamp);
header('X-Robots-Tag: nofollow');
header('Location: https://' . $domain);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
......
......@@ -88,7 +88,8 @@ $navs = [
['text' => 'Edit a pod', 'href' => '/podminedit', 'active' => $podminedit],
['text' => 'Open Source Code', 'href' => 'https://git.feneas.org/diasporg/Poduptime', 'active' => false],
['text' => 'Support', 'href' => 'https://dia.so/support', 'active' => false],
['text' => 'Wiki/API', 'href' => 'https://git.feneas.org/diasporg/Poduptime/wikis/home', 'active' => false],
['text' => 'Wiki', 'href' => 'https://git.feneas.org/diasporg/Poduptime/wikis/home', 'active' => false],
['text' => 'API', 'href' => '//api.' . c('domain'), 'active' => false],
['text' => 'More about the Fediverse', 'href' => 'https://fediverse.party', 'active' => false],
['text' => 'Federated Networks Association', 'href' => 'https://feneas.org', 'active' => false],
],
......
{
"name": "poduptime",
"version": "2.7.0",
"version": "2.8.0",
"description": "Poduptime is software to get live stats and data on listed Diaspora Pods.",
"main": "index.php",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.2.0",
"@popperjs/core": "^2.5.3",
"bootstrap": "^4.5.3",
"chart.js": "^2.9.4",
"featherlight": "^1.7.14",
"fork-awesome": "ForkAwesome/Fork-Awesome",
"graphiql": "^1.2.0",
"ion-rangeslider": "^2.2.0",
"jquery": "^3.5.0",
"leaflet": "^1.4.1",
"leaflet.markercluster": "^1.4.1",
"popper.js": "^1.15.0",
"tablesorter": "^2.31.3",
"typeface-roboto": "^0.0.54"
"prop-types": "^15.7.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"tablesorter": "^2.31.3"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
......
......@@ -35,6 +35,7 @@ try {
FROM clicks
WHERE domain = ?
GROUP BY yymm
ORDER BY yymm
", [$_domain]);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
......
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