Toolvana: production-ready media tools platform (CodeIgniter 4)
- 134-tool registry with programmatic SEO (unique titles/H1/descriptions, JSON-LD graphs, sitemap index, canonical 301 enforcement via required filter) - DB-backed job queue (SKIP LOCKED) with drivers: Ffmpeg, Images (GD), Pdf (qpdf/gs/poppler), Youtube (thumbnails), Qr (server-side PNG) - Security: SSRF guard, MIME validation, rate limits, API-key auth, bcrypt admin login, security headers - Admin panel: dashboard, tools/categories/guides CRUD, SEO audit, analytics, job inspector with retry, system health, feature flags - Docker deployment (nginx + web/api FPM pools + scalable workers), PHPUnit suite (19 tests / 1139 assertions), PWA manifest + service worker
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Models\SettingModel;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
|
||||
/** Runtime feature flags & retention overrides. */
|
||||
final class SettingsAdmin extends AdminBase
|
||||
{
|
||||
private const FLAGS = [
|
||||
'ytdlp_enabled' => 'Enable YouTube video/audio downloading (requires yt-dlp binary + legal review)',
|
||||
'ads_enabled' => 'Display advertising slots',
|
||||
'maintenance' => 'Maintenance mode notice on tool pages',
|
||||
];
|
||||
|
||||
public function index(): string
|
||||
{
|
||||
return $this->render('settings_index', [
|
||||
'flags' => self::FLAGS,
|
||||
'values' => model(SettingModel::class)->all(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function save(): ResponseInterface
|
||||
{
|
||||
$model = model(SettingModel::class);
|
||||
$posted = (array) $this->request->getPost();
|
||||
|
||||
foreach (array_keys(self::FLAGS) as $key) {
|
||||
$model->put($key, isset($posted[$key]) ? '1' : '0');
|
||||
}
|
||||
if (! empty($posted['retention_hours'])) {
|
||||
$hours = max(1, min(72, (int) $posted['retention_hours']));
|
||||
$model->put('retention_hours', (string) $hours);
|
||||
}
|
||||
|
||||
service('cache')->clear();
|
||||
|
||||
return redirect()->to('/admin/settings');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user