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
This commit is contained in:
root
2026-06-29 18:28:19 +02:00
parent ef0aec4301
commit f29ba72591
30 changed files with 407 additions and 159 deletions
@@ -0,0 +1,88 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('radio_song_requests', function (Blueprint $table) {
$table->index(['is_approved', 'is_played', 'submitted_at'], 'idx_radio_song_requests_queue');
});
Schema::table('website_help_center_tickets', function (Blueprint $table) {
$table->index(['user_id', 'open'], 'idx_help_tickets_user_open');
});
Schema::table('radio_shouts', function (Blueprint $table) {
$table->index('approved', 'idx_radio_shouts_approved');
});
Schema::table('radio_applications', function (Blueprint $table) {
$table->index('status', 'idx_radio_applications_status');
});
Schema::table('radio_history', function (Blueprint $table) {
$table->index(['user_id', 'ended_at'], 'idx_radio_history_user_ended');
});
Schema::table('radio_song_requests', function (Blueprint $table) {
$table->index(['user_id', 'submitted_at'], 'idx_radio_song_requests_user_date');
});
Schema::table('radio_giveaway_participants', function (Blueprint $table) {
$table->index(['giveaway_id', 'user_id'], 'idx_giveaway_participants_entry');
});
Schema::table('camera_web', function (Blueprint $table) {
$table->index('user_id', 'idx_camera_web_user_id');
$table->index('timestamp', 'idx_camera_web_timestamp');
});
Schema::table('radio_song_votes', function (Blueprint $table) {
$table->index(['song_request_id', 'user_id'], 'idx_radio_song_votes_entry');
});
}
public function down(): void
{
Schema::table('radio_song_requests', function (Blueprint $table) {
$table->dropIndex('idx_radio_song_requests_queue');
});
Schema::table('website_help_center_tickets', function (Blueprint $table) {
$table->dropIndex('idx_help_tickets_user_open');
});
Schema::table('radio_shouts', function (Blueprint $table) {
$table->dropIndex('idx_radio_shouts_approved');
});
Schema::table('radio_applications', function (Blueprint $table) {
$table->dropIndex('idx_radio_applications_status');
});
Schema::table('radio_history', function (Blueprint $table) {
$table->dropIndex('idx_radio_history_user_ended');
});
Schema::table('radio_song_requests', function (Blueprint $table) {
$table->dropIndex('idx_radio_song_requests_user_date');
});
Schema::table('radio_giveaway_participants', function (Blueprint $table) {
$table->dropIndex('idx_giveaway_participants_entry');
});
Schema::table('camera_web', function (Blueprint $table) {
$table->dropIndex('idx_camera_web_user_id');
$table->dropIndex('idx_camera_web_timestamp');
});
Schema::table('radio_song_votes', function (Blueprint $table) {
$table->dropIndex('idx_radio_song_votes_entry');
});
}
};