Commit 177af211 authored by dmorley's avatar dmorley

3.2.1

parent 5b7f7ff5
# 2.3.x
## End Users
* Now one table with a basic default view you can customize https://git.feneas.org/diasporg/Poduptime/issues/171
* Wizard to help you filter the columns to what you need https://git.feneas.org/diasporg/Poduptime/issues/145
## Podmins
* Can link directly to your pod via https://podupti.me/domain.name for stats and to allow users to rate easier
# 2.3.0 # 2.3.0
## Podmins ## Podmins
......
...@@ -63,11 +63,10 @@ composer install ...@@ -63,11 +63,10 @@ composer install
psql -U podupuser podupdb < db/migrationXXX.sql (see db/version.md for proper migration versions) psql -U podupuser podupdb < db/migrationXXX.sql (see db/version.md for proper migration versions)
``` ```
# To Contribute # Status
Something here or a link to the wiki on how to.... [![Codacy Badge](https://api.codacy.com/project/badge/Grade/e4fdde7b4ec34c56a86938d3ba6e3983)](https://www.codacy.com/app/diasporg/Poduptime?utm_source=git.feneas.org&amp;utm_medium=referral&amp;utm_content=diasporg/Poduptime&amp;utm_campaign=Badge_Grade)
[![Build status](https://badge.buildkite.com/2a2d6f9ff932fc359416fff31ee72c3dce703569a801f83af6.svg)](https://buildkite.com/diasporg/poduptime)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/0515afa78df64b6385088246ee84acde)](https://www.codacy.com/app/diasporg/Poduptime?utm_source=git.feneas.org&amp;utm_medium=referral&amp;utm_content=diasporg/Poduptime&amp;utm_campaign=Badge_Grade)
============================ ============================
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "0817bebabc4fd710e4682f1ebaff3f95", "content-hash": "b4dea96de8556414616e04d0f09aa8fa",
"packages": [ "packages": [
{ {
"name": "commerceguys/enum", "name": "commerceguys/enum",
...@@ -195,16 +195,16 @@ ...@@ -195,16 +195,16 @@
}, },
{ {
"name": "jaybizzle/crawler-detect", "name": "jaybizzle/crawler-detect",
"version": "v1.2.64", "version": "v1.2.65",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/JayBizzle/Crawler-Detect.git", "url": "https://github.com/JayBizzle/Crawler-Detect.git",
"reference": "f62200a42fdc5ea53c873f38c123a8e6b54ca0de" "reference": "1ea1c897018c93e3c2ac76e008519085b24e339e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/f62200a42fdc5ea53c873f38c123a8e6b54ca0de", "url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/1ea1c897018c93e3c2ac76e008519085b24e339e",
"reference": "f62200a42fdc5ea53c873f38c123a8e6b54ca0de", "reference": "1ea1c897018c93e3c2ac76e008519085b24e339e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -240,7 +240,51 @@ ...@@ -240,7 +240,51 @@
"crawlerdetect", "crawlerdetect",
"php crawler detect" "php crawler detect"
], ],
"time": "2018-06-22T20:32:56+00:00" "time": "2018-07-24T17:53:06+00:00"
},
{
"name": "matriphe/iso-639",
"version": "1.2",
"source": {
"type": "git",
"url": "https://github.com/matriphe/php-iso-639.git",
"reference": "0245d844daeefdd22a54b47103ffdb0e03c323e1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/matriphe/php-iso-639/zipball/0245d844daeefdd22a54b47103ffdb0e03c323e1",
"reference": "0245d844daeefdd22a54b47103ffdb0e03c323e1",
"shasum": ""
},
"require-dev": {
"phpunit/phpunit": "^4.7"
},
"type": "library",
"autoload": {
"psr-4": {
"Matriphe\\ISO639\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Muhammad Zamroni",
"email": "halo@matriphe.com"
}
],
"description": "PHP library to convert ISO-639-1 code to language name.",
"keywords": [
"639",
"iso",
"iso-639",
"lang",
"language",
"laravel"
],
"time": "2017-07-19T15:11:19+00:00"
}, },
{ {
"name": "maxmind-db/reader", "name": "maxmind-db/reader",
...@@ -497,6 +541,80 @@ ...@@ -497,6 +541,80 @@
], ],
"time": "2018-02-01T17:12:47+00:00" "time": "2018-02-01T17:12:47+00:00"
}, },
{
"name": "rinvex/country",
"version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/rinvex/country.git",
"reference": "e32228ef43f26d3b02296be9454f842c52d492f3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rinvex/country/zipball/e32228ef43f26d3b02296be9454f842c52d492f3",
"reference": "e32228ef43f26d3b02296be9454f842c52d492f3",
"shasum": ""
},
"require": {
"php": "^7.0.0"
},
"require-dev": {
"phpunit/phpunit": "^5.4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Rinvex\\Country\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Rinvex LLC",
"email": "help@rinvex.com",
"homepage": "https://rinvex.com"
},
{
"name": "Abdelrahman Omran",
"email": "me@omranic.com",
"homepage": "https://omranic.com",
"role": "Project Lead"
},
{
"name": "The Generous Laravel Community",
"homepage": "https://github.com/rinvex/country/contributors"
}
],
"description": "Rinvex Country is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, flags, emoji, and other attributes for all 250 countries worldwide at your fingertips.",
"homepage": "https://rinvex.com",
"keywords": [
"Flexible",
"Simple",
"countries",
"country",
"currencies",
"demonym",
"dialling",
"emoji",
"flags",
"geographic",
"languages",
"rinvex",
"svg"
],
"time": "2017-03-07T18:40:20+00:00"
},
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.8.0", "version": "v1.8.0",
...@@ -558,16 +676,16 @@ ...@@ -558,16 +676,16 @@
}, },
{ {
"name": "symfony/translation", "name": "symfony/translation",
"version": "v4.1.1", "version": "v4.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/translation.git", "url": "https://github.com/symfony/translation.git",
"reference": "b6d8164085ee0b6debcd1b7a131fd6f63bb04854" "reference": "2dd74d6b2dcbd46a93971e6ce7d245cf3123e957"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/b6d8164085ee0b6debcd1b7a131fd6f63bb04854", "url": "https://api.github.com/repos/symfony/translation/zipball/2dd74d6b2dcbd46a93971e6ce7d245cf3123e957",
"reference": "b6d8164085ee0b6debcd1b7a131fd6f63bb04854", "reference": "2dd74d6b2dcbd46a93971e6ce7d245cf3123e957",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -623,7 +741,7 @@ ...@@ -623,7 +741,7 @@
], ],
"description": "Symfony Translation Component", "description": "Symfony Translation Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-06-22T08:59:39+00:00" "time": "2018-07-23T08:20:20+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
......
.main { .main {
padding: 20px; padding: 5px;
} }
.placeholders { .placeholders {
...@@ -157,41 +157,92 @@ ...@@ -157,41 +157,92 @@
margin: 0 4px; margin: 0 4px;
text-decoration: none; text-decoration: none;
transition: background-color .3s; transition: background-color .3s;
border: 1px solid #ddd;
cursor: pointer; cursor: pointer;
width: 170px;
height: 30px;
} }
.tablesorter-header { .tablesorter-header {
background-size: 10px 15px !important; background-size: 10px 15px !important;
} }
.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 { .loadingtable {
visibility: hidden;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: #fff;
position: fixed;
margin: 0;
padding: 0;
z-index: 1500;
} }
@-webkit-keyframes featherlightLoader { .signal {
0% { border: 5px solid #333;
-webkit-transform: rotate(0deg); border-radius: 30px;
transform: rotate(0deg); height: 30px;
} left: 20%;
margin: -15px 0 0 -15px;
opacity: 0;
position: absolute;
top: 20%;
width: 30px;
100% { animation: pulsate 1s ease-out;
-webkit-transform: rotate(360deg); animation-iteration-count: infinite;
transform: rotate(360deg);
}
} }
@keyframes featherlightLoader { @keyframes pulsate {
0% { 0% {
-webkit-transform: rotate(0deg); transform: scale(.1);
transform: rotate(0deg); opacity: 0.0;
}
50% {
opacity: 1;
} }
100% { 100% {
-webkit-transform: rotate(360deg); transform: scale(1.2);
transform: rotate(360deg); opacity: 0;
} }
} }
...@@ -200,15 +251,14 @@ ...@@ -200,15 +251,14 @@
} }
.featherlight-loading .featherlight-content { .featherlight-loading .featherlight-content {
-webkit-animation: featherlightLoader 1s infinite linear; animation: pulsate 1s ease-out;
animation: featherlightLoader 1s infinite linear; animation-iteration-count: infinite;
background: transparent; border: 5px solid #fff;
border: 8px solid #8f8f8f; border-radius: 30px;
border-left-color: #fff; height: 30px;
border-radius: 80px; margin: -15px 0 0 -15px;
width: 80px; position: absolute;
height: 80px; width: 30px;
min-width: 0;
} }
.featherlight-loading .featherlight-content > * { .featherlight-loading .featherlight-content > * {
...@@ -219,3 +269,5 @@ ...@@ -219,3 +269,5 @@
.featherlight-loading .featherlight-inner { .featherlight-loading .featherlight-inner {
display: none; display: none;
} }
.tooltip { pointer-events: none; }
...@@ -6,25 +6,21 @@ ...@@ -6,25 +6,21 @@
declare(strict_types=1); declare(strict_types=1);
use Poduptime\Logging;
use RedBeanPHP\R; use RedBeanPHP\R;
require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../config.php'; require_once __DIR__ . '/../config.php';
if (PHP_SAPI === 'cli' || PHP_SAPI === 'cgi-fcgi') {
define('PODUPTIME', microtime(true));
// Set up global DB connection. define('PODUPTIME', microtime(true));
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection'); // Set up global DB connection.
R::usePartialBeans(true); R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
} R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
$log = new Logging();
$log->lfile($log_dir . '/add.log');
if (!($_domain = $_GET['domain'] ?? null)) { if (!($_domain = $_GET['domain'] ?? null)) {
$log->lwrite('no domain given');
die('no pod domain given'); die('no pod domain given');
} }
...@@ -50,13 +46,11 @@ try { ...@@ -50,13 +46,11 @@ try {
foreach ($pods as $pod) { foreach ($pods as $pod) {
if ($pod['domain'] === $_domain) { if ($pod['domain'] === $_domain) {
if ($pod['email']) { if ($pod['email']) {
$log->lwrite('domain already exists and is registered to an owner' . $_domain);
die('domain already exists and is registered to an owner, use the edit function to modify'); die('domain already exists and is registered to an owner, use the edit function to modify');
} }
$digtxt = exec(escapeshellcmd('dig ' . $_domain . ' TXT +short')); $digtxt = exec(escapeshellcmd('dig ' . $_domain . ' TXT +short'));
if (strpos($digtxt, $pod['publickey']) === false) { if (strpos($digtxt, $pod['publickey']) === false) {
$log->lwrite('domain already exists and can be registered' . $_domain);
die('domain already exists, you can claim the domain by adding a DNS TXT record that states<br><b> ' . $_domain . ' IN TXT "' . $pod['publickey'] . '"</b>'); die('domain already exists, you can claim the domain by adding a DNS TXT record that states<br><b> ' . $_domain . ' IN TXT "' . $pod['publickey'] . '"</b>');
} }
...@@ -75,74 +69,79 @@ foreach ($pods as $pod) { ...@@ -75,74 +69,79 @@ foreach ($pods as $pod) {
} }
echo <<<EOF echo <<<EOF
<form method="get"> <script>
window.onload = function() {
$("#weight").ionRangeSlider();
}
</script>
<form action="/">
<input type="hidden" name="edit"> <input type="hidden" name="edit">
<input type="hidden" name="domain" value="{$_domain}"> <input type="hidden" name="domain" value="{$_domain}">
<input type="hidden" name="token" value="{$uuid}"> <input type="hidden" name="token" value="{$uuid}">
<label>Email <input type="text" size="20" name="email"></label><br> <label>Email <input type="text" size="20" name="email"></label><br>
<label>Podmin Statement (You can include links to your terms and policies and information about your pod you wish to share with users.) <br><textarea cols="100" rows="7" name="podmin_statement"></textarea></label><br> <label>Podmin Statement (You can include links to your terms and policies and information about your pod you wish to share with users.) <br><textarea cols="100" rows="7" name="podmin_statement"></textarea></label><br>
<label>Weight <input type="text" size="2" name="weight"> This lets you weight your pod lower on the list if you have too much traffic coming in, 10 is the norm use lower to move down the list.</label><br> <label>Weight <input type="text" data-min="0" data-step="1" data-max="10" name="weight" id="weight"> This lets you weight your pod lower on the list if you have too much traffic coming in, 10 is the norm use lower to move down the list.</label><br>
<input type="submit" name="action" value="save"> <input type="submit" name="action" value="save">
</form> </form>
EOF; EOF;
die; $stop = 1;
} }
} }
$link = 'https://' . $_domain . '/nodeinfo/1.0'; if (!$stop) {
if ($infos = file_get_contents('https://' . $_domain . '/.well-known/nodeinfo')) {
$info = json_decode($infos, true);
$link = max($info['links'])['href'];
}
$chss = curl_init(); $link = 'https://' . $_domain . '/nodeinfo/1.0';
curl_setopt($chss, CURLOPT_URL, $link); if ($infos = file_get_contents('https://' . $_domain . '/.well-known/nodeinfo')) {
curl_setopt($chss, CURLOPT_POST, 0); $info = json_decode($infos, true);
curl_setopt($chss, CURLOPT_HEADER, 0); $link = max($info['links'])['href'];
curl_setopt($chss, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($chss, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($chss, CURLOPT_NOBODY, 0);
$outputssl = curl_exec($chss);
curl_close($chss);
if ($outputssl && stripos($outputssl, 'openRegistrations') !== false) {
$log->lwrite('Your pod has ssl and is valid ' . $_domain);
echo 'Your pod has ssl and is valid<br>';
$publickey = md5(uniqid($_domain, true));
try {
$p = R::dispense('pods');
$p['domain'] = $_domain;
$p['email'] = $_email;
$p['podmin_statement'] = $_podmin_statement;
$p['podmin_notify'] = $_podmin_notify;
$p['publickey'] = $publickey;
R::store($p);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
} }
if ($_email) { $chss = curl_init();
$to = $adminemail; curl_setopt($chss, CURLOPT_URL, $link);
$subject = 'New pod added to ' . $_SERVER['HTTP_HOST']; curl_setopt($chss, CURLOPT_POST, 0);
$headers = ['From: ' . $_email, 'Reply-To: ' . $_email, 'Cc: ' . $_email]; curl_setopt($chss, CURLOPT_HEADER, 0);
curl_setopt($chss, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($chss, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($chss, CURLOPT_NOBODY, 0);
$outputssl = curl_exec($chss);
curl_close($chss);
$message_lines = [ if ($outputssl && stripos($outputssl, 'openRegistrations') !== false) {
'https://' . $_SERVER['HTTP_HOST'], echo 'Your pod has ssl and is valid<br>';
'Your pod ' . $_domain . ' will not show up right away, as it needs to pass a few checks first.',
'Give it a few hours!',
];
@mail($to, $subject, implode("\r\n", $message_lines), implode("\r\n", $headers)); $publickey = md5(uniqid($_domain, true));
}
echo 'Data successfully inserted! Your pod will be checked and live on the list in a few hours!'; try {
$p = R::dispense('pods');
$p['domain'] = $_domain;
$p['email'] = $_email;
$p['podmin_statement'] = $_podmin_statement;
$p['podmin_notify'] = $_podmin_notify;
$p['publickey'] = $publickey;
} else { R::store($p);
$log->lwrite('Could not validate your pod, check your setup! ' . $_domain); } catch (\RedBeanPHP\RedException $e) {
echo 'Could not validate your pod, check your setup!<br>Take a look at <a href="' . $link . '">your /nodeinfo</a>'; die('Error in SQL query: ' . $e->getMessage());
} }
$log->lclose();
if ($_email) {
$to = $adminemail;
$subject = 'New pod added to ' . $_SERVER['HTTP_HOST'];
$headers = ['From: ' . $_email, 'Reply-To: ' . $_email, 'Cc: ' . $_email];
$message_lines = [
'https://' . $_SERVER['HTTP_HOST'],
'Your pod ' . $_domain . ' will not show up right away, as it needs to pass a few checks first.',
'Give it a few hours!',
];
@mail($to, $subject, implode("\r\n", $message_lines), implode("\r\n", $headers));
}
echo 'Data successfully inserted! Your pod will be checked and live on the list in a few hours!';
} else {
echo 'Could not validate your pod, check your setup!<br>Take a look at <a href="' . $link . '">your /nodeinfo</a>';
}
}
\ No newline at end of file
...@@ -16,7 +16,7 @@ require_once __DIR__ . '/../config.php'; ...@@ -16,7 +16,7 @@ require_once __DIR__ . '/../config.php';
$keep = (60 * 60 * 6) * 1; $keep = (60 * 60 * 6) * 1;
$dump_date = date('Ymd_Hs'); $dump_date = date('Ymd_Hs');
$file_name = $backup_dir . '/dump_' . $dump_date . '.sql'; $file_name = $backup_dir . '/dump_' . $dump_date . '.sql';
system("export PGPASSWORD=$pgpass && $pg_dump_dir/pg_dump --username=$pguser $pgdb >> $file_name"); system("export PGPASSWORD=$pgpass && $pg_dump_dir/pg_dump --clean --format=tar --username=$pguser $pgdb >> $file_name");
echo "pg backup of $pgdb made"; echo "pg backup of $pgdb made";
$dirh = dir($backup_dir); $dirh = dir($backup_dir);
while ($entry = $dirh->read()) { while ($entry = $dirh->read()) {
......
"iso 3166 country","latitude","longitude"
AD,42.5000,1.5000
AE,24.0000,54.0000
AF,33.0000,65.0000
AG,17.0500,-61.8000
AI,18.2500,-63.1667
AL,41.0000,20.0000
AM,40.0000,45.0000
AN,12.2500,-68.7500
AO,-12.5000,18.5000
AP,35.0000,105.0000
AQ,-90.0000,0.0000
AR,-34.0000,-64.0000
AS,-14.3333,-170.0000
AT,47.3333,13.3333
AU,-27.0000,133.0000
AW,12.5000,-69.9667
AZ,40.5000,47.5000
BA,44.0000,18.0000
BB,13.1667,-59.5333
BD,24.0000,90.0000
BE,50.8333,4.0000
BF,13.0000,-2.0000
BG,43.0000,25.0000
BH,26.0000,50.5500
BI,-3.5000,30.0000
BJ,9.5000,2.2500