A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
chore: code smells
aminnausin202ef1a1fbc2
diff --git a/resources/js/components/dashboard/DashboardLibraries.vue b/resources/js/components/dashboard/DashboardLibraries.vueindex 577c33c3..5d42c5e6 100644--- a/resources/js/components/dashboard/DashboardLibraries.vue+++ b/resources/js/components/dashboard/DashboardLibraries.vue@@ -179,7 +179,9 @@ const handleStartScan = async () => {try {await startScanFilesTask(stateLibraryId.value > 0 ? stateLibraryId.value : undefined);- toast.add('Success', { type: 'success', description: `Submitted scan request${cachedLibrary.value?.name ? ` for ${cachedLibrary.value.name}` : ''}!` });+ const scanMessage = `Submitted scan request${cachedLibrary.value?.name ? ` for ${cachedLibrary.value.name}` : ''}!`;++ toast.add('Success', { type: 'success', description: scanMessage });} catch (error) {toast('Failure', { type: 'danger', description: `Unable to submit scan request.` });console.error(error);diff --git a/resources/js/components/video/VideoLyrics.vue b/resources/js/components/video/VideoLyrics.vueindex c17dfabe..3584b01f 100644--- a/resources/js/components/video/VideoLyrics.vue+++ b/resources/js/components/video/VideoLyrics.vue@@ -1,6 +1,5 @@<script setup lang="ts">-import { computed, onMounted, onUnmounted, ref, useTemplateRef, watch } from 'vue';-import { nextTick } from 'vue';+import { computed, onMounted, onUnmounted, ref, useTemplateRef, watch, nextTick } from 'vue';interface NumericLyricLine {text: string;@@ -8,7 +7,7 @@ interface NumericLyricLine {percentage: number;}-const emit = defineEmits<{ (event: 'seek', value: number): void }>();+const emit = defineEmits<{ seek: [value: number] }>();const props = defineProps<{ rawLyrics: string; timeElapsed: string | number; timeDuration: number; isPaused: boolean }>();const numericLyrics = ref<NumericLyricLine[]>();diff --git a/resources/js/components/video/VideoPlayer.vue b/resources/js/components/video/VideoPlayer.vueindex a868ec07..9c40fcef 100755--- a/resources/js/components/video/VideoPlayer.vue+++ b/resources/js/components/video/VideoPlayer.vue@@ -229,14 +229,26 @@ const videoPopoverItems = computed(() => {},},{- text: isAudio.value ? 'Lyrics' : 'Captions',- title: `Toggle ${isAudio.value ? 'Lyrics' : 'Captions'}`,- icon: isShowingLyrics.value ? (isAudio.value ? TablerMicrophone2 : LucideCaptions) : isAudio.value ? TablerMicrophone2Off : LucideCaptionsOff,- iconStyle: `${isAudio.value ? '[&>*]:stroke-[1.4px]' : ''}`,+ text: 'Captions',+ title: `Toggle Captions`,+ icon: isShowingLyrics.value ? LucideCaptions : LucideCaptionsOff,selectedIcon: ProiconsCheckmark,selected: isShowingLyrics.value ?? false,selectedIconStyle: 'text-purple-600 stroke-none',- disabled: getScreenSize() !== 'default',+ disabled: getScreenSize() !== 'default' || isAudio.value,+ action: () => {+ isShowingLyrics.value = !isShowingLyrics.value;+ },+ },+ {+ text: 'Lyrics',+ title: `Toggle Lyrics`,+ icon: isShowingLyrics.value ? TablerMicrophone2 : TablerMicrophone2Off,+ iconStyle: `[&>*]:stroke-[1.4px]`,+ selectedIcon: ProiconsCheckmark,+ selected: isShowingLyrics.value ?? false,+ selectedIconStyle: 'text-purple-600 stroke-none',+ disabled: getScreenSize() !== 'default' || !isAudio.value,action: () => {isShowingLyrics.value = !isShowingLyrics.value;},@@ -389,8 +401,10 @@ const onPlayerPlay = async (override = false, recordProgress = true) => {if (!player.value || !stateVideo.value.id) return;if (isLoading.value) {+ const description = stateVideo.value.metadata?.codec ? ` Make sure your browser supports the format "${stateVideo.value.metadata.codec}"` : '';+toast.warning(`Content still loading...`, {- description: `${stateVideo.value.metadata?.codec ? ` Make sure your browser supports the format "${stateVideo.value.metadata.codec}"` : ''}`,+ description,});onPlayerPause();return;diff --git a/resources/js/service/sort/baseSort.test.ts b/resources/js/service/sort/baseSort.test.tsindex fa079dba..da41f19b 100644--- a/resources/js/service/sort/baseSort.test.ts+++ b/resources/js/service/sort/baseSort.test.ts@@ -12,9 +12,9 @@ test('CompareStrategies.episode sorts by season and episode', () => {{ id: 4, name: '4', path: '/4', date: '', video_tags: [], season: 1, episode: 2 },];- const sorted = videos.sort(sortObjectNew([{ compareFn: CompareStrategies.episode }]));+ videos.sort(sortObjectNew([{ compareFn: CompareStrategies.episode }]));- expect(sorted).toEqual([+ expect(videos).toEqual([{ id: 2, name: '2', path: '/2', date: '', video_tags: [], season: 1, episode: 1 },{ id: 4, name: '4', path: '/4', date: '', video_tags: [], season: 1, episode: 2 },{ id: 3, name: '3', path: '/3', date: '', video_tags: [], season: 2, episode: 1 },