Commit ea86ebe7 authored by Armando Lüscher's avatar Armando Lüscher

Merge branch 'cleanup-api-misc' into 'develop'

Cleanup api misc

See merge request !227
parents 7af77399 826e9eb6
Pipeline #1076 passed with stage
in 2 minutes and 31 seconds
......@@ -3,8 +3,10 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
## [Unreleased]
### Added
- osada version check
### Changed
### Deprecated
- api-more.php calls. old droid app been dead for years
### Removed
### Fixed
### Security
......
<?php
/**
* This is just a single API for a pod for the Android app to get data.
*/
declare(strict_types=1);
use Poduptime\PodStatus;
use RedBeanPHP\R;
// Required parameters.
($_domain = $_GET['domain'] ?? null) || die('no domain given');
// Other parameters.
$_format = $_GET['format'] ?? '';
require_once __DIR__ . '/../boot.php';
try {
$pod = R::getRow('
SELECT hgitdate, id, domain, status, secure, score, userrating, adminrating, city, state, country, lat, long, ip, ipv6, pingdomurl, monthsmonitored, uptimelast7, responsetimelast7, local_posts, comment_counts, dateCreated, dateUpdated, dateLaststats, hidden
FROM pods_apiv1
WHERE domain = ?
', [$_domain]);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
}
if ($_format === 'json') {
echo json_encode($pod);
} else {
if ($pod['status'] === PodStatus::UP) {
echo 'Status: Up<br>';
}
if ($pod['status'] === PodStatus::DOWN) {
echo 'Status: Down<br>';
}
echo 'Last Git Pull: ' . $pod['hgitdate'] . '<br>';
echo 'Uptime This Month ' . $pod['uptimelast7'] . '<br>';
echo 'Months Monitored: ' . $pod['monthsmonitored'] . '<br>';
echo 'Response Time: ' . $pod['responsetimelast7'] . '<br>';
echo 'User Rating: ' . $pod['userrating'] . '<br>';
echo 'Server Location: ' . $pod['country'] . '<br>';
echo 'Latitude: ' . $pod['lat'] . '<br>';
echo 'Longitude: ' . $pod['long'] . '<br>';
}
......@@ -25,6 +25,7 @@ $softwares = [
'writefreely' => ['repo' => 'writeas/writefreely', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'ganggo' => ['repo' => 'ganggo%2fganggo', 'gitsite' => 'git.feneas.org', 'gittype' => 'gitlab', 'devbranch' => ''],
'funkwhale' => ['repo' => 'funkwhale%2ffunkwhale', 'gitsite' => 'code.eliotberriot.com', 'gittype' => 'gitlab', 'devbranch' => 'develop'],
'osada' => ['repo' => 'macgirvin%2fosada', 'gitsite' => 'framagit.org', 'gittype' => 'gitlab', 'devbranch' => 'dev'],
];
$opts = [
......
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