- Splitted cronard definitions
- Added TMP_PATH env var - Added support for Events from attributes - Added Negundo client support
This commit is contained in:
1 parent
946281c884
commit
f482c19df5
23 files changed
+163
-82
No files matched your search
@@ -20,6 +20,8 @@ class Application
|
||||
|
||||
public array $entities;
|
||||
|
||||
public array $events;
|
||||
|
||||
public array $tellJson;
|
||||
|
||||
public array $tellPhp;
|
||||
@@ -71,6 +73,9 @@ class Application
|
||||
if (is_array($data['cronard'] ?? false)) {
|
||||
$this->cronard = $data['cronard'];
|
||||
}
|
||||
if (is_array($data['events'] ?? false)) {
|
||||
$this->events = $data['events'];
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Lean;
|
||||
|
||||
use Lean\Response\{ PdfResponse, ImageResponse, DownloadResponse };
|
||||
use Lean\Response\{FileDownloadResponse, PdfResponse, ImageResponse, DownloadResponse};
|
||||
|
||||
use Picea,
|
||||
Picea\Ui\Method\FormContext;
|
||||
@@ -112,6 +112,11 @@ trait ControllerTrait {
|
||||
return new ImageResponse($data, $code, $headers);
|
||||
}
|
||||
|
||||
public static function renderAsset(string $path, int $code = 200, array $headers = []) : ResponseInterface
|
||||
{
|
||||
return new FileDownloadResponse($path, $code, $headers);
|
||||
}
|
||||
|
||||
public function fromResponse(ResponseInterface $response)
|
||||
{
|
||||
if ( $response->getStatusCode() === 200 ) {
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ class Kernel {
|
||||
Dotenv::create(getenv("PROJECT_PATH"))->load();
|
||||
|
||||
// Override using headers
|
||||
if ( ( $keys = getenv('KEYS') ) && ( $auth = $_SERVER["HTTP_X_DEV_AUTH"] ) && in_array($auth, explode(',', $keys)) ) {
|
||||
if ( ( $keys = getenv('KEYS') ) && ( $auth = $_SERVER["HTTP_X_DEV_AUTH"] ?? null ) && in_array($auth, explode(',', $keys)) ) {
|
||||
foreach (['APP_ENV', 'DEBUG',] as $env) {
|
||||
if (null !== $value = $_SERVER["HTTP_X_$env"] ?? null) {
|
||||
static::putenv($env, $value);
|
||||
|
||||
@@ -83,6 +83,11 @@ class Lean
|
||||
return array_merge(...array_map(fn($app) => $app->cronard ?? [], $this->applications));
|
||||
}
|
||||
|
||||
public function getEvents() : array
|
||||
{
|
||||
return array_merge(...array_map(fn($app) => $app->events ?? [], $this->applications));
|
||||
}
|
||||
|
||||
public function getEntities() : array
|
||||
{
|
||||
return array_merge(...array_map(fn($app) => $app->entities ?? [], $this->applications));
|
||||
@@ -123,7 +128,9 @@ class Lean
|
||||
$path = dirname(__DIR__) . "/meta/definitions/";
|
||||
|
||||
return array_merge(
|
||||
require($path . "cronard.php"),
|
||||
require($path . "email.php"),
|
||||
require($path . "event.php"),
|
||||
require($path . "http.php"),
|
||||
require($path . "language.php"),
|
||||
require($path . "routes.php"),
|
||||
|
||||
@@ -36,11 +36,20 @@ class FileDownloadResponse extends Response
|
||||
public function __construct($filepath, int $status = 200, array $headers = [])
|
||||
{
|
||||
$body = $this->createBody($filepath);
|
||||
|
||||
|
||||
if (class_exists(\Mimey\MimeTypes::class)) {
|
||||
$mime = (new \Mimey\MimeTypes())->getMimeType(pathinfo($filepath, PATHINFO_EXTENSION));
|
||||
}
|
||||
else {
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mime = finfo_file($finfo, $filepath);
|
||||
finfo_close($finfo);
|
||||
}
|
||||
|
||||
parent::__construct(
|
||||
$body,
|
||||
$status,
|
||||
$this->injectContentType( (new \Mimey\MimeTypes())->getMimeType( pathinfo($filepath, PATHINFO_EXTENSION) ), $headers)
|
||||
$this->injectContentType($mime, $headers)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user