A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
chore: code smells
aminnausin7b7e4effaf6c
diff --git a/app/Jobs/VerifyFiles.php b/app/Jobs/VerifyFiles.phpindex 1e8cbf8f..401519cf 100755--- a/app/Jobs/VerifyFiles.php+++ b/app/Jobs/VerifyFiles.php@@ -90,15 +90,12 @@ class VerifyFiles implements ShouldQueue {$summary = $this->verifyFiles();$endedAt = now();$duration = (int) $this->startedAt->diffInSeconds($endedAt);- // DB::table('tasks')->where('id', $this->taskId)->increment('sub_tasks_complete');if (count($this->embedChain)) {$this->taskService->updateTaskCounts($this->taskId, ['sub_tasks_complete' => '++', 'sub_tasks_total' => count($this->embedChain), 'sub_tasks_pending' => count($this->embedChain)]);foreach ($this->embedChain as $embedTask) {Bus::dispatch($embedTask);}- // $controller = new JobController($this->taskService);- // $controller->embedUIDs($this->taskId, "Embed UIDs for task $this->taskId via Verify Files", $this->embedChain);} else {$this->taskService->updateTaskCounts($this->taskId, ['sub_tasks_complete' => '++'], false);}diff --git a/app/Services/PreviewGeneratorService.php b/app/Services/PreviewGeneratorService.phpindex cc298447..dd1f375e 100644--- a/app/Services/PreviewGeneratorService.php+++ b/app/Services/PreviewGeneratorService.php@@ -79,15 +79,13 @@ class PreviewGeneratorService {}$disk->put($relativePath, $generatedImage);-- return VerifyFiles::getPathUrl($relativePath);} catch (\Throwable $th) { // Cannot catch the specific spatie/image exception since it throws a generic oneLog::warning('Error during OG image generation', ['error' => $th->getMessage()]);-- return file_exists($fullPath)- ? VerifyFiles::getPathUrl($relativePath)- : null;}++ return file_exists($fullPath)+ ? VerifyFiles::getPathUrl($relativePath)+ : null;}protected function buildFolderPreviewData(Category $category, ?Folder $folder, Request $request): array {diff --git a/resources/js/components/inputs/ToggleBase.vue b/resources/js/components/inputs/ToggleBase.vueindex 4c753970..e1e0be22 100755--- a/resources/js/components/inputs/ToggleBase.vue+++ b/resources/js/components/inputs/ToggleBase.vue@@ -7,7 +7,7 @@ const { name } = defineProps(['name']);<template><section class="toggle-switch shrink-0 flex flex-col"><label class="switch-label" :for="name">- <input type="checkbox" class="checkbox peer invisible text-white" :name="name" v-model="model" :checked="model" />+ <input type="checkbox" class="checkbox peer invisible text-white" :name="name" :id="name" v-model="model" :checked="model" /><span class="sliderBase peer-checked:!bg-white peer-checked:dark:!bg-neutral-50"></span></label></section>diff --git a/resources/js/components/panels/NavBar.vue b/resources/js/components/panels/NavBar.vueindex 61ec0e0b..3d0982ff 100755--- a/resources/js/components/panels/NavBar.vue+++ b/resources/js/components/panels/NavBar.vue@@ -38,7 +38,7 @@ const toggleDropdown = () => {class="flex gap-2 text-2xl hover:text-violet-600 items-center justify-center capitalize h-8"@click="toggleDropdown"aria-haspopup="menu"- :aria-expanded="showDropdown"+ :aria-expanded="showDropdown ? 'true' : 'false'"aria-controls="user-dropdown"><h2diff --git a/resources/js/components/pinesUI/InputMultiChip.vue b/resources/js/components/pinesUI/InputMultiChip.vueindex 9d82df1a..44b02349 100644--- a/resources/js/components/pinesUI/InputMultiChip.vue+++ b/resources/js/components/pinesUI/InputMultiChip.vue@@ -255,7 +255,7 @@ watch(role="combobox"aria-autocomplete="list"aria-controls="selectableItemsList"- :aria-expanded="select.selectOpen"+ :aria-expanded="select.selectOpen ? 'true' : 'false'":aria-activedescendant="lastActiveItemId ? `${lastActiveItemId}-${select.selectId}` : null"class="scroll-m-4"@keydown.enter.stop="handleCreate"@@ -299,7 +299,7 @@ watch(:tabindex="'0'"class="relative flex items-center focus:rounded-md h-full py-2 pl-8 cursor-pointer select-none data-[disabled=true]:opacity-50 data-[disabled=true]:pointer-events-none"role="option"- :aria-selected="select.selectableItemActive === item"+ :aria-selected="select.selectableItemActive === item ? 'true' : 'false'"><span class="block truncate">{{ item.name }}</span></li>diff --git a/resources/js/components/pinesUI/InputSelect.vue b/resources/js/components/pinesUI/InputSelect.vueindex ecf2de1d..9290e5a8 100755--- a/resources/js/components/pinesUI/InputSelect.vue+++ b/resources/js/components/pinesUI/InputSelect.vue@@ -225,7 +225,7 @@ watch(}"class="focus:rounded-md relative flex items-center h-full py-2 pl-8 cursor-pointer data-[disabled=true]:opacity-50 data-[disabled=true]:pointer-events-none"role="option"- :aria-selected="select.selectableItemIsActive(item) ?? false"+ :aria-selected="select.selectableItemIsActive(item) ? 'true' : 'false'"><svgv-if="diff --git a/resources/js/components/table/TableBase.vue b/resources/js/components/table/TableBase.vueindex a07ee0c4..82925309 100755--- a/resources/js/components/table/TableBase.vue+++ b/resources/js/components/table/TableBase.vue@@ -25,9 +25,7 @@ const props = withDefaults(defineProps<TableProps<T>>(), {noResultsMessage: 'No Results',});-const emit = defineEmits<{- (e: 'search', value: string): void;-}>();+const emit = defineEmits<(e: 'search', value: string) => void>();const tableData = useTable(props);const sortAscending = ref(props.startAscending);diff --git a/resources/js/components/video/VideoInfoPanel.vue b/resources/js/components/video/VideoInfoPanel.vueindex e5b1c3e7..fc80f540 100755--- a/resources/js/components/video/VideoInfoPanel.vue+++ b/resources/js/components/video/VideoInfoPanel.vue@@ -1,8 +1,9 @@<script setup lang="ts">-import type { FolderResource, UserResource, VideoResource } from '@/types/resources';+import type { FolderResource, VideoResource } from '@/types/resources';+import type { Ref } from 'vue';-import { computed, ref, useTemplateRef, watch, type Ref } from 'vue';import { handleStorageURL, toFormattedDate, toTimeSpan } from '@/service/util';+import { computed, ref, useTemplateRef, watch } from 'vue';import { getUserViewCount } from '@/service/mediaAPI';import { useContentStore } from '@/stores/ContentStore';import { useAuthStore } from '@/stores/AuthStore';diff --git a/resources/js/components/video/VideoPartyPanel.vue b/resources/js/components/video/VideoPartyPanel.vueindex b8898913..68494695 100644--- a/resources/js/components/video/VideoPartyPanel.vue+++ b/resources/js/components/video/VideoPartyPanel.vue@@ -1,10 +1,10 @@<script setup lang="ts">import type { UserResource } from '@/types/resources';-import { ref, type Ref } from 'vue';import { useAuthStore } from '@/stores/AuthStore';import { storeToRefs } from 'pinia';import { toast } from '@/service/toaster/toastService';+import { ref } from 'vue';import VideoPartyItem from '@/components/video/VideoPartyItem.vue';import VideoPopover from '@/components/video/VideoPopover.vue';diff --git a/resources/js/components/video/VideoPlayer.vue b/resources/js/components/video/VideoPlayer.vueindex fd85f112..f7feb01e 100755--- a/resources/js/components/video/VideoPlayer.vue+++ b/resources/js/components/video/VideoPlayer.vue@@ -1,5 +1,5 @@<script setup lang="ts">-import type { FolderResource, UserResource, VideoResource } from '@/types/resources';+import type { FolderResource, VideoResource } from '@/types/resources';import { type ContextMenuItem, type PopoverItem, MediaType } from '@/types/types';import type { Series } from '@/types/model';diff --git a/resources/js/composables/useMetaData.ts b/resources/js/composables/useMetaData.tsindex 8b2a2d7b..9e47b725 100644--- a/resources/js/composables/useMetaData.ts+++ b/resources/js/composables/useMetaData.ts@@ -13,7 +13,7 @@ export default function useMetaData(data: VideoResource, skipBaseURL: boolean =fields: {title: `${generateEpisodeTag(data)}${data?.title ?? data?.name}`,duration: toFormattedDuration(data?.duration) ?? 'N/A',- views: data?.view_count ? `${data?.view_count} view${data?.view_count !== 1 ? 's' : ''}` : '0 views',+ views: generateViewsTag(data?.view_count),description: data?.description ?? '',url: encodeURI((skipBaseURL ? '' : document.location.origin) + route.path + `?video=${data.id}`),file_size: data.file_size ? formatFileSize(data.file_size) : '',@@ -23,7 +23,7 @@ export default function useMetaData(data: VideoResource, skipBaseURL: boolean =...this.fields,title: `${generateEpisodeTag(props)}${props?.title ?? props?.name}`,duration: toFormattedDuration(props?.duration) ?? 'N/A',- views: props?.view_count ? `${props?.view_count} view${props?.view_count !== 1 ? 's' : ''}` : '0 views',+ views: generateViewsTag(props?.view_count),description: props?.description ?? '',url: encodeURI((skipBaseURL ? '' : document.location.origin) + route.path + `?video=${data.id}`),file_size: data.file_size ? formatFileSize(data.file_size) : '',@@ -35,5 +35,9 @@ export default function useMetaData(data: VideoResource, skipBaseURL: boolean =return episodeData.episode && episodeData.metadata?.media_type === MediaType.AUDIO ? `${episodeData.episode}. ` : '';}+ function generateViewsTag(viewCount: number = 0) {+ return `${viewCount} view${viewCount !== 1 ? 's' : ''}`;+ }+return metadata;}diff --git a/resources/js/service/mediaAPI.ts b/resources/js/service/mediaAPI.tsindex 3f4f98fb..46a5268c 100644--- a/resources/js/service/mediaAPI.ts+++ b/resources/js/service/mediaAPI.ts@@ -5,7 +5,6 @@Run and commit to database (store) -> ?? What does that mean?*/import type { MetadataStoreRequest, MetadataUpdateRequest, SeriesStoreRequest, SeriesUpdateRequest } from '@/types/requests';-import type { VideoResource } from '@/types/resources';import { API } from '@/service/api';diff --git a/resources/views/error.blade.php b/resources/views/error.blade.phpindex 9a7dfacd..65d92155 100755--- a/resources/views/error.blade.php+++ b/resources/views/error.blade.php@@ -12,4 +12,4 @@</div></div></main>-</x-app-layout>\ No newline at end of file+</x-app-layout>diff --git a/resources/views/home.blade.php b/resources/views/home.blade.phpindex d9ca0aad..5aa42a8b 100755--- a/resources/views/home.blade.php+++ b/resources/views/home.blade.php@@ -1,2 +1,2 @@<x-app-layout>-</x-app-layout>\ No newline at end of file+</x-app-layout>diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.phpindex 4849dfaf..5c014175 100755--- a/resources/views/layouts/app.blade.php+++ b/resources/views/layouts/app.blade.php@@ -83,4 +83,4 @@{{ $slot }}</body>-</html>\ No newline at end of file+</html>diff --git a/resources/views/og-media-preview.blade.php b/resources/views/og-media-preview.blade.phpindex a5397e49..092725ed 100644--- a/resources/views/og-media-preview.blade.php+++ b/resources/views/og-media-preview.blade.php@@ -50,4 +50,4 @@</section></body>-</html>\ No newline at end of file+</html>diff --git a/resources/views/og-preview.blade.php b/resources/views/og-preview.blade.phpindex 3d8ff60b..b197f15b 100644--- a/resources/views/og-preview.blade.php+++ b/resources/views/og-preview.blade.php@@ -85,4 +85,4 @@ return $json;@endif</body>-</html>\ No newline at end of file+</html>diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.phpindex 23187e79..b36e3be1 100755--- a/resources/views/welcome.blade.php+++ b/resources/views/welcome.blade.php@@ -1072,4 +1072,4 @@</div></body>-</html>\ No newline at end of file+</html>