Files
Atomcms-edit/app/Providers/AppServiceProvider.php
T
root f29ba72591 Fix security, performance, and code quality issues across CMS
Security:
- Replace unescaped {!! !!} with Purify::clean() in 15+ Blade templates (XSS)
- Add rate limiting to register (3/hr), upload (10/min), SSE (6/min)
- Add max:5000 validation on article comments
- Remove duplicate exception handler callback

Hardcoded paths:
- Replace ~44 /var/www/ hardcoded paths with env() configs
- CatalogService (13), AutoDetectService (18), Commandocentrum (11), AppServiceProvider (2)

Performance:
- Add 10 missing database indexes (radio_song_requests, help_center_tickets, etc.)
- Replace Cache::flush() with targeted Cache::forget() in RadioSettings
- Cache getCachedCategories() in TicketController (N+1 fix)
- Remove redundant top-3 leaderboard query

Bug fixes:
- Fix undefined $enabled variable → $isOnline in radio index view
- Add getAvatarAttribute() accessor for non-existent avatar column
- Fix User::guilds() from wrong HasMany to HasManyThrough

Code quality:
- Replace file_get_contents with Http::timeout(10) in TraxService
- Remove commented Echo/Pusher boilerplate in bootstrap.js
- Remove TODO/FIXME comments from logo-generator templates
- Replace hardcoded Turnstile CDN URL with config()
- Restore QUEUE_CONNECTION=redis in .env.example files
2026-06-29 18:28:19 +02:00

75 lines
2.3 KiB
PHP
Executable File

<?php
namespace App\Providers;
use App\Models\WebsiteDrawBadge;
use App\Observers\WebsiteDrawBadgeObserver;
use App\Services\InstallationService;
use App\Services\PermissionsService;
use App\Services\RconService;
use App\Services\SettingsService;
use App\Services\ViteService;
use Filament\Tables\Table;
use Illuminate\Foundation\Vite;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
#[\Override]
public function register(): void
{
$this->app->bind(
Vite::class,
ViteService::class,
);
$this->app->singleton(
InstallationService::class,
fn () => new InstallationService,
);
$this->app->singleton(
SettingsService::class,
fn ($app) => new SettingsService($app->make(InstallationService::class)),
);
$this->app->singleton(
PermissionsService::class,
fn () => new PermissionsService,
);
$this->app->singleton(
RconService::class,
fn () => new RconService,
);
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
// We registreren de 'views/filament' map.
// Laravel matcht 'filament-components::components.commandocentrum.summary-card' nu correct via de automatische Blade-registratie.
if (is_dir(resource_path('views/filament'))) {
$this->loadViewsFrom(resource_path('views/filament'), 'filament-components');
}
Table::configureUsing(function (Table $table) {
$table->paginated([10, 25, 50]);
});
$settingsService = app(SettingsService::class);
$badgePath = $settingsService->getOrDefault('badge_path_filesystem', dirname(env('NITRO_GAMEDATA_DIR', '/var/www/Gamedata/config')) . '/c_images/album1584');
Config::set('filesystems.disks.badges.root', $badgePath);
$adsPath = $settingsService->getOrDefault('ads_path_filesystem', dirname(env('NITRO_GAMEDATA_DIR', '/var/www/Gamedata/config')) . '/custom');
Config::set('filesystems.disks.ads.root', $adsPath);
WebsiteDrawBadge::observe(WebsiteDrawBadgeObserver::class);
}
}