diff --git a/CHANGELOG.md b/CHANGELOG.md index 57d0b5277d40ade47e8c8aae40f784f25b9ff317..0877608f40c0916532c41f3d02153ff24713ca7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic ## [Unreleased] ### Added +- Added bootstrapping to simplify initialisation of config and database +- Config syntax has changed to array style (#155) +- Added `pghost` config to set database port +- Added `CONTRIBUTING.md` ### Changed - Introduce proper changelog format (#189) - Moved DB migration scripts into `db` folder diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..c9f1111bca691db6b72146869ca6fab19ebc2177 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,31 @@ +# How To Contribute + +## Workflow + +* Fork Git Repo https://git.feneas.org/diasporg/Poduptime +* Pull Git +* Create a topic branch to work from +* Commit and push your branch up +* Create a Merge Request to the develop branch + +## Guidelines + +* Note your changes in [`CHANGELOG.md`] following https://keepachangelog.com +* Create any necessary DB migration script in [`db/migrations`] and note them in the changelog. +* Update [`README.md`] with needed changes +* Update the [Wiki] with API changes +* Write your tests and validate them before you do your MR + +## Coding Style + +* PHP follows [PSR-2] +* CSS follows [CSSLint] +* JS follows [ESLint] + +[`README.md`]: https://git.feneas.org/diasporg/Poduptime/blob/master/README.md +[`CHANGELOG.md`]: https://git.feneas.org/diasporg/Poduptime/blob/master/CHANGELOG.md +[`db/migrations`]: https://git.feneas.org/diasporg/Poduptime/tree/master/db/migrations +[Wiki]: https://git.feneas.org/diasporg/Poduptime/wikis/home +[PSR-2]: https://www.php-fig.org/psr/psr-2/ +[CSSLint]: https://github.com/CSSLint/csslint +[ESLint]: https://eslint.org/docs/rules/ diff --git a/boot.php b/boot.php index 3192cefd25de09fb50fd6588a0f77304b5aa379c..50bf1c48e63cc17b7c8efdde0bb03cc64bdb9183 100644 --- a/boot.php +++ b/boot.php @@ -1,5 +1,11 @@ loadHTMLFile('https://' . $domain); + extract(_curl("https://{$domain}/")); + $outputbody = $curl_body; + ($outputbody ? $d->loadHTML($outputbody) : $d->loadHTML('')); $body = $d->getElementsByTagName('html')->item(0); if ($body) { $ld = new Language; - $detectedlanguage = strtoupper(key($ld->detect($body->nodeValue)->bestResults()->close())); + $detectedlanguage = key($ld->detect($body->nodeValue)->bestResults()->close()); } else { $score -= 1; $detectedlanguage = null; @@ -448,3 +446,24 @@ function _debug($label, $var = null, $dump = false) printf('%s: %s%s', $label, $output, $newline); } + +function _curl($url) +{ + global $cafullpath; + + $chss = curl_init(); + curl_setopt($chss, CURLOPT_URL, $url); + curl_setopt($chss, CURLOPT_CONNECTTIMEOUT, 10); + curl_setopt($chss, CURLOPT_TIMEOUT, 20); + curl_setopt($chss, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($chss, CURLOPT_CERTINFO, 1); + curl_setopt($chss, CURLOPT_CAINFO, $cafullpath); + return [ + 'curl_body' => curl_exec($chss), + 'curl_error' => curl_error($chss), + 'curl_info' => curl_getinfo($chss, CURLINFO_CERTINFO), + 'curl_conntime' => curl_getinfo($chss, CURLINFO_CONNECT_TIME), + 'curl_nstime' => curl_getinfo($chss, CURLINFO_NAMELOOKUP_TIME) + ]; + curl_close($chss); +} diff --git a/js/podup.js b/js/podup.js index b6939ff24206c7b5888430631c32c77c548c9b91..8bcd37386f4122da05c6c8dafeb17373cbc2bfe9 100644 --- a/js/podup.js +++ b/js/podup.js @@ -38,7 +38,7 @@ $(document).ready(function () { $('table').trigger('filterReset'); }); $('.columnsadvanced').on('click', function () { - $('table').trigger('refreshColumnSelector', ['columns', [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 21, 22, 28]]); + $('table').trigger('refreshColumnSelector', ['columns', [2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 21, 22, 28]]); $('#colSelect1').prop('checked', false); $('.columnSelectorWrapper').show().css('display', 'inline-block'); $('.columnssimple').show().css('display', 'inline-block'); @@ -57,7 +57,7 @@ $(document).ready(function () { if (input) { columns[0] = input; } - columns[7] = 'Y'; + columns[7] = 'Yes'; $('table').trigger('search', [columns]); $('.pagerhidden').delay(900).show(200); $('[data-toggle="tooltip"]').tooltip(); diff --git a/showfull.php b/showfull.php index d1bafe838434491f4a7c9b62f0074bcc7adf8d8e..f668da1ab1a5945e527a4e3cb598f89b849cc428 100644 --- a/showfull.php +++ b/showfull.php @@ -56,11 +56,11 @@ $country_code = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? '';