Commit acb11d16 authored by David Morley's avatar David Morley

Tablesandwizards

parent 28dd5603
# 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
## Podmins
......
......@@ -13,7 +13,9 @@
"jaybizzle/crawler-detect": "1.*",
"patrickschur/language-detection": "^3.3",
"geoip2/geoip2": "^2.9",
"maxmind-db/reader": "~1.0"
"maxmind-db/reader": "~1.0",
"matriphe/iso-639": "^1.2",
"rinvex/country": "^3.1"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.3"
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "0817bebabc4fd710e4682f1ebaff3f95",
"content-hash": "b4dea96de8556414616e04d0f09aa8fa",
"packages": [
{
"name": "commerceguys/enum",
......@@ -195,16 +195,16 @@
},
{
"name": "jaybizzle/crawler-detect",
"version": "v1.2.64",
"version": "v1.2.65",
"source": {
"type": "git",
"url": "https://github.com/JayBizzle/Crawler-Detect.git",
"reference": "f62200a42fdc5ea53c873f38c123a8e6b54ca0de"
"reference": "1ea1c897018c93e3c2ac76e008519085b24e339e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/f62200a42fdc5ea53c873f38c123a8e6b54ca0de",
"reference": "f62200a42fdc5ea53c873f38c123a8e6b54ca0de",
"url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/1ea1c897018c93e3c2ac76e008519085b24e339e",
"reference": "1ea1c897018c93e3c2ac76e008519085b24e339e",
"shasum": ""
},
"require": {
......@@ -240,7 +240,51 @@
"crawlerdetect",
"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",
......@@ -498,6 +542,80 @@
"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",
"version": "v1.8.0",
"source": {
......@@ -558,16 +676,16 @@
},
{
"name": "symfony/translation",
"version": "v4.1.1",
"version": "v4.1.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "b6d8164085ee0b6debcd1b7a131fd6f63bb04854"
"reference": "2dd74d6b2dcbd46a93971e6ce7d245cf3123e957"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/b6d8164085ee0b6debcd1b7a131fd6f63bb04854",
"reference": "b6d8164085ee0b6debcd1b7a131fd6f63bb04854",
"url": "https://api.github.com/repos/symfony/translation/zipball/2dd74d6b2dcbd46a93971e6ce7d245cf3123e957",
"reference": "2dd74d6b2dcbd46a93971e6ce7d245cf3123e957",
"shasum": ""
},
"require": {
......@@ -623,7 +741,7 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2018-06-22T08:59:39+00:00"
"time": "2018-07-23T08:20:20+00:00"
}
],
"packages-dev": [
......
.main {
padding: 20px;
padding: 5px;
}
.placeholders {
......@@ -157,41 +157,92 @@
margin: 0 4px;
text-decoration: none;
transition: background-color .3s;
border: 1px solid #ddd;
cursor: pointer;
width: 170px;
height: 30px;
}
.tablesorter-header {
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 {
visibility: hidden;
width: 100%;
height: 100%;
background: #fff;
position: fixed;
margin: 0;
padding: 0;
z-index: 1500;
}
@-webkit-keyframes featherlightLoader {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
.signal {
border: 5px solid #333;
border-radius: 30px;
height: 30px;
left: 20%;
margin: -15px 0 0 -15px;
opacity: 0;
position: absolute;
top: 20%;
width: 30px;
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
animation: pulsate 1s ease-out;
animation-iteration-count: infinite;
}
@keyframes featherlightLoader {
@keyframes pulsate {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
transform: scale(.1);
opacity: 0.0;
}
50% {
opacity: 1;
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
transform: scale(1.2);
opacity: 0;
}
}
......@@ -200,15 +251,14 @@
}
.featherlight-loading .featherlight-content {
-webkit-animation: featherlightLoader 1s infinite linear;
animation: featherlightLoader 1s infinite linear;
background: transparent;
border: 8px solid #8f8f8f;
border-left-color: #fff;
border-radius: 80px;
width: 80px;
height: 80px;
min-width: 0;
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 > * {
......@@ -219,3 +269,5 @@
.featherlight-loading .featherlight-inner {
display: none;
}
.tooltip { pointer-events: none; }
......@@ -11,14 +11,14 @@ use RedBeanPHP\R;
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../config.php';
if (PHP_SAPI === 'cli' || PHP_SAPI === 'cgi-fcgi') {
define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
}
define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
if (!($_domain = $_GET['domain'] ?? null)) {
die('no pod domain given');
......@@ -69,71 +69,79 @@ foreach ($pods as $pod) {
}
echo <<<EOF
<form method="get">
<script>
window.onload = function() {
$("#weight").ionRangeSlider();
}
</script>
<form action="/">
<input type="hidden" name="edit">
<input type="hidden" name="domain" value="{$_domain}">
<input type="hidden" name="token" value="{$uuid}">
<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>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">
</form>
EOF;
die;
$stop = 1;
}
}
$link = 'https://' . $_domain . '/nodeinfo/1.0';
if ($infos = file_get_contents('https://' . $_domain . '/.well-known/nodeinfo')) {
$info = json_decode($infos, true);
$link = max($info['links'])['href'];
}
if (!$stop) {
$chss = curl_init();
curl_setopt($chss, CURLOPT_URL, $link);
curl_setopt($chss, CURLOPT_POST, 0);
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);
if ($outputssl && stripos($outputssl, 'openRegistrations') !== false) {
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());
$link = 'https://' . $_domain . '/nodeinfo/1.0';
if ($infos = file_get_contents('https://' . $_domain . '/.well-known/nodeinfo')) {
$info = json_decode($infos, true);
$link = max($info['links'])['href'];
}
if ($_email) {
$to = $adminemail;
$subject = 'New pod added to ' . $_SERVER['HTTP_HOST'];
$headers = ['From: ' . $_email, 'Reply-To: ' . $_email, 'Cc: ' . $_email];
$chss = curl_init();
curl_setopt($chss, CURLOPT_URL, $link);
curl_setopt($chss, CURLOPT_POST, 0);
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 = [
'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!',
];
if ($outputssl && stripos($outputssl, 'openRegistrations') !== false) {
echo 'Your pod has ssl and is valid<br>';
@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 {
echo 'Could not validate your pod, check your setup!<br>Take a look at <a href="' . $link . '">your /nodeinfo</a>';
}
R::store($p);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
}
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
"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
BM,32.3333,-64.7500
BN,4.5000,114.6667
BO,-17.0000,-65.0000
BR,-10.0000,-55.0000
BS,24.2500,-76.0000
BT,27.5000,90.5000
BV,-54.4333,3.4000
BW,-22.0000,24.0000
BY,53.0000,28.0000
BZ,17.2500,-88.7500
CA,60.0000,-95.0000
CC,-12.5000,96.8333
CD,0.0000,25.0000
CF,7.0000,21.0000
CG,-1.0000,15.0000
CH,47.0000,8.0000
CI,8.0000,-5.0000
CK,-21.2333,-159.7667
CL,-30.0000,-71.0000
CM,6.0000,12.0000
CN,35.0000,105.0000
CO,4.0000,-72.0000
CR,10.0000,-84.0000
CU,21.5000,-80.0000
CV,16.0000,-24.0000
CX,-10.5000,105.6667
CY,35.0000,33.0000
CZ,49.7500,15.5000
DE,51.0000,9.0000
DJ,11.5000,43.0000
DK,56.0000,10.0000
DM,15.4167,-61.3333
DO,19.0000,-70.6667
DZ,28.0000,3.0000
EC,-2.0000,-77.5000
EE,59.0000,26.0000
EG,27.0000,30.0000
EH,24.5000,-13.0000
ER,15.0000,39.0000
ES,40.0000,-4.0000
ET,8.0000,38.0000
EU,47.0000,8.0000
FI,64.0000,26.0000
FJ,-18.0000,175.0000
FK,-51.7500,-59.0000
FM,6.9167,158.2500
FO,62.0000,-7.0000
FR,46.0000,2.0000
GA,-1.0000,11.7500
GB,54.0000,-2.0000
GD,12.1167,-61.6667
GE,42.0000,43.5000
GF,4.0000,-53.0000
GH,8.0000,-2.0000
GI,36.1833,-5.3667
GL,72.0000,-40.0000
GM,13.4667,-16.5667
GN,11.0000,-10.0000
GP,16.2500,-61.5833
GQ,2.0000,10.0000
GR,39.0000,22.0000
GS,-54.5000,-37.0000
GT,15.5000,-90.2500
GU,13.4667,144.7833
GW,12.0000,-15.0000
GY,5.0000,-59.0000
HK,22.2500,114.1667
HM,-53.1000,72.5167
HN,15.0000,-86.5000
HR,45.1667,15.5000
HT,19.0000,-72.4167
HU,47.0000,20.0000
ID,-5.0000,120.0000
IE,53.0000,-8.0000
IL,31.5000,34.7500
IN,20.0000,77.0000
IO,-6.0000,71.5000
IQ,33.0000,44.0000
IR,32.0000,53.0000
IS,65.0000,-18.0000
IT,42.8333,12.8333
JM,18.2500,-77.5000
JO,31.0000,36.0000
JP,36.0000,138.0000
KE,1.0000,38.0000
KG,41.0000,75.0000
KH,13.0000,105.0000
KI,1.4167,173.0000
KM,-12.1667,44.2500
KN,17.3333,-62.7500
KP,40.0000,127.0000
KR,37.0000,127.5000
KW,29.3375,47.6581
KY,19.5000,-80.5000
KZ,48.0000,68.0000
LA,18.0000,105.0000
LB,33.8333,35.8333
LC,13.8833,-61.1333
LI,47.1667,9.5333
LK,7.0000,81.0000
LR,6.5000,-9.5000
LS,-29.5000,28.5000
LT,56.0000,24.0000
LU,49.7500,6.1667
LV,57.0000,25.0000
LY,25.0000,17.0000
MA,32.0000,-5.0000
MC,43.7333,7.4000
MD,47.0000,29.0000
ME,42.0000,19.0000
MG,-20.0000,47.0000
MH,9.0000,168.0000
MK,41.8333,22.0000
ML,17.0000,-4.0000
MM,22.0000,98.0000
MN,46.0000,105.0000
MO,22.1667,113.5500
MP,15.2000,145.7500
MQ,14.6667,-61.0000
MR,20.0000,-12.0000
MS,16.7500,-62.2000
MT,35.8333,14.5833
MU,-20.2833,57.5500
MV,3.2500,73.0000
MW,-13.5000,34.0000
MX,23.0000,-102.0000
MY,2.5000,112.5000
MZ,-18.2500,35.0000
NA,-22.0000,17.0000
NC,-21.5000,165.5000
NE,16.0000,8.0000
NF,-29.0333,167.9500
NG,10.0000,8.0000
NI,13.0000,-85.0000
NL,52.5000,5.7500
NO,62.0000,10.0000
NP,28.0000,84.0000
NR,-0.5333,166.9167
NU,-19.0333,-169.8667
NZ,-41.0000,174.0000
OM,21.0000,57.0000
PA,9.0000,-80.0000
PE,-10.0000,-76.0000
PF,-15.0000,-140.0000
PG,-6.0000,147.0000
PH,13.0000,122.0000
PK,30.0000,70.0000
PL,52.0000,20.0000
PM,46.8333,-56.3333
PR,18.2500,-66.5000
PS,32.0000,35.2500
PT,39.5000,-8.0000
PW,7.5000,134.5000
PY,-23.0000,-58.0000
QA,25.5000,51.2500
RE,-21.1000,55.6000
RO,46.0000,25.0000
RS,44.0000,21.0000
RU,60.0000,100.0000
RW,-2.0000,30.0000
SA,25.0000,45.0000
SB,-8.0000,159.0000
SC,-4.5833,55.6667
SD,15.0000,30.0000
SE,62.0000,15.0000
SG,1.3667,103.8000
SH,-15.9333,-5.7000
SI,46.0000,15.0000
SJ,78.0000,20.0000
SK,48.6667,19.5000
SL,8.5000,-11.5000
SM,43.7667,12.4167
SN,14.0000,-14.0000
SO,10.0000,49.0000
SR,4.0000,-56.0000
ST,1.0000,7.0000
SV,13.8333,-88.9167
SY,35.0000,38.0000
SZ,-26.5000,31.5000
TC,21.7500,-71.5833
TD,15.0000,19.0000
TF,-43.0000,67.0000
TG,8.0000,1.1667
TH,15.0000,100.0000
TJ,39.0000,71.0000
TK,-9.0000,-172.0000
TM,40.0000,60.0000
TN,34.0000,9.0000
TO,-20.0000,-175.0000
TR,39.0000,35.0000
TT,11.0000,-61.0000
TV,-8.0000,178.0000
TW,23.5000,121.0000
TZ,-6.0000,35.0000
UA,49.0000,32.0000
UG,1.0000,32.0000
UM,19.2833,166.6000
US,38.0000,-97.0000
UY,-33.0000,-56.0000
UZ,41.0000,64.0000
VA,41.9000,12.4500
VC,13.2500,-61.2000
VE,8.0000,-66.0000
VG,18.5000,-64.5000
VI,18.3333,-64.8333
VN,16.0000,106.0000
VU,-16.0000,167.0000
WF,-13.3000,-176.2000
WS,-13.5833,-172.3333
YE,15.0000,48.0000
YT,-12.8333,45.1667
ZA,-29.0000,24.0000
ZM,-15.0000,30.0000
ZW,-20.0000,30.0000
......@@ -25,6 +25,11 @@ $_podmin_notify = $_GET['podmin_notify'] ?? 0;
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../config.php';
// Set up global DB connection.