mirror of
https://github.com/ConnectedHumber/Air-Quality-Web
synced 2024-11-25 06:53:00 +00:00
[server] Add changelog action
This commit is contained in:
parent
449821a7a5
commit
dc7427c18b
3 changed files with 133 additions and 2 deletions
|
@ -5,7 +5,8 @@
|
||||||
"require": {
|
"require": {
|
||||||
"yosymfony/toml": "^1.0",
|
"yosymfony/toml": "^1.0",
|
||||||
"aura/autoload": "^2.0",
|
"aura/autoload": "^2.0",
|
||||||
"php-di/php-di": "^6.0"
|
"php-di/php-di": "^6.0",
|
||||||
|
"erusev/parsedown-extra": "^0.7.1"
|
||||||
},
|
},
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
|
92
composer.lock
generated
92
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "e2c066b5e1e6ab212ea3d3033225ed87",
|
"content-hash": "d42581b26b6c99bcc70da335a64f686b",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "aura/autoload",
|
"name": "aura/autoload",
|
||||||
|
@ -55,6 +55,96 @@
|
||||||
],
|
],
|
||||||
"time": "2016-10-03T19:36:19+00:00"
|
"time": "2016-10-03T19:36:19+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "erusev/parsedown",
|
||||||
|
"version": "1.7.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/erusev/parsedown.git",
|
||||||
|
"reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/erusev/parsedown/zipball/92e9c27ba0e74b8b028b111d1b6f956a15c01fc1",
|
||||||
|
"reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"php": ">=5.3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^4.8.35"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Parsedown": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Emanuil Rusev",
|
||||||
|
"email": "hello@erusev.com",
|
||||||
|
"homepage": "http://erusev.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Parser for Markdown.",
|
||||||
|
"homepage": "http://parsedown.org",
|
||||||
|
"keywords": [
|
||||||
|
"markdown",
|
||||||
|
"parser"
|
||||||
|
],
|
||||||
|
"time": "2018-03-08T01:11:30+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "erusev/parsedown-extra",
|
||||||
|
"version": "0.7.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/erusev/parsedown-extra.git",
|
||||||
|
"reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/0db5cce7354e4b76f155d092ab5eb3981c21258c",
|
||||||
|
"reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"erusev/parsedown": "~1.4"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"ParsedownExtra": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Emanuil Rusev",
|
||||||
|
"email": "hello@erusev.com",
|
||||||
|
"homepage": "http://erusev.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "An extension of Parsedown that adds support for Markdown Extra.",
|
||||||
|
"homepage": "https://github.com/erusev/parsedown-extra",
|
||||||
|
"keywords": [
|
||||||
|
"markdown",
|
||||||
|
"markdown extra",
|
||||||
|
"parsedown",
|
||||||
|
"parser"
|
||||||
|
],
|
||||||
|
"time": "2015-11-01T10:19:22+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "jeremeamia/SuperClosure",
|
"name": "jeremeamia/SuperClosure",
|
||||||
"version": "2.4.0",
|
"version": "2.4.0",
|
||||||
|
|
40
logic/Actions/Changelog.php
Normal file
40
logic/Actions/Changelog.php
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace AirQuality\Actions;
|
||||||
|
|
||||||
|
use \SBRL\TomlConfig;
|
||||||
|
|
||||||
|
use \AirQuality\PerfFormatter;
|
||||||
|
|
||||||
|
class Changelog implements IAction {
|
||||||
|
/** @var TomlConfig */
|
||||||
|
private $settings;
|
||||||
|
|
||||||
|
/** @var \ParsedownExtra */
|
||||||
|
private $parsedown_ext;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
TomlConfig $in_settings,
|
||||||
|
\ParsedownExtra $in_parsedown_ext) {
|
||||||
|
$this->settings = $in_settings;
|
||||||
|
$this->parsedown_ext = $in_parsedown_ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle() : bool {
|
||||||
|
global $start_time;
|
||||||
|
|
||||||
|
$start_handle = microtime(true);
|
||||||
|
|
||||||
|
|
||||||
|
// 1: Parse markdown
|
||||||
|
$result = $this->parsedown_ext->text(file_get_contents(ROOT_DIR."Changelog.md"));
|
||||||
|
|
||||||
|
|
||||||
|
// 2: Send response
|
||||||
|
header("content-length: " . strlen($result));
|
||||||
|
header("content-type: text/html");
|
||||||
|
header("x-time-taken: " . PerfFormatter::format_perf_data($start_time, $start_handle, null));
|
||||||
|
echo($result);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue