You've already forked Atomcms-edit
Fix remaining issues: pagination, throttle, i18n, config defaults, indexes
- Add pagination to ShopController (50 per page)
- Add throttle:3,10 to radio application store route
- Replace mixed Dutch/English labels in RadioWizardController (English only)
- Replace Dutch error messages in RadioController and RadioSetupController
- Add config('habbo.defaults.avatar_look') for SocialAuthController
- Remove hardcoded default stream URL from RadioSetupController
- Add database indexes for radio_listener_points.earned_at and bans.ip
This commit is contained in:
@@ -25,7 +25,7 @@ class RadioSetupController extends Controller
|
||||
$settings = [
|
||||
// Basic Radio Settings
|
||||
'radio_enabled' => '1',
|
||||
'radio_stream_url' => 'https://stream.radioking.com/radio/83232/radio.mp3',
|
||||
'radio_stream_url' => '',
|
||||
'radio_style' => 'dark',
|
||||
'radio_auto_play' => '0',
|
||||
|
||||
@@ -112,10 +112,10 @@ class RadioSetupController extends Controller
|
||||
Artisan::call('cache:clear');
|
||||
|
||||
return redirect()->route('admin.radio.setup')
|
||||
->with('success', 'Radio instellingen zijn gereset.');
|
||||
->with('success', 'Radio settings have been reset.');
|
||||
} catch (\Exception $e) {
|
||||
return redirect()->route('admin.radio.setup')
|
||||
->with('error', 'Fout bij resetten: ' . $e->getMessage());
|
||||
->with('error', 'Error during reset: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class RadioWizardController extends Controller
|
||||
'shoutcast' => 'SHOUTcast',
|
||||
'icecast' => 'Icecast',
|
||||
'azurecast' => 'AzureCast',
|
||||
'other' => 'Anders',
|
||||
'other' => 'Other',
|
||||
];
|
||||
|
||||
return view('admin.radio.wizard.step-2', [
|
||||
@@ -99,7 +99,7 @@ class RadioWizardController extends Controller
|
||||
$validated = $request->validate($rules);
|
||||
|
||||
session()->put(self::SESSION_KEY . '.stream_url', $validated['stream_url']);
|
||||
session()->put(self::SESSION_KEY . '.stream_name', $validated['stream_name'] ?? 'Mijn Radio');
|
||||
session()->put(self::SESSION_KEY . '.stream_name', $validated['stream_name'] ?? 'My Radio');
|
||||
|
||||
if ($platform === 'azurecast') {
|
||||
session()->put(self::SESSION_KEY . '.azurecast_base_url', $validated['azurecast_base_url'] ?? '');
|
||||
@@ -208,7 +208,7 @@ class RadioWizardController extends Controller
|
||||
'shoutcast' => 'SHOUTcast',
|
||||
'icecast' => 'Icecast',
|
||||
'azurecast' => 'AzureCast',
|
||||
'other' => 'Anders',
|
||||
'other' => 'Other',
|
||||
];
|
||||
|
||||
$testResults = null;
|
||||
@@ -240,7 +240,7 @@ class RadioWizardController extends Controller
|
||||
if (! $data || empty($data['stream_url'])) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'error' => 'Geen stream URL gevonden. Start de wizard opnieuw.',
|
||||
'error' => 'No stream URL found. Please restart the wizard.',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ class RadioWizardController extends Controller
|
||||
|
||||
if (! $data) {
|
||||
return redirect()->route('admin.radio.wizard')
|
||||
->with('error', 'Geen wizard data gevonden. Start opnieuw.');
|
||||
->with('error', 'No wizard data found. Please start over.');
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -275,10 +275,10 @@ class RadioWizardController extends Controller
|
||||
session()->forget(self::SESSION_KEY);
|
||||
|
||||
return redirect()->route('admin.radio.setup')
|
||||
->with('success', 'Radio systeem is succesvol geïnstalleerd en geconfigureerd!');
|
||||
->with('success', 'Radio system has been successfully installed and configured!');
|
||||
} catch (\Exception $e) {
|
||||
return redirect()->route('admin.radio.wizard.step', ['step' => 5])
|
||||
->with('error', 'Fout tijdens opslaan: ' . $e->getMessage());
|
||||
->with('error', 'Error while saving: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ class RadioWizardController extends Controller
|
||||
$settings = [
|
||||
'radio_enabled' => '1',
|
||||
'radio_stream_url' => $data['stream_url'] ?? '',
|
||||
'radio_stream_name' => $data['stream_name'] ?? 'Mijn Radio',
|
||||
'radio_stream_name' => $data['stream_name'] ?? 'My Radio',
|
||||
'radio_style' => 'dark',
|
||||
'radio_auto_play' => '0',
|
||||
'radio_stream_platform' => $platform,
|
||||
@@ -356,12 +356,12 @@ class RadioWizardController extends Controller
|
||||
{
|
||||
$list = [];
|
||||
$list['Stream URL'] = $data['stream_url'] ?? '-';
|
||||
$list['Stream Naam'] = $data['stream_name'] ?? 'Mijn Radio';
|
||||
$list['Stream Name'] = $data['stream_name'] ?? 'My Radio';
|
||||
$list['Platform'] = match ($data['platform'] ?? 'other') {
|
||||
'shoutcast' => 'SHOUTcast',
|
||||
'icecast' => 'Icecast',
|
||||
'azurecast' => 'AzureCast',
|
||||
default => 'Anders',
|
||||
default => 'Other',
|
||||
};
|
||||
|
||||
if (! empty($data['now_playing_api'])) {
|
||||
@@ -372,19 +372,19 @@ class RadioWizardController extends Controller
|
||||
$list['Listeners API'] = $data['listeners_api'];
|
||||
}
|
||||
|
||||
$list['Nu Afspelen'] = ($data['enable_now_playing'] ?? true) ? 'Aan' : 'Uit';
|
||||
$list['Luisteraars'] = ($data['enable_listeners'] ?? true) ? 'Aan' : 'Uit';
|
||||
$list['Huidige DJ'] = ($data['enable_current_dj'] ?? true) ? 'Aan' : 'Uit';
|
||||
$list['Shouts'] = ($data['enable_shouts'] ?? true) ? 'Aan' : 'Uit';
|
||||
$list['DJ Aanmeldingen'] = ($data['enable_applications'] ?? true) ? 'Aan' : 'Uit';
|
||||
$list['Radio Widget'] = ($data['enable_widget'] ?? true) ? 'Aan' : 'Uit';
|
||||
$list['Widget Overal'] = ($data['enable_widget_globally'] ?? true) ? 'Ja' : 'Nee';
|
||||
$list['Widget Positie'] = $data['widget_position'] ?? 'bottom-right';
|
||||
$list['Punten Systeem'] = ($data['enable_points'] ?? true) ? 'Aan' : 'Uit';
|
||||
$list['Song Verzoeken'] = ($data['enable_requests'] ?? true) ? 'Aan' : 'Uit';
|
||||
$list['Contesten'] = ($data['enable_contests'] ?? true) ? 'Aan' : 'Uit';
|
||||
$list['Giveaways'] = ($data['enable_giveaways'] ?? false) ? 'Aan' : 'Uit';
|
||||
$list['Discord'] = ($data['enable_discord'] ?? false) ? 'Aan' : 'Uit';
|
||||
$list['Now Playing'] = ($data['enable_now_playing'] ?? true) ? 'On' : 'Off';
|
||||
$list['Listeners'] = ($data['enable_listeners'] ?? true) ? 'On' : 'Off';
|
||||
$list['Current DJ'] = ($data['enable_current_dj'] ?? true) ? 'On' : 'Off';
|
||||
$list['Shouts'] = ($data['enable_shouts'] ?? true) ? 'On' : 'Off';
|
||||
$list['DJ Applications'] = ($data['enable_applications'] ?? true) ? 'On' : 'Off';
|
||||
$list['Radio Widget'] = ($data['enable_widget'] ?? true) ? 'On' : 'Off';
|
||||
$list['Widget Everywhere'] = ($data['enable_widget_globally'] ?? true) ? 'Yes' : 'No';
|
||||
$list['Widget Position'] = $data['widget_position'] ?? 'bottom-right';
|
||||
$list['Points System'] = ($data['enable_points'] ?? true) ? 'On' : 'Off';
|
||||
$list['Song Requests'] = ($data['enable_requests'] ?? true) ? 'On' : 'Off';
|
||||
$list['Contests'] = ($data['enable_contests'] ?? true) ? 'On' : 'Off';
|
||||
$list['Giveaways'] = ($data['enable_giveaways'] ?? false) ? 'On' : 'Off';
|
||||
$list['Discord'] = ($data['enable_discord'] ?? false) ? 'On' : 'Off';
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class SocialAuthController extends Controller
|
||||
'account_created' => time(),
|
||||
'last_login' => time(),
|
||||
'motto' => 'New player',
|
||||
'look' => 'hr-100-61.hd-180-1.ch-210-66',
|
||||
'look' => config('habbo.defaults.avatar_look'),
|
||||
'ip_register' => request()->ip(),
|
||||
'ip_current' => request()->ip(),
|
||||
]);
|
||||
|
||||
@@ -268,7 +268,7 @@ class RadioController extends Controller
|
||||
|
||||
if ($activeSession) {
|
||||
return response()->json([
|
||||
'error' => 'Je hebt al een actieve sessie',
|
||||
'error' => 'You already have an active session',
|
||||
'session_id' => $activeSession->id,
|
||||
], 400);
|
||||
}
|
||||
@@ -280,7 +280,7 @@ class RadioController extends Controller
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Sessie gestart',
|
||||
'message' => 'Session started',
|
||||
'session_id' => $session->id,
|
||||
]);
|
||||
}
|
||||
@@ -292,13 +292,13 @@ class RadioController extends Controller
|
||||
$activeSession = RadioHistory::where('user_id', $userId)->whereNull('ended_at')->first();
|
||||
|
||||
if (! $activeSession) {
|
||||
return response()->json(['error' => 'Geen actieve sessie gevonden'], 404);
|
||||
return response()->json(['error' => 'No active session found'], 404);
|
||||
}
|
||||
|
||||
$activeSession->endSession();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Sessie beëindigd',
|
||||
'message' => 'Session ended',
|
||||
'duration' => $activeSession->duration,
|
||||
]);
|
||||
}
|
||||
@@ -306,7 +306,7 @@ class RadioController extends Controller
|
||||
public function getShouts(): JsonResponse
|
||||
{
|
||||
if (! $this->getSetting(RadioSettings::ShoutsEnabled)) {
|
||||
return response()->json(['error' => 'Shouts zijn uitgeschakeld', 'shouts' => []], 403);
|
||||
return response()->json(['error' => 'Shouts are disabled', 'shouts' => []], 403);
|
||||
}
|
||||
|
||||
$shouts = Cache::remember('api_radio_shouts', 30, fn () => RadioShout::with('user:id,username')
|
||||
@@ -315,7 +315,7 @@ class RadioController extends Controller
|
||||
->get()
|
||||
->map(fn ($shout) => [
|
||||
'id' => $shout->id,
|
||||
'username' => $shout->user?->username ?? 'Anoniem',
|
||||
'username' => $shout->user?->username ?? 'Anonymous',
|
||||
'message' => $shout->message,
|
||||
'created_at' => $shout->created_at->diffForHumans(),
|
||||
]));
|
||||
|
||||
@@ -28,7 +28,7 @@ class ShopController extends Controller
|
||||
}
|
||||
|
||||
return view('shop.shop', [
|
||||
'articles' => $query->with(['rank:id,rank_name', 'features'])->get(),
|
||||
'articles' => $query->with(['rank:id,rank_name', 'features'])->paginate(50),
|
||||
'categories' => WebsiteShopCategory::whereHas('articles')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -54,6 +54,10 @@ return [
|
||||
'external_override_texts' => env('EXTERNAL_OVERRIDE_TEXTS'),
|
||||
],
|
||||
|
||||
'defaults' => [
|
||||
'avatar_look' => env('DEFAULT_AVATAR_LOOK', 'hr-100-61.hd-180-1.ch-210-66'),
|
||||
],
|
||||
|
||||
'findretros' => [
|
||||
'enabled' => (bool) env('FINDRETROS_ENABLED', false),
|
||||
'name' => env('FINDRETROS_NAME', 'Example'),
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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_listener_points', function (Blueprint $table) {
|
||||
$table->index(['earned_at', 'user_id', 'points'], 'idx_listener_points_earned');
|
||||
});
|
||||
|
||||
Schema::table('bans', function (Blueprint $table) {
|
||||
$table->index('ip', 'idx_bans_ip');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('radio_listener_points', function (Blueprint $table) {
|
||||
$table->dropIndex('idx_listener_points_earned');
|
||||
});
|
||||
|
||||
Schema::table('bans', function (Blueprint $table) {
|
||||
$table->dropIndex('idx_bans_ip');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -37,7 +37,7 @@ Route::prefix('community')->group(function () {
|
||||
Route::prefix('radio')->group(function () {
|
||||
Route::get('/shouts', [RadioController::class, 'shouts'])->name('radio.shouts');
|
||||
Route::get('/dj-aanmelden', [RadioController::class, 'apply'])->name('radio.apply');
|
||||
Route::post('/dj-aanmelden', [RadioController::class, 'storeApplication'])->name('radio.apply.store');
|
||||
Route::post('/dj-aanmelden', [RadioController::class, 'storeApplication'])->name('radio.apply.store')->middleware('throttle:3,10');
|
||||
Route::post('/shouts', [RadioController::class, 'storeShout'])->name('radio.shouts.store');
|
||||
Route::post('/session/start', [RadioController::class, 'startSession'])->name('radio.session.start');
|
||||
Route::post('/session/end', [RadioController::class, 'endSession'])->name('radio.session.end');
|
||||
|
||||
Reference in New Issue
Block a user