Commit fae9b7c6 authored by dmorley's avatar dmorley
Browse files

Merge branch 'develop' into 'master'

2.8.0 merge

See merge request !272
parents 5acb3095 68f33b19
Pipeline #5161 passed with stage
in 20 seconds
cache:
key: poduptime
paths:
- vendor/
stages:
- test
- deploy
before_script:
- apk add -U git
- docker-php-ext-install -j$(nproc) bcmath
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install
test:7.4:
test:
stage: test
cache:
key: poduptime
paths:
- vendor/
image: php:7.4-cli-alpine
before_script:
- apk add -U git
- docker-php-ext-install -j$(nproc) bcmath
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install
script:
- php composer.phar check-code
deploy:
stage: deploy
environment:
name: development
script:
- php composer.phar check-code
- 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
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install
- yarn install
- minify -o js/podup.min.js js/podup.js
- minify -o css/poduptime.min.css css/poduptime.css
- sudo cp -a ./ /var/www/podupdev
tags:
- deploy
only:
- develop
......@@ -9,6 +9,27 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
### Fixed
### Security
## [2.8.0]
:exclamation: DB migrations required! (see [SQL migration script][2.8.0-sql-migration])
:exclamation: `config.php` changed - requires updates
### Added
- Try and match country on a random go.php call - cloudflare assumed
- List the software specific pages in the footer
- store monthly stats by software name also
- show stats by software
- show more about the software on software specific sites
### Changed
- Show wizard only when viewing all softwares
- Domain needs to be configured in config.php
- Configure sofwares for wizard in config.php with yes/no and description
- Change menus to be less movement and better for mobile
- Only show software specific to area chosen by end user via subdomain
### Deprecated
### Removed
### Fixed
- Wizard calls as it goes and sorts just a bit faster at the end
### Security
## [2.7.0]
:exclamation: DB migrations required! (see [SQL migration script][2.7.0-sql-migration])
:exclamation: `config.php` changed - requires updates
......@@ -252,6 +273,7 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
### Fixed
- Fix ipv6
[2.8.0-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.7.0-2.8.0.sql
[2.7.0-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.6.0-2.7.0.sql
[2.6.0-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.5.2-2.6.0.sql
[2.5.2-sql-migration]: https://git.feneas.org/diasporg/Poduptime/blob/master/db/migrations/2.5.0-2.5.2.sql
......@@ -262,6 +284,7 @@ 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.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
[2.6.0]: https://git.feneas.org/diasporg/Poduptime/compare/2.5.2...2.6.0
......
......@@ -41,6 +41,12 @@ return [
//admin email for forms
'adminemail' => '',
//domain this site is hosted on
'domain' => '',
//title to display in menus
'title' => '',
//number to stop checking a pod. usually a negative.
'minscore' => '-99',
......@@ -54,13 +60,13 @@ return [
'serveradurl' => '',
//DNS server for dnssec testing. 1.1.1.1 tests the best
'dnsserver' => '',
'dnsserver' => '1.1.1.1',
//server parallel processes max - greater than 10 can eat a lot of CPU - also make sure you have db connections/speed to support this number
'serverprocesses' => '',
'serverprocesses' => '1',
//Number of minutes to report on status.php that the run is still green
'status_green' => '',
'status_green' => '60',
//Number of minutes to report on status.php that the run is still green
'status_green' => '',
......@@ -82,33 +88,55 @@ return [
//detectlanguage.com api key
'dlkey' => '',
//hidden software word strings from view - %(one)% OR %(one|two|three)%
'hidden-softwares' => '%(relay|n/q)%',
//softwares and git repos we support
'softwares' => [
'diaspora' => ['repo' => 'diaspora/diaspora', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'friendica' => ['repo' => 'friendica/friendica', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'hubzilla' => ['repo' => 'hubzilla%2fcore', 'gitsite' => 'framagit.org', 'gittype' => 'gitlab', 'devbranch' => 'dev'],
'pleroma' => ['repo' => 'pleroma%2fpleroma', 'gitsite' => 'git.pleroma.social', 'gittype' => 'gitlab', 'devbranch' => 'develop'],
'socialhome' => ['repo' => 'socialhome%2fsocialhome', 'gitsite' => 'git.feneas.org', 'gittype' => 'gitlab', 'devbranch' => ''],
'social-relay' => ['repo' => 'jaywink%2fsocial-relay', 'gitsite' => 'git.feneas.org', 'gittype' => 'gitlab', 'devbranch' => ''],
'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' => 'zot%2fosada', 'gitsite' => 'framagit.org', 'gittype' => 'gitlab', 'devbranch' => 'dev'],
'funkwhale' => ['repo' => 'funkwhale%2ffunkwhale', 'gitsite' => 'dev.funkwhale.audio', 'gittype' => 'gitlab', 'devbranch' => 'develop'],
'gnusocial' => ['repo' => 'gnu%2fgnu-social', 'gitsite' => 'git.gnu.io', 'gittype' => 'gitlab', 'devbranch' => 'nightly'],
'pixelfed' => ['repo' => 'pixelfed/pixelfed', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'dev'],
'wordpress' => ['repo' => 'Wordpress/Wordpress', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => ''],
'misskey' => ['repo' => 'syuilo/misskey', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'speechmore' => ['repo' => 'speechmore%2fspeechmore', 'gitsite' => 'gitlab.fancy.org.uk', 'gittype' => 'gitlab', 'devbranch' => ''],
'peertube' => ['repo' => 'Chocobozzz/PeerTube', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'plume' => ['repo' => 'Plume-org/Plume', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => ''],
'rustodon' => ['repo' => 'rustodon/rustodon', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => ''],
'microblogpub' => ['repo' => 'tsileo/microblog.pub', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => ''],
'mobilizon' => ['repo' => 'framasoft/mobilizon', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => ''],
'lemmy' => ['repo' => 'fLemmyNet/lemmy', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => ''],
'diaspora' => ['repo' => 'diaspora/diaspora', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop',
'wizard' => '1', 'description' => 'Diaspora is a privacy-aware, distributed, open source social network'],
'friendica' => ['repo' => 'friendica/friendica', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop',
'wizard' => '1', 'description' => 'Friendica is a decentralised communications platform that integrates social communication'],
'hubzilla' => ['repo' => 'hubzilla%2fcore', 'gitsite' => 'framagit.org', 'gittype' => 'gitlab', 'devbranch' => 'dev',
'wizard' => '1', 'description' => 'Hubzilla is a powerful platform for creating interconnected websites featuring a decentralized identity'],
'pleroma' => ['repo' => 'pleroma%2fpleroma', 'gitsite' => 'git.pleroma.social', 'gittype' => 'gitlab', 'devbranch' => 'develop',
'wizard' => '0', 'description' => 'Pleroma is a free, federated social networking server built on open protocols'],
'socialhome' => ['repo' => 'socialhome%2fsocialhome', 'gitsite' => 'git.feneas.org', 'gittype' => 'gitlab', 'devbranch' => '',
'wizard' => '1', 'description' => 'Socialhome is best described as a federated personal profile with social networking functionality.'],
'social-relay' => ['repo' => 'jaywink%2fsocial-relay', 'gitsite' => 'git.feneas.org', 'gittype' => 'gitlab', 'devbranch' => '',
'wizard' => '0', 'description' => 'A relay system for the federation not for end users.'],
'writefreely' => ['repo' => 'writeas/writefreely', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop',
'wizard' => '0', 'description' => 'WriteFreely is free and open source software for building a writing space on the web.'],
'ganggo' => ['repo' => 'ganggo%2fganggo', 'gitsite' => 'git.feneas.org', 'gittype' => 'gitlab', 'devbranch' => '',
'wizard' => '0', 'description' => 'GangGo is a decentralized social network written in GoLang.'],
'funkwhale' => ['repo' => 'funkwhale%2ffunkwhale', 'gitsite' => 'code.eliotberriot.com', 'gittype' => 'gitlab', 'devbranch' => 'develop',
'wizard' => '0', 'description' => 'Funkwhale is a community-driven project that lets you listen and share music and audio within a decentralized, open network.'],
'osada' => ['repo' => 'zot%2fosada', 'gitsite' => 'framagit.org', 'gittype' => 'gitlab', 'devbranch' => 'dev',
'wizard' => '0', 'description' => 'Osada is a conversational style macroblogging network powered by hyper-drive social engine, supporting ActivityPub and Zot6 protocols.'],
'mastodon' => ['repo' => 'tootsuite/mastodon', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => '',
'wizard' => '0', 'description' => 'Mastodon is an open source decentralized social network - by the people for the people.'],
'gnusocial' => ['repo' => 'gnu%2fgnu-social', 'gitsite' => 'git.gnu.io', 'gittype' => 'gitlab', 'devbranch' => 'nightly',
'wizard' => '0', 'description' => 'GNU social, true to the Unix-philosophy of small programs to do a small job, will be a federated social network that you can install on your own server.'],
'pixelfed' => ['repo' => 'pixelfed/pixelfed', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'dev',
'wizard' => '0', 'description' => 'Pixelfed is a free and ethical photo sharing platform, powered by ActivityPub federation.'],
'wordpress' => ['repo' => 'Wordpress/Wordpress', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => '',
'wizard' => '0', 'description' => 'Wordpress is open source software which you can use to easily create a beautiful website, blog, or app.'],
'misskey' => ['repo' => 'syuilo/misskey', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop',
'wizard' => '0', 'description' => 'Misskey is a decentralized microblogging platform born on Earth.'],
'speechmore' => ['repo' => 'speechmore%2fspeechmore', 'gitsite' => 'gitlab.fancy.org.uk', 'gittype' => 'gitlab', 'devbranch' => '',
'wizard' => '0', 'description' => 'Speechmore is the social network that leaves you in control of your data and gives you the freedom to say whatever you have to.'],
'peertube' => ['repo' => 'Chocobozzz/PeerTube', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop',
'wizard' => '0', 'description' => 'PeerTube is a free and open-source, decentralized, federated video platform powered by ActivityPub and WebTorrent.'],
'plume' => ['repo' => 'Plume-org/Plume', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => '',
'wizard' => '0', 'description' => 'Plume is a federated blogging application'],
'rustodon' => ['repo' => 'rustodon/rustodon', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => '',
'wizard' => '0', 'description' => 'Rustodon is an Mastodon-compatible federated social microblogging server.'],
'microblogpub' => ['repo' => 'tsileo/microblog.pub', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => '',
'wizard' => '0', 'description' => 'Microblogpub is a self-hosted, single-user, ActivityPub powered microblog.'],
'mobilizon' => ['repo' => 'framasoft/mobilizon', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => '',
'wizard' => '0', 'description' => 'Mobilizon is a tool designed to create platforms for managing communities and events.'],
'lemmy' => ['repo' => 'fLemmyNet/lemmy', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => '',
'wizard' => '0', 'description' => 'Lemmy is an open-source, easily self-hostable link aggregator that you can use to share '],
],
//hidden software word strings from table view - %(one)% OR %(one|two|three)%
'hidden-softwares' => '%(relay|n/q)%',
];
body {
font-family: 'Helvetica', sans-serif;
font-weight: 400;
--blue: #002145;
--grey: #A5ACAF;
--green: #207A00;
--black: #0e0e0e;
--lgrey: #7a94a4;
--grey: #36454f;
--white: #f8f8ff;
}
.bg-blue {
background-color: var(--blue) !important;
a.white {
color: var(--white);
}
.blue {
color: var(--blue);
span.white {
color: var(--white);
}
.bg-green {
background-color: var(--green);
a {
color: #323270;
}
.green {
color: var(--green);
.bg-blue {
background-color: var(--black) !important;
}
.bg-grey {
background-color: var(--grey);
}
.grey {
color: var(--grey);
}
a {
color: var(--blue);
background-color: var(--lgrey) !important;
}
.main {
padding: 5px;
padding-top: 4px;
}
.placeholders {
......@@ -87,7 +80,7 @@ a {
}
.tablesorter-filter-row td {
background: #eee;
background-color: #eee;
line-height: normal;
text-align: center; /* center the input */
-webkit-transition: line-height 0.1s ease;
......@@ -162,18 +155,16 @@ a {
display: inline-block;
color: black;
float: left;
padding: 2px 8px !important;
margin: 0 4px;
padding: 4px 0px !important;
text-decoration: none;
transition: background-color .3s;
cursor: pointer;
width: 200px;
height: 30px;
}
.tablesorter-header {
background-size: 10px 15px !important;
background-color: rgba(188, 202, 255, 0.9) !important;
background-color: var(--grey) !important;
color: #fff;
}
.columnSelectorWrapper {
......@@ -220,46 +211,24 @@ a {
.loadingtable {
width: 100%;
height: 100%;
background-color: var(--blue);
background-color: #ffffff;
position: fixed;
margin: 0;
padding: 0;
z-index: 1500;
}
.signal {
border: 4px solid #ffffff;
border-radius: 50px;
height: 40px;
left: 40px;
margin: -20px 0 0 -20px;
opacity: 0;
.spin {
top: 4%;
left: 2%;
position: absolute;
top: 40px;
width: 40px;
animation: pulsate 1s ease-out;
animation-iteration-count: infinite;
}
.loadingmessage {
left: 1%;
position: absolute;
top: 19%;
color: #ffffff;
}
@keyframes pulsate {
0% {
transform: scale(.1);
opacity: 0.0;
}
50% {
opacity: 1;
}
100% {
transform: scale(1.2);
opacity: 0;
}
top: 10%;
color: #000;
}
.featherlight-close-icon {
......@@ -288,8 +257,8 @@ a {
.tooltip { pointer-events: none; }
.navbar-custom {
background-color: rgba(78,137,164,.4);
.navbar {
background-color: var(--grey);
}
.url {
......
body{font-family:helvetica,sans-serif;font-weight:400;--black: #0e0e0e;--lgrey: #7a94a4;--grey: #36454f;--white: #f8f8ff}a.white{color:var(--white)}span.white{color:var(--white)}a{color:#323270}.bg-blue{background-color:var(--black)!important}.bg-grey{background-color:var(--lgrey)!important}.main{padding-top:4px}.placeholders{margin-bottom:30px;text-align:center}.placeholders h4{margin-bottom:0}.placeholder{margin-bottom:20px}.placeholder img{border-radius:50%;display:inline-block}.tfont{font-size:16px}.smlogo{background:0 0;display:inline-block}#map{height:580px}.mycluster{width:35px;height:35px;text-align:left;font-size:17px;background:url(/node_modules/leaflet/dist/images/marker-icon-2x.png)repeat-y 100% 100%;background-size:25px 37px}.icon{color:red}.tablesorter-pager .btn-group-sm .btn{font-size:1.2em}.tablesorter-filter-row td{background-color:#eee;line-height:normal;text-align:center;-webkit-transition:line-height .1s ease;-moz-transition:line-height .1s ease;-o-transition:line-height .1s ease;transition:line-height .1s ease}.tablesorter-filter-row .disabled{opacity:.5;filter:alpha(opacity=50);cursor:not-allowed}.tablesorter-filter-row.hideme td{padding:1px;margin:0;line-height:0;cursor:pointer}.tablesorter-filter-row.hideme *{height:1px;min-height:0;border:0;padding:0;margin:0;opacity:0;filter:alpha(opacity=0)}.tablesorter-filter{width:98%;height:inherit;margin:1px;padding:1px;background-color:#fff;border:1px solid #bbb;color:#333;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:height .1s ease;-moz-transition:height .1s ease;-o-transition:height .1s ease;transition:height .1s ease}.pagination{display:inline-block;color:#000;float:left;padding:2px 8px;margin:0 4px;text-decoration:none;transition:background-color .3s;border:1px solid #ddd;cursor:pointer}.pagination.disabled{color:#f0f0f0}.pagedisplay{display:inline-block;color:#000;float:left;padding:4px 0!important;text-decoration:none;transition:background-color .3s;cursor:pointer}.tablesorter-header{background-size:10px 15px!important;background-color:var(--grey)!important;color:#fff}.columnSelectorWrapper{position:relative;display:none}.columnSelector,.hidden{display:none}#colSelect1:checked~#columnSelector{display:block}.columnSelector{width:290px;position:absolute;top:40px;padding:10px;background:#fff;border:#000 1px solid;border-radius:5px;z-index:1400;right:1px}.columnSelector label{display:inline-flex}.columnSelector label:nth-child(1){border:#000 solid 1px}.columnSelector input{margin:5px}.columnSelector .disabled{color:#ddd}.loadingtable{width:100%;height:100%;background-color:#fff;position:fixed;margin:0;padding:0;z-index:1500}.spin{top:4%;left:2%;position:absolute}.loadingmessage{left:1%;position:absolute;top:10%;color:#000}.featherlight-close-icon{font-size:30px}.featherlight-loading .featherlight-content{animation:pulsate 1s ease-out;animation-iteration-count:infinite;border:5px solid #fff;border-radius:30px;height:30px;margin:-15px 0 0 -15px;position:absolute;width:30px}.featherlight-loading .featherlight-content>*{display:none!important}.featherlight-loading .featherlight-close,.featherlight-loading .featherlight-inner{display:none}.tooltip{pointer-events:none}.navbar{background-color:var(--grey)}.url{max-width:99%;text-overflow:ellipsis;overflow:hidden;display:inline-block;white-space:nowrap}
\ No newline at end of file
ALTER TABLE monthlystats ADD softwarename text;
\ No newline at end of file
......@@ -100,6 +100,7 @@ CREATE TABLE masterversions (
CREATE TABLE monthlystats (
id serial8 UNIQUE PRIMARY KEY,
softwarename text,
total_users int,
total_posts int,
total_comments int,
......
......@@ -29,7 +29,8 @@ try {
}
try {
$monthly_totals = R::getAll("
// remove diasp.org heck in 2022
$monthly_totals_all = R::getAll("
SELECT
to_char(date_checked, 'yyyy-mm') AS yymm,
sum(total_users) as users,
......@@ -46,7 +47,7 @@ try {
debug('Error in SQL query: ' . sprintf($e->getMessage()));
}
foreach ($monthly_totals as $monthly) {
foreach ($monthly_totals_all as $monthly) {
// Format date to timestamp.
$timestamp = $monthly['yymm'] . '-01 01:01:01-01';
......@@ -62,7 +63,62 @@ foreach ($monthly_totals as $monthly) {
}
try {
$p = R::findOrCreate('monthlystats', ['date_checked' => $timestamp]);
$p = R::findOrCreate('monthlystats', ['date_checked' => $timestamp, 'softwarename' => 'all']);
$p['softwarename'] = 'all';
$p['total_users'] = round($monthly['users'] / $total);
$p['total_posts'] = round($monthly['posts'] / $total);
$p['total_comments'] = round($monthly['comments'] / $total);
$p['total_pods'] = round($monthly['pods'] / $total);
if ($monthly['downtime']) {
$p['total_uptime'] = round($monthly['downtime'] / $monthly['uptime'] * 100);
} else {
$p['total_uptime'] = 100;
}
R::store($p);
} catch (\RedBeanPHP\RedException $e) {
debug('Error in SQL query: ' . sprintf($e->getMessage()));
}
}
try {
// remove diasp.org heck in 2022
$monthly_totals_bypod = R::getAll("
SELECT
to_char(checks.date_checked, 'yyyy-mm') AS yymm,
sum(checks.total_users) as users,
sum(checks.local_posts) as posts,
sum(checks.comment_counts) as comments,
count(checks.domain) as pods,
count(DISTINCT CASE WHEN checks.domain = 'diasp.org' THEN checks.id ELSE NULL END) as oldtotal,
count(nullif(checks.online, false)) as uptime,
count(nullif(checks.online, true)) as downtime, pods.softwarename as softwarename
FROM checks
INNER JOIN pods ON pods.domain = checks.domain GROUP BY yymm,pods.softwarename;
");
} catch (\RedBeanPHP\RedException $e) {
debug('Error in SQL query: ' . sprintf($e->getMessage()));
}
foreach ($monthly_totals_bypod as $monthly) {
// Format date to timestamp.
$timestamp = $monthly['yymm'] . '-01 01:01:01-01';
$total = $monthly['oldtotal'];
foreach ($total_runs as $runs) {
if ($monthly['yymm'] === $runs['yymm']) {
$total = $runs['count'];
break;
}
}
if ($total === 0) {
$total = 1;
}
try {
$p = R::findOrCreate('monthlystats', ['date_checked' => $timestamp, 'softwarename' => $monthly['softwarename']]);
$p['softwarename'] = $monthly['softwarename'];
$p['total_users'] = round($monthly['users'] / $total);
$p['total_posts'] = round($monthly['posts'] / $total);
$p['total_comments'] = round($monthly['comments'] / $total);
......
......@@ -14,6 +14,8 @@ use Poduptime\PodStatus;
// Other parameters.
$_domain = $_GET['domain'] ?? '';
$_software = $_GET['software'] ?? '';
// CloudFlare country code pull.
$country_code = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? '';
require_once __DIR__ . '/boot.php';
......@@ -24,6 +26,22 @@ try {
$click = 'manualclick';
$domain = R::getCell('SELECT domain FROM pods WHERE domain LIKE ?', [$_domain]);
$domain || die('unknown domain');
} elseif ($country_code && $_software) {
$click = 'autoclick';
$domain = R::getCell('
SELECT domain
FROM pods
WHERE signup
AND uptime_alltime > 95
AND monthsmonitored > 1
AND softwarename = ?
AND status = ?
AND softwarename NOT SIMILAR TO ?
AND country = ?
ORDER BY random()
LIMIT 1
', [$_software, PodStatus::UP, $hiddensoftwares, $country_code]);
$domain || die('No domain is a match to your request, go back and manually find one that is a fit for you');
} elseif ($_software) {
$click = 'autoclick';
$domain = R::getCell('
......@@ -38,7 +56,22 @@ try {
ORDER BY random()
LIMIT 1
', [$_software, PodStatus::UP, $hiddensoftwares]);
$domain || die('no domains exist');
$domain || die('No domain is a match to your request, go back and manually find one that is a fit for you');
} elseif ($country_code) {
$click = 'autoclick';
$domain = R::getCell('
SELECT domain
FROM pods
WHERE signup
AND uptime_alltime > 95
AND monthsmonitored > 1
AND status = ?
AND softwarename NOT SIMILAR TO ?
AND country = ?
ORDER BY random()
LIMIT 1
', [PodStatus::UP, $hiddensoftwares, $country_code]);
$domain || die('No domain is a match to your request, go back and manually find one that is a fit for you');
} else {
$click = 'autoclick';
$domain = R::getCell('
......@@ -52,7 +85,7 @@ try {
ORDER BY random()
LIMIT 1
', [PodStatus::UP, $hiddensoftwares]);
$domain || die('no domains exist');
$domain || die('No domain is a match to your request, go back and manually find one that is a fit for you');
}
$c = R::dispense('clicks');
......
server {
#normalconfighere
#very rough add-ons to your nginx config
#code base is designed for *.domain.tld usage
location /backup {
deny all;
return 403;
......
......@@ -7,43 +7,70 @@
declare(strict_types=1);
use Carbon\Carbon;
use RedBeanPHP\R;
use Poduptime\PodStatus;
require_once __DIR__ . '/boot.php';
$input = isset($_GET['input']) ? substr($_GET['input'], 1) : null;
$mapview = isset($_GET['mapview']) || $input === 'map';
$statsview = isset($_GET['statsview']) || $input === 'stats';
$podmin = isset($_GET['podmin']) || $input === 'podmin';
$podminedit = isset($_GET['podminedit']) || $input === 'podminedit';
$edit = isset($_GET['edit']) || $input === 'edit';
$add = isset($_GET['add']) || $input === 'add';
$gettoken = isset($_GET['gettoken']) || $input === 'gettoken';
$status = isset($_GET['status']) || $input === 'status';
$simpleview = !($mapview || $podmin || $podminedit || $statsview);
$fullview = false;
$subdomain = join('.', explode('.', $_SERVER['HTTP_HOST'], -2));
$software = !empty($subdomain) ? ucwords($subdomain) : 'Open Source Social Network';
$softwarejs = !empty($subdomain) ? ucwords($subdomain) : '';
$hiddensoftwares = c('hidden-softwares');
try {
$softwares = R::getAll('
SELECT DISTINCT softwarename
FROM pods
WHERE status < ?
AND score > 0
AND softwarename NOT SIMILAR TO ?
ORDER BY softwarename
', [PodStatus::RECHECK, $hiddensoftwares]);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
}
$input = isset($_GET['input']) ? substr($_GET['input'], 1) : null;
$mapview = isset($_GET['mapview']) || $input === 'map';
$statsview = isset($_GET['statsview']) || $input === 'stats';
$podmin = isset($_GET['podmin']) || $input === 'podmin';
$podminedit = isset($_GET['podminedit']) || $input === 'podminedit';
$edit = isset($_GET['edit']) || $input === 'edit';
$add = isset($_GET['add']) || $input === 'add';
$gettoken = isset($_GET['gettoken']) || $input === 'gettoken';
$status = isset($_GET['status']) || $input === 'status';
$simpleview = !($mapview || $podmin || $podminedit || $statsview);
$fullview = false;
$subdomain = join('.', explode('.', $_SERVER['HTTP_HOST'], -2));
$software_toggle = !empty($subdomain) ? $subdomain : 'Software';
$software = !empty($subdomain) ? ucwords($subdomain) : 'Open Source Social Network';
$softwarejs = !empty($subdomain) ? ucwords($subdomain) : '';
$softwaredb = !empty($subdomain) ? $subdomain : 'all';
$software_all = !empty($subdomain) ? ucwords($subdomain) : 'All';
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?php echo $software ?> Pod Uptime Status</title>
<meta name="keywords" content="diaspora, <?php echo $input ?>, federated pods, Poduptime, fediverse, federated network, friendica, hubzilla, open source social, open source social network"/>
<meta name="description" content="<?php echo $software ?> Pod <?php echo $input ?> Live Status. Find a <?php echo $software ?> pod to sign up for, rate pods, find one close to you!"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title><?php echo $software ?> Uptime Status</title>