A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
chore: code smells and remove debug text
aminnausin8e60b41afc37
diff --git a/app/Http/Resources/Pulse/ScheduleResource.php b/app/Http/Resources/Pulse/ScheduleResource.phpindex 9e6238e4..311118d5 100644--- a/app/Http/Resources/Pulse/ScheduleResource.php+++ b/app/Http/Resources/Pulse/ScheduleResource.php@@ -21,13 +21,16 @@ class ScheduleResource extends PulseResource {public int|string|null $ignoreAfter = null;public function toArray(Request $request): array {- [$events, $time, $runAt] = $this->remember(function (ConsoleKernel $kernel, IlluminateSchedule $schedule) {+ $kernel = app(ConsoleKernel::class);+ $schedule = app(IlluminateSchedule::class);++ [$events, $time, $runAt] = $this->remember(function () use ($kernel, $schedule) {$kernel->bootstrap();$timezone = new DateTimeZone(config('app.timezone')); // @phpstan-ignore-linereturn collect($schedule->events())- ->map(fn (Event $event): array => [+ ->map(fn(Event $event): array => ['command' => $this->getCommand($event),'expression' => $this->getExpression($event),'next_due' => $this->getNextDueDateForEvent($event, $timezone)@@ -45,7 +48,15 @@ class ScheduleResource extends PulseResource {}private function getClosureLocation(CallbackEvent $event): string {- $callback = (new ReflectionClass($event))->getProperty('callback')->getValue($event);+ $refClass = new ReflectionClass($event);++ if (! $refClass->hasProperty('callback')) {+ return 'unknown';+ }++ $prop = $refClass->getProperty('callback');+ $prop->setAccessible(true);+ $callback = $prop->getValue($event);if ($callback instanceof Closure) {$function = new ReflectionFunction($callback);diff --git a/app/Http/Resources/VideoTagResource.php b/app/Http/Resources/VideoTagResource.phpindex 678559ef..92875045 100644--- a/app/Http/Resources/VideoTagResource.php+++ b/app/Http/Resources/VideoTagResource.php@@ -6,8 +6,6 @@ use Illuminate\Http\Request;use Illuminate\Http\Resources\Json\JsonResource;class VideoTagResource extends JsonResource {- // protected static $tagCache = [];-/*** Transform the resource into an array.*diff --git a/app/Jobs/IndexFiles.php b/app/Jobs/IndexFiles.phpindex 2ed67404..1a203fb7 100755--- a/app/Jobs/IndexFiles.php+++ b/app/Jobs/IndexFiles.php@@ -478,7 +478,7 @@ class IndexFiles implements ShouldBeUnique, ShouldQueue {// Only check uuid on new videos, old video uuid will be checked in verify files with chunking$fileMetaData = VerifyFiles::getFileMetadata($absolutePath);- $uuid = isset($fileMetaData['tags']['uuid']) ? $fileMetaData['tags']['uuid'] : (isset($fileMetaData['tags']['uid']) ? $fileMetaData['tags']['uid'] : null);+ $uuid = $fileMetaData['tags']['uuid'] ?? $fileMetaData['tags']['uid'] ?? null;$embeddingUuid = false;if (! $uuid || ! Uuid::isValid($uuid)) {$uuid = Str::uuid()->toString();@@ -527,53 +527,6 @@ class IndexFiles implements ShouldBeUnique, ShouldQueue {return ['videoChanges' => $changes, 'data' => $data, 'cost' => $cost, 'updatedFolderStructure' => $foldersCopy, 'metadataChanges' => $metadataChanges];}- // Not Using- private function embedUidInMetadataDirect($filePath, $uid) {- $ext = pathinfo($filePath, PATHINFO_EXTENSION);- // Define a temporary file path with the correct extension- $tempFilePath = $filePath . '.tmp';-- // Map file extensions to FFmpeg formats- $formatMap = ['mp4' => 'mp4', 'mkv' => 'matroska'];- // Determine the correct format to use- $format = isset($formatMap[$ext]) ? $formatMap[$ext] : $ext;-- $command = [- 'ffmpeg',- '-i',- $filePath,- '-c',- 'copy',- '-movflags',- 'use_metadata_tags',- '-metadata',- "uid=$uid",- '-f',- $format,- $tempFilePath,- ];- // Execute the FFmpeg command- $process = new Process($command);- $process->run();-- // Check if the process was successful- if (! $process->isSuccessful()) {- throw new ProcessFailedException($process);- }- // Replace the original file with the temporary file- if (file_exists($tempFilePath)) {- // Get the original file's timestamps- $originalCreatedTime = filectime($filePath);- $originalModifiedTime = filemtime($filePath);- // Replace the original file with the temporary file- rename($tempFilePath, $filePath);- // Restore the original timestamps- touch($filePath, $originalModifiedTime, $originalCreatedTime);- } else {- throw new Exception('Failed to create the temporary file with metadata.');- }- }-public function upsertMetadata($data) {// update by UUID firsttry {@@ -602,4 +555,5 @@ class IndexFiles implements ShouldBeUnique, ShouldQueue {return 'Generated ' . $count . ' ' . $type . ' Changes';}}-class BatchCancelledException extends \Exception {}+class BatchCancelledException extends \Exception {+}diff --git a/app/Jobs/SyncFiles.php b/app/Jobs/SyncFiles.phpindex dc1381be..78525d92 100755--- a/app/Jobs/SyncFiles.php+++ b/app/Jobs/SyncFiles.php@@ -15,8 +15,8 @@ use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Foundation\Bus\Dispatchable;use Illuminate\Queue\InteractsWithQueue;use Illuminate\Queue\SerializesModels;-use Illuminate\Support\Facades\DB;use Illuminate\Support\Facades\Storage;+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;class SyncFiles implements ShouldBeUnique, ShouldQueue {use Batchable, Dispatchable, InteractsWithQueue, Queueable, SerializesModels;@@ -76,18 +76,18 @@ class SyncFiles implements ShouldBeUnique, ShouldQueue {// -> then if you index files, it should delete sql entries correctly if anything there does not exist locally$path = 'media/';- // $path = "private/media/";+ // When moving to private content urls -> $path = "private/media/";if (! Storage::disk('public')->exists($path)) {$error = 'Missing "media" directory in storage';dd(json_encode(['success' => false, 'result' => '', 'error' => $error], JSON_UNESCAPED_SLASHES));- throw new \Exception($error, 404);+ throw new NotFoundHttpException($error);}$directories = $this->generateCategories();- $subDirectories = $this->generateFolders($path);- $files = $this->generateVideos($path, $subDirectories['data']['folderStructure'], $directories['data']['categoryStructure']);+ $subDirectories = $this->generateFolders();+ $files = $this->generateVideos($subDirectories['data']['folderStructure'], $directories['data']['categoryStructure']);if (isset($files['updatedFolderStructure'])) {$subDirectories['data']['folderStructure'] = $files['updatedFolderStructure'];@@ -158,7 +158,7 @@ class SyncFiles implements ShouldBeUnique, ShouldQueue {return ['categoryChanges' => $changes, 'data' => $data];}- private function generateFolders($path) {+ private function generateFolders() {$this->taskService->updateSubTask($this->subTaskId, ['summary' => 'Generating Folders', 'progress' => 25]);$data = Storage::json('folders.json') ?? ['next_ID' => 1, 'folderStructure' => []]; // array("anime/frieren"=>array("id"=>0,"name"=>"frieren"),"starwars/andor"=>array("id"=1,"name"="andor")); // read from json@@ -207,7 +207,7 @@ class SyncFiles implements ShouldBeUnique, ShouldQueue {return ['folderChanges' => $changes, 'data' => $data, 'cost' => $cost];}- private function generateVideos($path, $folderStructure) {+ private function generateVideos($folderStructure) {$this->taskService->updateSubTask($this->subTaskId, ['summary' => 'Generating Videos', 'progress' => 50]);$data = Storage::json('videos.json') ?? ['next_ID' => 1, 'videoStructure' => []]; // array("anime/frieren/S1E01.mp4"=>array("id"=>0,"name"=>"S1E01"),"starwars/andor/S1E01.mkv"=>array("id"=1,"name"="S1E01.mkv")); // read from jsondiff --git a/app/Jobs/VerifyFiles.php b/app/Jobs/VerifyFiles.phpindex 401519cf..83dce4a3 100755--- a/app/Jobs/VerifyFiles.php+++ b/app/Jobs/VerifyFiles.php@@ -140,7 +140,7 @@ class VerifyFiles implements ShouldQueue {throw new \Exception('Video "media/' . $video->folder->path . '/' . basename($video->path) . '" no longer exists. Index your videos before running this task again.');}- // $filePath = str_replace('\\', '/', Storage::path('app/private/')) . 'media/' . $video->folder->path . "/" . basename($video->path);+ // For use with private storage -> $filePath = str_replace('\\', '/', Storage::path('app/private/')) . 'media/' . $video->folder->path . "/" . basename($video->path);$this->fileMetaData = is_null($video->uuid) ? $this->getFileMetadata($filePath) : []; // Empty unless uuid is missing or duration is missing$uuid = $video->uuid ?? ''; // video has ? file has@@ -149,8 +149,6 @@ class VerifyFiles implements ShouldQueue {if (! isset($this->fileMetaData['tags']['uid']) && ! isset($this->fileMetaData['tags']['uuid'])) {$uuid = Str::uuid()->toString();$this->embedChain[] = new EmbedUidInMetadata($filePath, $uuid, $this->taskId, $video->id);- // $this->embedChain[] = ["path" => $filePath, "uuid" => $uuid];- // EmbedUidInMetadata::dispatch($filePath, $uuid, $this->taskId);} else {$uuid = $this->fileMetaData['tags']['uuid'] ?? $this->fileMetaData['tags']['uid']; // Neet to use UUID everywhere instead of mismatching uuid with uiddump("Found UUID {$uuid}");@@ -190,7 +188,7 @@ class VerifyFiles implements ShouldQueue {$changes['date_uploaded'] = date('Y-m-d h:i A', $mtime < $ctime ? $mtime : $ctime);}- $mime_type = isset($changes['mime_type']) ? $changes['mime_type'] : $metadata->mime_type;+ $mime_type = $changes['mime_type'] ?? $metadata->mime_type;$is_audio = str_starts_with($mime_type, 'audio');$media_type = $is_audio ? MediaType::AUDIO : MediaType::VIDEO;@@ -218,8 +216,8 @@ class VerifyFiles implements ShouldQueue {if (is_null($metadata->duration)) {$this->confirmMetadata($filePath);- $duration = isset($this->fileMetaData['format']['duration']) ? floor($this->fileMetaData['format']['duration']) : (isset($this->fileMetaData['streams'][0]['duration']) ? floor($this->fileMetaData['streams'][0]['duration']) : null);- $changes['duration'] = $duration;+ $duration = $this->fileMetaData['format']['duration'] ?? $this->fileMetaData['streams'][0]['duration'] ?? null;+ $changes['duration'] = is_numeric($duration) ? floor($duration) : null;}if (! $is_audio && (is_null($metadata->resolution_height) || is_null($metadata->codec))) {@@ -299,15 +297,17 @@ class VerifyFiles implements ShouldQueue {if (! empty($changes)) {$changes['date_scanned'] = date('Y-m-d h:i:s A');array_push($transactions, [...$stored, ...$changes]);- // dump(count([...$stored, ...$changes]));- // if ($new) dump([...$stored, ...$changes]);- // dump([...$stored, ...$changes]);- // dump($changes);- // dump($video->name);+ /**+ * DEBUG+ * dump(count([...$stored, ...$changes]));+ * if ($new) dump([...$stored, ...$changes]);+ * dump([...$stored, ...$changes]);+ * dump($changes);+ * dump($video->name);+ */}$index += 1;$this->taskService->updateSubTask($this->subTaskId, ['progress' => (int) (($index / count($this->videos)) * 100)]);- // dump($metadata->toArray());}} catch (\Throwable $th) {$ids = array_map(function ($transaction) {@@ -372,8 +372,6 @@ class VerifyFiles implements ShouldQueue {public static function getFileMetadata($filePath) {try {// ? FFMPEG module with 6 test folders takes 35+ seconds but running the commands through shell takes 18 seconds- // $ffprobe = FFMpegFFProbe::create();- // $tags = $ffprobe->format($filePath)->get('tags'); // extracts file information$ext = pathinfo($filePath, PATHINFO_EXTENSION);dump('PULLING METADATA ' . $filePath);@@ -409,7 +407,6 @@ class VerifyFiles implements ShouldQueue {$metadata['format']['tags']['uuid'] = $metadata['format']['tags']['encoder'];} // ExifTool tag- // return $metadata['format'];return ['format' => $metadata['format'] ?? [],'tags' => $metadata['format']['tags'] ?? [],@@ -436,20 +433,22 @@ class VerifyFiles implements ShouldQueue {$tags = $this->fileMetaData['tags'] ?? [];$streams = $this->fileMetaData['streams'] ?? [];+ $artist = $tags['artist'] ?? $tags['ARTIST'] ?? '';+ $album = $tags['album'] ?? $tags['ALBUM'] ?? '';+$description = implode(' - ', array_filter([- $tags['artist'] ?? $tags['ARTIST'] ?? '',- $tags['album'] ?? $tags['ALBUM'] ?? '',+ $album,+ $artist]));- // $season = isset($this->fileMetaData['tags']['disc']) ? (int) explode($this->fileMetaData['tags']['disc'], '/')[0] ?? null : null;- // $episode = isset($this->fileMetaData['tags']['track']) ? (int) explode($this->fileMetaData['tags']['track'], '/')[0] ?? null : null;-$results = ['title' => $tags['title'] ?? $tags['TITLE'] ?? null,'description' => $description ?: '','season' => isset($tags['disc']) ? (int) explode('/', $tags['disc'])[0] : 0,'episode' => isset($tags['track']) ? (int) explode('/', $tags['track'])[0] : 0,'lyrics' => $tags['lyrics- '] ?? $tags['UNSYNCEDLYRICS'] ?? null,+ 'album' => $album ?? null,+ 'artist' => $artist ?? null];foreach ($streams as $stream) {@@ -496,9 +495,11 @@ class VerifyFiles implements ShouldQueue {return null;}- private function extractAlbumArt($filePath, $outputPath) {+ private function extractAlbumArt($filePath, $outputPath): string|false {+ $result = false;+ $tempPath = sys_get_temp_dir() . '/' . basename($outputPath);+try {- $tempPath = sys_get_temp_dir() . '/' . basename($outputPath);$command = ['ffmpeg','-i',@@ -514,29 +515,26 @@ class VerifyFiles implements ShouldQueue {if (! $process->isSuccessful()) {$errorOutput = $process->getErrorOutput(); // Checks if error is caused by missing album art (never set so dont log)- if (strpos($errorOutput, 'Output file does not contain any stream') !== false) {+ if (str_contains($errorOutput, 'Output file does not contain any stream')) {return false;}throw new ProcessFailedException($process);}- if (! file_exists($tempPath) || filesize($tempPath) == 0) {- unlink($tempPath);-- return false;+ if (file_exists($tempPath) && filesize($tempPath) > 0) {+ $result = file_get_contents($tempPath);}-- $coverArtContent = file_get_contents($tempPath);- unlink($tempPath);-- return $coverArtContent;} catch (\Throwable $th) {dump($th->getMessage());Log::error($th);-- return false;+ } finally {+ if (file_exists($tempPath)) {+ @unlink($tempPath);+ }}++ return $result;}protected function extractMimeType($filePath) {diff --git a/app/Jobs/VerifyFolders.php b/app/Jobs/VerifyFolders.phpindex dede1553..a531597b 100644--- a/app/Jobs/VerifyFolders.php+++ b/app/Jobs/VerifyFolders.php@@ -98,9 +98,7 @@ class VerifyFolders implements ShouldQueue {$stored = $series->toArray();- // if (is_null($series->episodes)) {$changes['episodes'] = $folder->videos->count();- // }$changes['primary_media_type'] = $folder->primary_media_type;@@ -124,15 +122,17 @@ class VerifyFolders implements ShouldQueue {if (! empty($changes)) {array_push($transactions, [...$stored, ...$changes]);- // dump([...$stored, ...$changes]);- // dump($changes);- // dump($folder->name);+ /**+ * DEBUG+ *+ * dump([...$stored, ...$changes]);+ * dump($changes);+ * dump($folder->name);+ */}$index += 1;$this->taskService->updateSubTask($this->subTaskId, ['progress' => (int) (($index / count($this->folders)) * 100)]);-- // dump($series->toArray());} catch (\Throwable $th) {$errorMessage = 'Error cannot verify folder series data ' . $th->getMessage() . ' Cancelling ' . count($transactions) . ' updates and ' . count($this->folders) . ' checks';$error = true;@@ -174,7 +174,6 @@ class VerifyFolders implements ShouldQueue {return VerifyFiles::getPathUrl($path);}} catch (\Throwable $th) {- // throw $th;Log::warning('Unable to download thumbnail image from ' . $url . ' : ' . $th->getMessage());}diff --git a/app/Models/SubTask.php b/app/Models/SubTask.phpindex 4106c6c6..1f952a2a 100644--- a/app/Models/SubTask.php+++ b/app/Models/SubTask.php@@ -21,14 +21,6 @@ class SubTask extends Model {'status' => TaskStatus::class,];- // protected static function boot() {- // parent::boot();-- // static::updated(function ($subTask) {- // $subTask->updateDuration();- // });- // }-public function updateDuration() {if (! isset($this->started_at)) {$this->duration = 0;diff --git a/app/Models/Task.php b/app/Models/Task.phpindex 6d2999c9..562b8043 100644--- a/app/Models/Task.php+++ b/app/Models/Task.php@@ -28,24 +28,6 @@ class Task extends Model {'status' => TaskStatus::class,];- // Boot method to register model events- // protected static function boot() {- // parent::boot();-- // static::updated(function ($task) {- // // This will run whenever the task is updated- // // Add your custom logic here- // $task->updateDuration();- // });- // }-- // public function updateDuration() {- // if ($this->started_at && $this->ended_at) {- // $this->duration = $this->ended_at->diffInSeconds($this->started_at);- // $this->save();- // }- // }-public function user() {return $this->belongsTo(User::class);}diff --git a/app/Models/User.php b/app/Models/User.phpindex 099f8e9e..9b5009f2 100755--- a/app/Models/User.php+++ b/app/Models/User.php@@ -2,7 +2,6 @@namespace App\Models;-// use Illuminate\Contracts\Auth\MustVerifyEmail;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Foundation\Auth\User as Authenticatable;use Illuminate\Notifications\Notifiable;diff --git a/app/Traits/HasPeriod.php b/app/Traits/HasPeriod.phpindex f27e1dce..a1137669 100644--- a/app/Traits/HasPeriod.php+++ b/app/Traits/HasPeriod.php@@ -26,29 +26,24 @@ trait HasPeriod {switch ($unit) {case 'hour':case 'hours':- return CarbonInterval::hours($value);+ $result = CarbonInterval::hours($value);case 'day':case 'days':- return CarbonInterval::hours($value * 24);+ $result = CarbonInterval::hours($value * 24);case 'week':case 'weeks':- return CarbonInterval::hours($value * 24 * 7);+ $result = CarbonInterval::hours($value * 24 * 7);case 'month':case 'months':- return CarbonInterval::hours($value * 24 * 30);+ $result = CarbonInterval::hours($value * 24 * 30);case 'year':case 'years':- return CarbonInterval::hours($value * 24 * 365);+ $result = CarbonInterval::hours($value * 24 * 365);default:- return CarbonInterval::hours(1);+ $result = CarbonInterval::hours(1);}- // return CarbonInterval::createFromDateString($this->period);- // return CarbonInterval::hours(match ($this->period) {- // '6_hours' => 6,- // '24_hours' => 24,- // '7_days' => 168,- // default => 1,- // });++ return $result;}/**diff --git a/bootstrap/app.php b/bootstrap/app.phpindex dd7e885c..d6cf600e 100755--- a/bootstrap/app.php+++ b/bootstrap/app.php@@ -37,6 +37,6 @@ return Application::configure(basePath: dirname(__DIR__))'auth' => Authenticate::class,]);})- ->withExceptions(function (Exceptions $exceptions) {+ ->withExceptions(function (Exceptions $_) {//})->create();diff --git a/config/database.php b/config/database.phpindex 029ebceb..311c5848 100755--- a/config/database.php+++ b/config/database.php@@ -2,6 +2,8 @@use Illuminate\Support\Str;+const LOCALHOST = '127.0.0.1';+return [/*@@ -45,7 +47,7 @@ return ['mysql' => ['driver' => 'mysql','url' => env('DB_URL'),- 'host' => env('DB_HOST', '127.0.0.1'),+ 'host' => env('DB_HOST', LOCALHOST),'port' => env('DB_PORT', '3306'),'database' => env('DB_DATABASE', 'laravel'),'username' => env('DB_USERNAME', 'root'),@@ -65,7 +67,7 @@ return ['mariadb' => ['driver' => 'mariadb','url' => env('DB_URL'),- 'host' => env('DB_HOST', '127.0.0.1'),+ 'host' => env('DB_HOST', LOCALHOST),'port' => env('DB_PORT', '3306'),'database' => env('DB_DATABASE', 'laravel'),'username' => env('DB_USERNAME', 'root'),@@ -85,7 +87,7 @@ return ['pgsql' => ['driver' => 'pgsql','url' => env('DB_URL'),- 'host' => env('DB_HOST', '127.0.0.1'),+ 'host' => env('DB_HOST', LOCALHOST),'port' => env('DB_PORT', '5432'),'database' => env('DB_DATABASE', 'laravel'),'username' => env('DB_USERNAME', 'root'),@@ -152,7 +154,7 @@ return ['default' => ['url' => env('REDIS_URL'),- 'host' => env('REDIS_HOST', '127.0.0.1'),+ 'host' => env('REDIS_HOST', LOCALHOST),'username' => env('REDIS_USERNAME'),'password' => env('REDIS_PASSWORD'),'port' => env('REDIS_PORT', '6379'),@@ -161,7 +163,7 @@ return ['cache' => ['url' => env('REDIS_URL'),- 'host' => env('REDIS_HOST', '127.0.0.1'),+ 'host' => env('REDIS_HOST', LOCALHOST),'username' => env('REDIS_USERNAME'),'password' => env('REDIS_PASSWORD'),'port' => env('REDIS_PORT', '6379'),diff --git a/config/logging.php b/config/logging.phpindex df76c1fb..81104e20 100755--- a/config/logging.php+++ b/config/logging.php@@ -5,6 +5,8 @@ use Monolog\Handler\StreamHandler;use Monolog\Handler\SyslogUdpHandler;use Monolog\Processor\PsrLogMessageProcessor;+const DEFAULT_LOGS_PATH = 'logs/';+return [/*@@ -60,14 +62,14 @@ return ['single' => ['driver' => 'single',- 'path' => storage_path('logs/' . env('LOG_FILENAME', 'laravel.log')),+ 'path' => storage_path(env('LOG_PATH', DEFAULT_LOGS_PATH) . env('LOG_FILENAME', 'laravel.log')),'level' => env('LOG_LEVEL', 'debug'),'replace_placeholders' => true,],'daily' => ['driver' => 'daily',- 'path' => storage_path('logs/' . env('LOG_FILENAME', 'laravel.log')),+ 'path' => storage_path(env('LOG_PATH', DEFAULT_LOGS_PATH) . env('LOG_FILENAME', 'laravel.log')),'level' => env('LOG_LEVEL', 'debug'),'days' => env('LOG_DAILY_DAYS', 64),'replace_placeholders' => true,@@ -125,7 +127,7 @@ return [],'emergency' => [- 'path' => storage_path('logs/' . env('LOG_FILENAME', 'laravel.log')),+ 'path' => storage_path(env('LOG_PATH', DEFAULT_LOGS_PATH) . env('LOG_FILENAME', 'laravel.log')),],],diff --git a/config/pulse-api.php b/config/pulse-api.phpindex 30f47b2d..f342d975 100644--- a/config/pulse-api.php+++ b/config/pulse-api.php@@ -72,7 +72,7 @@ return ['resources' => PulseAPI::getDefaultResources()->merge([// Add your custom resources'requests' => RequestsResource::class,- // 'schedule' => ScheduleResource::class,+ 'schedule' => ScheduleResource::class,// PulseResourcesEnum::SERVERS->value => ServersResource::class,// PulseResourcesEnum::USAGE->value => UsageResource::class,// PulseResourcesEnum::QUEUES->value => QueueResource::class,diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.phpdeleted file mode 100755index 2ef33a16..00000000--- a/database/seeders/DatabaseSeeder.php+++ /dev/null@@ -1,21 +0,0 @@-<?php--namespace Database\Seeders;--// use Illuminate\Database\Console\Seeds\WithoutModelEvents;--use Illuminate\Database\Seeder;--class DatabaseSeeder extends Seeder {- /**- * Seed the application's database.- */- public function run(): void {- // \App\Models\User::factory(10)->create();-- // \App\Models\User::factory()->create([- // 'name' => 'Test User',- // 'email' => '[email protected]',- // ]);- }-}diff --git a/resources/js/components/cards/DashboardCard.vue b/resources/js/components/cards/DashboardCard.vueindex 88ae2542..d6e4dec1 100644--- a/resources/js/components/cards/DashboardCard.vue+++ b/resources/js/components/cards/DashboardCard.vue@@ -20,7 +20,8 @@ const props = withDefaults(<template><div:class="[- `flex col-span-full sm:col-span-${cols} row-span-${rows} flex-col gap-2 p-3 rounded-xl shadow-lg dark:bg-primary-dark-800/70 bg-white ring-1 ring-gray-900/5 w-full`,+ `flex col-span-full row-span-${rows} flex-col gap-2 p-3 rounded-xl shadow-lg dark:bg-primary-dark-800/70 bg-white ring-1 ring-gray-900/5 w-full`,+ `${parseInt(`${cols}`) < 3 ? `sm:col-span-2 lg:col-span-${cols}` : `lg:col-span-${cols}`}`,props.class,]">@@ -31,8 +32,8 @@ const props = withDefaults(<slot name="icon"></slot></div><hgroup class="flex flex-wrap items-baseline gap-x-2 overflow-hidden">- <h2 class="text-base font-bold text-gray-600 dark:text-neutral-300 truncate" :title="props.title">- {{ props.name }}+ <h2 class="text-base font-bold text-gray-600 dark:text-neutral-300 truncate" :title="title">+ {{ name }}</h2><p v-if="props.details" class="text-gray-600/80 dark:text-neutral-400/80 font-medium truncate"><small class="text-xs">{{ props.details }}</small>diff --git a/resources/js/components/pulse/PulseNoResults.vue b/resources/js/components/pulse/PulseNoResults.vueindex 0b760791..1ef50969 100644--- a/resources/js/components/pulse/PulseNoResults.vue+++ b/resources/js/components/pulse/PulseNoResults.vue@@ -12,7 +12,6 @@ defineProps<{ isLoading?: boolean }>();},]">- {{ isLoading }}<IconNoPulse class="h-8 w-8 stroke-gray-300 dark:stroke-gray-600" /><p class="mt-2 text-sm text-gray-400 dark:text-gray-500">No results</p></div>diff --git a/resources/js/service/util.ts b/resources/js/service/util.tsindex 7dfce0a7..b9b6d24e 100644--- a/resources/js/service/util.ts+++ b/resources/js/service/util.ts@@ -72,7 +72,7 @@ export function toFormattedDate(}export function toFormattedDuration(rawSeconds: number = 0, leadingZero: boolean = true, format: 'digital' | 'analog' | 'verbose' = 'analog') {- if (isNaN(parseInt(rawSeconds?.toString() ?? '0'))) return null;+ if (isNaN(Number(rawSeconds))) return null;const hours = Math.floor(rawSeconds / 3600);const minutes = Math.floor((rawSeconds % 3600) / 60);@@ -83,9 +83,24 @@ export function toFormattedDuration(rawSeconds: number = 0, leadingZero: booleanconst secondsText = format === 'verbose' ? ` second${toPlural(seconds)}` : 's';if (format === 'digital') {- return `${hours > 0 ? `${formatInteger(hours)}:` : ''}${formatInteger(minutes)}:${formatInteger(seconds)}`;+ const parts = [hours > 0 ? formatInteger(hours) : null, formatInteger(minutes), formatInteger(seconds)].filter(Boolean);+ return parts.join(':');}- return `${hours > 0 ? `${hours}${hoursText} ` : ''}${minutes > 0 ? `${minutes}${minutesText} ` : ''}${`${leadingZero ? formatInteger(seconds) : `${seconds}`}${secondsText}`}`;++ const parts: string[] = [];++ if (hours > 0) {+ parts.push(`${hours}${hoursText}`);+ }++ if (minutes > 0 || hours > 0) {+ parts.push(`${minutes}${minutesText}`);+ }++ const finalSeconds = leadingZero ? formatInteger(seconds) : `${seconds}`;+ parts.push(`${finalSeconds}${secondsText}`);++ return parts.join(' ');}export function formatInteger(integer: number, minimumDigits = 2) {diff --git a/resources/js/stores/ContentStore.js b/resources/js/stores/ContentStore.jsindex f31d0d53..784040ef 100755--- a/resources/js/stores/ContentStore.js+++ b/resources/js/stores/ContentStore.js@@ -278,29 +278,31 @@ export const useContentStore = defineStore('Content', () => {return true;}+ // Video Resourceasync function updateVideoData(data) {if (!data) return;if (data.id === stateVideo.value.id) stateVideo.value = { ...stateVideo.value, ...data };+ const updatedVideos = stateFolder.value.videos.map((video) => (video.id === data.id ? { ...video, ...data } : video));+stateFolder.value = {...stateFolder.value,- videos: stateFolder.value.videos.map((video) => {- return video.id === data.id ? (data.id === stateVideo.value.id ? stateVideo.value : data) : video;- }),+ videos: updatedVideos,};}+ // Series Modelasync function updateFolderData(data) {if (!data) return;if (data.folder_id === stateFolder.value.id) stateFolder.value = { ...stateFolder.value, series: { ...data } };+ const updatedFolders = stateDirectory.value.folders.map((folder) => (folder.id === data.folder_id ? { ...folder, series: { ...data } } : folder));+stateDirectory.value = {...stateDirectory.value,- folders: stateDirectory.value.folders.map((folder) => {- return folder.id === data.folder_id ? { ...folder, series: { ...data } } : folder;- }),+ folders: updatedFolders,};}diff --git a/routes/channels.php b/routes/channels.phpindex 61aaebe2..a652d57d 100644--- a/routes/channels.php+++ b/routes/channels.php@@ -2,11 +2,11 @@use Illuminate\Support\Facades\Broadcast;-Broadcast::channel('tasks.{id}', function ($user, $id) {+Broadcast::channel('tasks.{id}', function ($user) {return (int) $user->id === 1;});-Broadcast::channel('tasks.{id}.subtasks', function ($user, $id) {+Broadcast::channel('tasks.{id}.subtasks', function ($user) {return (int) $user->id === 1;});