Add built-in screens (login, profile, menu, posts), per-user and site themes
This commit is contained in:
1 parent
4bf0a8bbb0
commit
351667abaf
46 files changed
+3720
-12
No files matched your search
@@ -2,7 +2,10 @@
|
||||
|
||||
namespace IriksIT\Manager;
|
||||
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use IriksIT\Manager\Support\ModuleRegistry;
|
||||
@@ -32,6 +35,11 @@ class ManagerServiceProvider extends ServiceProvider
|
||||
|
||||
$this->publishes([__DIR__.'/../config/manager.php' => config_path('manager.php')], 'manager-config');
|
||||
$this->loadViewsFrom(__DIR__.'/../resources/views', 'manager');
|
||||
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
|
||||
|
||||
$this->app['router']->aliasMiddleware('manager.auth', Http\Middleware\Authenticate::class);
|
||||
$this->app['router']->aliasMiddleware('manager.shell', Http\Middleware\ServeShell::class);
|
||||
RateLimiter::for('manager-login', fn (Request $request) => Limit::perMinute(5)->by(strtolower((string) $request->input('email')).'|'.$request->ip()));
|
||||
|
||||
foreach ($modules->active() as $module) {
|
||||
if ($module->migrations() !== null) {
|
||||
@@ -46,7 +54,7 @@ class ManagerServiceProvider extends ServiceProvider
|
||||
}
|
||||
|
||||
if ($this->app->runningInConsole()) {
|
||||
$this->commands([Console\InstallCommand::class, Console\DoctorCommand::class]);
|
||||
$this->commands([Console\InstallCommand::class, Console\DoctorCommand::class, Console\MakeThemeCommand::class]);
|
||||
}
|
||||
|
||||
$this->registerGates($modules);
|
||||
@@ -68,7 +76,17 @@ class ManagerServiceProvider extends ServiceProvider
|
||||
|
||||
private function registerRoutes(ModuleRegistry $modules): void
|
||||
{
|
||||
Route::middleware([...$modules->middleware('before'), ...config('manager.middleware'), ...$modules->middleware('after')])
|
||||
$screens = config('manager.ui') === 'package';
|
||||
|
||||
if ($screens) {
|
||||
// Outside `auth`, but behind the bans of the modules.
|
||||
Route::middleware(['web', ...$modules->middleware('before'), 'manager.shell'])
|
||||
->prefix(config('manager.path'))
|
||||
->name('manager.')
|
||||
->group(fn () => $this->loadRoutesFrom(__DIR__.'/../routes/guest.php'));
|
||||
}
|
||||
|
||||
Route::middleware([...$modules->middleware('before'), ...config('manager.middleware'), ...($screens ? ['manager.shell'] : []), ...$modules->middleware('after')])
|
||||
->prefix(config('manager.path'))
|
||||
->name('manager.')
|
||||
->group(function () use ($modules) {
|
||||
|
||||
Reference in new issue
Block a user