mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-27 00:59:18 +02:00
Replace Psalm with PHPStan + PHP‑CS‑Fixer + Biome, add linting configs & cleanup
- Removed the `vimeo/psalm` dependency and all related files (`psalm.xml`, `psalm‑baseline.xml`, suppress annotations). - Added **PHPStan** (v2.1.54) and **PHP‑CS‑Fixer** (v3.95.1) to `vendor/bin/`. - Created `phpstan.neon` (level 5, bootstraps `app/bootstrap.php`, scans `Parsedown.php`). - Created `phpstan‑baseline.neon` with 10 pre‑existing errors. - Added `.php‑cs‑fixer.dist.php` (PSR‑12 + PHP80Migration, targets `app/src` & `app/tests`). - Added `biome.json` and updated `justfile` to replace the old Psalm recipes with `phpstan`, `cs‑check`, and `cs‑fix`. - Updated `.gitignore` to exclude PHPStan and PHP‑CS‑Fixer cache files. - Updated several JS files (`file‑preview.js`, `file‑upload‑queue.js`) eand PHP controllers (`MediaController.php`, `SearchController.php`, `SystemController.php`). - Minor adjustments to `TODO.md`, `app/src/Database.php`, `app/src/Parsedown.php`, `app/src/ShareLink.php`, and `app/src/SmtpRelay.php`.
This commit is contained in:
@@ -109,14 +109,9 @@ class MediaController
|
||||
// 5. Determine if download was explicitly requested
|
||||
$forceDownload = !empty($_GET['download']) && $_GET['download'] === '1';
|
||||
|
||||
// File types that should be displayed inline by default
|
||||
$inlineExts = ['jpg','jpeg','png','gif','webp','pdf','mp4','webm','ogv','mov',
|
||||
'mp3','ogg','oga','wav','flac','aac','m4a','vtt'];
|
||||
$inline = in_array($ext, $inlineExts, true) && !$forceDownload;
|
||||
|
||||
// 6. Send response headers
|
||||
header('Content-Type: ' . $mimeType);
|
||||
header('Content-Length: ' . filesize($realFull));
|
||||
header('Content-Length: ' . (int) filesize($realFull));
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
|
||||
if ($ext === 'vtt') {
|
||||
@@ -155,7 +150,7 @@ class MediaController
|
||||
*/
|
||||
private function streamWithRange(string $path, string $mimeType): void
|
||||
{
|
||||
$size = filesize($path);
|
||||
$size = (int) filesize($path);
|
||||
$start = 0;
|
||||
$end = $size - 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user