- 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
115 lines
3.7 KiB
PHP
115 lines
3.7 KiB
PHP
<?php
|
|
|
|
namespace Config;
|
|
|
|
use CodeIgniter\Config\Filters as BaseFilters;
|
|
use CodeIgniter\Filters\Cors;
|
|
use CodeIgniter\Filters\CSRF;
|
|
use CodeIgniter\Filters\DebugToolbar;
|
|
use CodeIgniter\Filters\ForceHTTPS;
|
|
use CodeIgniter\Filters\Honeypot;
|
|
use CodeIgniter\Filters\InvalidChars;
|
|
use CodeIgniter\Filters\PageCache;
|
|
use CodeIgniter\Filters\PerformanceMetrics;
|
|
use CodeIgniter\Filters\SecureHeaders;
|
|
|
|
class Filters extends BaseFilters
|
|
{
|
|
/**
|
|
* Configures aliases for Filter classes to
|
|
* make reading things nicer and simpler.
|
|
*
|
|
* @var array<string, class-string|list<class-string>>
|
|
*
|
|
* [filter_name => classname]
|
|
* or [filter_name => [classname1, classname2, ...]]
|
|
*/
|
|
public array $aliases = [
|
|
'csrf' => CSRF::class,
|
|
'toolbar' => DebugToolbar::class,
|
|
'honeypot' => Honeypot::class,
|
|
'invalidchars' => InvalidChars::class,
|
|
'secureheaders' => SecureHeaders::class,
|
|
'cors' => Cors::class,
|
|
'forcehttps' => ForceHTTPS::class,
|
|
'pagecache' => PageCache::class,
|
|
'performance' => PerformanceMetrics::class,
|
|
'seocanonical' => \App\Filters\SeoCanonical::class,
|
|
'ratelimit' => \App\Filters\RateLimit::class,
|
|
'admin-auth' => \App\Filters\AdminAuth::class,
|
|
'api-auth' => \App\Filters\ApiAuth::class,
|
|
];
|
|
|
|
/**
|
|
* List of special required filters.
|
|
*
|
|
* The filters listed here are special. They are applied before and after
|
|
* other kinds of filters, and always applied even if a route does not exist.
|
|
*
|
|
* Filters set by default provide framework functionality. If removed,
|
|
* those functions will no longer work.
|
|
*
|
|
* @see https://codeigniter.com/user_guide/incoming/filters.html#provided-filters
|
|
*
|
|
* @var array{before: list<string>, after: list<string>}
|
|
*/
|
|
public array $required = [
|
|
'before' => [
|
|
'forcehttps', // Force Global Secure Requests
|
|
'pagecache', // Web Page Caching
|
|
'seocanonical', // 301 non-canonical URLs even when the route would 404
|
|
],
|
|
'after' => [
|
|
'pagecache', // Web Page Caching
|
|
'performance', // Performance Metrics
|
|
'toolbar', // Debug Toolbar
|
|
],
|
|
];
|
|
|
|
/**
|
|
* List of filter aliases that are always
|
|
* applied before and after every request.
|
|
*
|
|
* @var array{
|
|
* before: array<string, array{except: list<string>|string}>|list<string>,
|
|
* after: array<string, array{except: list<string>|string}>|list<string>
|
|
* }
|
|
*/
|
|
public array $globals = [
|
|
'before' => [],
|
|
'after' => [
|
|
'secureheaders',
|
|
],
|
|
];
|
|
|
|
/**
|
|
* List of filter aliases that works on a
|
|
* particular HTTP method (GET, POST, etc.).
|
|
*
|
|
* Example:
|
|
* 'POST' => ['foo', 'bar']
|
|
*
|
|
* If you use this, you should disable auto-routing because auto-routing
|
|
* permits any HTTP method to access a controller. Accessing the controller
|
|
* with a method you don't expect could bypass the filter.
|
|
*
|
|
* @var array<string, list<string>>
|
|
*/
|
|
public array $methods = [];
|
|
|
|
/**
|
|
* List of filter aliases that should run on any
|
|
* before or after URI patterns.
|
|
*
|
|
* Example:
|
|
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
|
|
*
|
|
* @var array<string, array<string, list<string>>>
|
|
*/
|
|
public array $filters = [
|
|
'ratelimit' => ['before' => ['api/*', 'upload', 'download/*', 'preview/*']],
|
|
'csrf' => ['except' => ['api/*']],
|
|
'admin-auth' => ['except' => ['admin/login', 'admin/logout']],
|
|
];
|
|
}
|