This commit is contained in:
mcndave committed 2023-03-30 18:26:21 +00:00
commit 40f9c246b2
24 files changed
+166 -85

No files matched your search

+1
View File
@@ -13,6 +13,7 @@ META_DIR = "meta"
LOGS_DIR = "var/logs"
PUBLIC_DIR = "public"
PRIVATE_DIR = "private"
TMP_DIR = "var/tmp"
VIEW_DIR = "view"
I18N_DIR = "i18n"
@@ -26,6 +26,14 @@ return array_merge(
'routes' => [
'%ESCAPED_NAMESPACE%\\Controller' => getenv("PROJECT_PATH") . '/src/Controller/',
],
'events' => [
'%ESCAPED_NAMESPACE%\\Controller' => implode(DIRECTORY_SEPARATOR, [ getenv("PROJECT_PATH"), 'src', 'Controller', '' ]),
],
'cronard' => [
'%ESCAPED_NAMESPACE%\\Controller' => implode(DIRECTORY_SEPARATOR, [ getenv("PROJECT_PATH"), 'src', 'Controller', '' ]),
],
],
],
+1
View File
@@ -15,4 +15,5 @@ return [
'breadcrumbs.caching' => create(Kash\ArrayCache::class)->constructor( get(Kash\CacheInvalidator::class), "lean.breadcrumbs", 30),
'ulmus.caching' => create(Kash\ArrayCache::class)->constructor( get(Kash\CacheInvalidator::class), "ulmus.entities", 30),
'cronard.caching' => create(Kash\ArrayCache::class)->constructor( get(Kash\CacheInvalidator::class), "lean.cronards", 30),
'events.caching' => create(Kash\ArrayCache::class)->constructor( get(Kash\CacheInvalidator::class), "lean.events", random_int(3600, 7200)),
];
+8 -2
View File
@@ -2,7 +2,10 @@
use Picea\Picea;
use CSLSJ\Debogueur\DebogueurMiddleware;
#use CSLSJ\Debogueur\DebogueurMiddleware;
use Negundo\Client\{ NegundoMiddleware, SoftwareConfig };
use
use Laminas\Diactoros\Response\HtmlResponse;
@@ -27,7 +30,9 @@ return [
};
},
"errorHandler" => create(DebogueurMiddleware::class)->constructor(getenv('DEBOGUEUR_HASH') ?: "", null, get('app.errorhandler.html')),
SoftwareConfig::class => create(SoftwareConfig::class)->constructor(getenv('NEGUNDO_HASH'), getenv('NEGUNDO_SERVER')),
"errorHandler" => create(NegundoMiddleware::class)->constructor(get(SoftwareConfig::class), null, get('app.errorhandler.html')),
'app.errorhandler.html' => function($c, Picea $picea) {
return function(\Throwable $exception) use ($picea) {
@@ -46,4 +51,5 @@ return [
'breadcrumbs.caching' => create(Kash\ApcuCache::class)->constructor(get(Kash\CacheInvalidator::class), "lean.breadcrumbs", random_int(3600, 7200)),
'ulmus.caching' => create(Kash\ApcuCache::class)->constructor( get(Kash\CacheInvalidator::class), "ulmus.entities", random_int(3600, 7200)),
'cronard.caching' => create(Kash\ApcuCache::class)->constructor( get(Kash\CacheInvalidator::class), "lean.cronards", random_int(3600, 7200)),
'events.caching' => create(Kash\ApcuCache::class)->constructor( get(Kash\CacheInvalidator::class), "lean.events", random_int(3600, 7200)),
];
+2 -6
View File
@@ -8,15 +8,11 @@ use %NAMESPACE%\{ Lib, Entity, Form, };
use function %NAMESPACE%\View\{ _, lang, url, route, form };
/**
* @Language("%APPKEY%.home")
*/
#[Language("%APPKEY%.home")]
class Home {
use Lib\ControllerTrait;
/**
* @Route("/", "name" => "home")
*/
#[Route("/", name: "home")]
public function index(ServerRequestInterface $request, array $arguments) : ResponseInterface
{
form(new Form\Form(), $this->pushContext(new Lib\FormContext($request, "form.name")));
+2 -3
View File
@@ -3,12 +3,11 @@
namespace %NAMESPACE%\Entity;
use Ulmus\Entity\Field\Datetime;
use Ulmus\{Attribute\Obj\Table;
use %NAMESPACE%\Lib;
/**
* @Table('name' => "user")
*/
#[Table(name: "user")]
class User extends \Ulmus\User\Entity\User implements \JsonSerializable
{
use Lib\EntityTrait;
+1
View File
@@ -14,6 +14,7 @@ new class(dirname(__DIR__)) extends \Lean\Kernel {
'META_PATH' => "META_DIR",
'PUBLIC_PATH' => "PUBLIC_DIR",
'PRIVATE_PATH' => "PRIVATE_DIR",
'TMP_PATH' => "TMP_DIR",
'VIEW_PATH' => "VIEW_DIR",
];
+13 -7
View File
@@ -6,12 +6,14 @@ use Picea\Picea;
use Storage\Session;
use Ulmus\User\Entity\User;
use Ulmus\User\Lib\Authenticate;
use Notes\Route\Attribute\Object\Route;
use Notes\Security\Attribute\Security;
use %NAMESPACE%\Entity;
/**
* @Security("locked" => false)
* @RouteParam("methods" => [ "GET", "POST" ])
*/
use Mcnd\Event\EventManager;
#[Security(locked: false)]
#[Route(method: ['GET', 'POST', ])]
trait ControllerTrait {
use \Lean\ControllerTrait;
@@ -19,14 +21,18 @@ trait ControllerTrait {
protected Authenticate $authenticate;
public function __construct(Picea $picea, Session $session, Authenticate $authenticate) {
$this->initializeController($picea, $session, $authenticate);
protected EventManager $eventManager;
public function __construct(Picea $picea, Session $session, Authenticate $authenticate, \Notes\Breadcrumb\Breadcrumb $breadcrumb, EventManager $eventManager) {
$this->initializeController($picea, $session, $authenticate, $breadcrumb, $eventManager);
}
public function initializeController(Picea $picea, Session $session, Authenticate $authenticate) {
public function initializeController(Picea $picea, Session $session, Authenticate $authenticate, \Notes\Breadcrumb\Breadcrumb $breadcrumb, EventManager $eventManager) {
$this->picea = $picea;
$this->authenticate = $authenticate;
$this->session = $session;
$this->eventManager = $eventManager;
$this->breadcrumb = $breadcrumb;
$this->user = $authenticate->rememberMe( Entity\User::repository() ) ?: new Entity\User();
}
+5 -13
View File
@@ -23,13 +23,9 @@ class Authentication implements MiddlewareInterface {
$this->session = $session;
}
/**
* Middleware request handling
*
* @param ServerRequestInterface $request
* @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
#[param ServerRequestInterface $request]
#[param RequestHandlerInterface $handler]
#[return ResponseInterface]
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
{
$user = $this->session->get( $this->sessionUserVariable() );
@@ -41,12 +37,8 @@ class Authentication implements MiddlewareInterface {
return $handler->handle($request);
}
/**
* Getter / setter of Session User Variable
*
* @param string|null sessionUserVariable
* @return mixed
*/
#[param string|null sessionUserVariable]
#[return mixed]
public function sessionUserVariable(?string $set = null) : string
{
return $set !== null ? $this->sessionUserVariable = $set : $this->sessionUserVariable;
-21
View File
@@ -5,28 +5,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>{% section "head.title" %}{{ title() }} — {{ lang('application_name') }}{% endsection %}</title>
<link rel="stylesheet" href="{% asset 'static/css/main.e39066da.css' %}">
<style>
@font-face{
font-family:FontAwesome;
src:url({% asset 'static/fonts/fontawesome-webfont.674f50d2.eot' %});
src:url({% asset 'static/fonts/fontawesome-webfont.674f50d2.eot' %}) format("embedded-opentype"),
url({% asset 'static/fonts/fontawesome-webfont.af7ae505.woff2' %}) format("woff2"),
url({% asset 'static/fonts/fontawesome-webfont.fee66e71.woff' %}) format("woff"),
url({% asset 'static/fonts/fontawesome-webfont.b06871f2.ttf' %}) format("truetype"),
url({% asset 'static/images/fontawesome-webfont.912ec66d.svg' %}) format("svg");
font-weight:400;
font-style:normal;
}
</style>
<link rel="apple-touch-icon" sizes="180x180" href="{% asset 'static/favicon/apple-touch-icon.png' %}">
<link rel="icon" type="image/png" sizes="32x32" href="{% asset 'static/favicon/favicon-32x32.png' %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% asset 'static/favicon/favicon-16x16.png' %}">
<link rel="manifest" href="{% asset 'static/favicon/site.webmanifest' %}">
<link rel="mask-icon" href="{% asset 'static/favicon/safari-pinned-tab.svg' %}" color="#5bbad5">
<meta name="msapplication-TileColor" content="#2d89ef">
<meta name="theme-color" content="#ffffff">
</head>
{% endsection %}