Skip to content

A self-hosted media server and file management system

make videos middle clickable to open in new tab and fix external dropdown links not opening in new tabs

aminnausin891a1b3e971c
diff --git a/app/Http/Controllers/DirectoryController.php b/app/Http/Controllers/DirectoryController.php
index 16e84c4c..e97a74d5 100644
--- a/app/Http/Controllers/DirectoryController.php
+++ b/app/Http/Controllers/DirectoryController.php
@@ -170,7 +170,7 @@ class DirectoryController extends Controller
}
Bus::batch($jobs)->dispatch();
- dump('This job has not web output. Check console for updates.');
+ dump('This job has no web output. Check queue listener console for updates.');
} catch (\Throwable $th) {
dump('Error cannot verify file metadata');
dump($th);
diff --git a/database/migrations/2024_02_13_040026_create_tasks_table.php b/database/migrations/2024_02_13_040026_create_tasks_table.php
deleted file mode 100644
index 5477462e..00000000
--- a/database/migrations/2024_02_13_040026_create_tasks_table.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-return new class extends Migration
-{
- /**
- * Run the migrations.
- */
- public function up(): void
- {
- Schema::create('tasks', function (Blueprint $table) {
- $table->id();
- $table->timestamps();
- });
- }
-
- /**
- * Reverse the migrations.
- */
- public function down(): void
- {
- Schema::dropIfExists('tasks');
- }
-};
diff --git a/resources/js/components/cards/VideoCard.vue b/resources/js/components/cards/VideoCard.vue
index 0a5a07cd..063b477b 100644
--- a/resources/js/components/cards/VideoCard.vue
+++ b/resources/js/components/cards/VideoCard.vue
@@ -2,25 +2,28 @@
import useMetaData from '../../composables/useMetaData';
import { watch } from 'vue';
+import { RouterLink } from 'vue-router';
const props = defineProps(['data', 'index', 'currentID']);
-const metaData = useMetaData(props.data?.attributes);
+const metaData = useMetaData({ ...props.data?.attributes, id: props.data.id, skipBaseURL: true });
const emit = defineEmits(['clickAction']);
const handlePlay = () => {
emit('clickAction', props.data?.id);
}
const handlePropsUpdate = () => {
- metaData.updateData(props.data?.attributes);
+ metaData.updateData({ ...props.data?.attributes, id: props.data.id, skipBaseURL: true });
}
-watch(props, handlePropsUpdate, {immediate: true});
+watch(props, handlePropsUpdate, { immediate: true });
</script>
<template>
- <div :class="{ 'ring-violet-600/70 ring-[0.125rem]': (props?.currentID === props.data?.id) }"
- class="flex flex-wrap flex-col sm:flex-row sm:flex-nowrap gap-x-8 gap-y-4 p-3 w-full shadow rounded-md ring-inset dark:bg-primary-dark-800/70 dark:hover:bg-violet-700/70 bg-gray-100 hover:bg-violet-400/30 odd:bg-violet-100 dark:odd:bg-primary-dark-600"
- :data-id="props.data?.id" :data-path="`../${props.data?.attributes.path}`" @click="handlePlay">
+ <RouterLink :class="{ 'ring-violet-600/70 ring-[0.125rem]': (props?.currentID === props.data?.id) }"
+ :to="metaData.fields.url"
+ class="flex flex-wrap flex-col sm:flex-row sm:flex-nowrap gap-x-8 gap-y-4 p-3 w-full shadow rounded-md ring-inset cursor-pointer dark:bg-primary-dark-800/70 dark:hover:bg-violet-700/70 bg-gray-100 hover:bg-violet-400/30 odd:bg-violet-100 dark:odd:bg-primary-dark-600"
+ :data-id="props.data?.id" :data-path="`../${props.data?.attributes.path}`"
+ @click.left.stop.prevent.capture="handlePlay">
<section class="flex justify-between gap-4 w-full items-start sm:items-center">
<h3 class="w-full line-clamp-2 sm:line-clamp-1">
{{ metaData?.fields?.title }}
@@ -29,13 +32,14 @@ watch(props, handlePropsUpdate, {immediate: true});
{{ metaData?.fields?.views }}
</h3>
</section>
- <section class="text-sm sm:text-base flex justify-between sm:w-auto items-center dark:text-neutral-300 text-neutral-500 gap-8">
+ <section
+ class="text-sm sm:text-base flex justify-between sm:w-auto items-center dark:text-neutral-300 text-neutral-500 gap-8">
<h3 class="text-nowrap">
- {{ metaData?.fields?.duration }}
+ {{ metaData?.fields?.duration }}
</h3>
<h3 class="line-clamp-1 sm:min-w-40">
{{ props.data?.attributes.date }}
</h3>
</section>
- </div>
+ </RouterLink>
</template>
\ No newline at end of file
diff --git a/resources/js/components/pinesUI/DropdownItem.vue b/resources/js/components/pinesUI/DropdownItem.vue
index 73707f9a..bca16c84 100644
--- a/resources/js/components/pinesUI/DropdownItem.vue
+++ b/resources/js/components/pinesUI/DropdownItem.vue
@@ -4,7 +4,7 @@ const { linkData, selected, external } = defineProps(['linkData', 'selected', 'e
</script>
<template>
<a v-if="external"
- :class="{ 'font-bold text-violet-500': selected}" :href="linkData.url"
+ :class="{ 'font-bold text-violet-500': selected}" :href="linkData.url" target="_blank"
class="cursor-pointer relative w-full flex select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
<slot name="icon">
<span width="24" height="24" viewBox="0 0 24 24"
diff --git a/resources/js/composables/useMetaData.js b/resources/js/composables/useMetaData.js
index 9e0964cd..de19c5ca 100644
--- a/resources/js/composables/useMetaData.js
+++ b/resources/js/composables/useMetaData.js
@@ -13,14 +13,14 @@ export default function useMetaData(data) {
duration: toFormattedDuration(data?.duration) ?? 'N/A',
views: data?.view_count ? `${data?.view_count} View${data?.view_count !== 1 ? 's' : ''}` : '0 Views',
description: data.description ?? '',
- url: document.location.origin + route.path + `?video=${data.id}`,
+ url: (data?.skipBaseURL ? '' : document.location.origin) + route.path + `?video=${data.id}`,
},
updateData(props){
this.fields.title = props?.title ?? props?.name,
this.fields.duration = toFormattedDuration(props?.duration) ?? 'N/A',
this.fields.views = props?.view_count ? `${props?.view_count} View${props?.view_count !== 1 ? 's' : ''}` : '0 Views',
this.fields.description = props?.description ?? '',
- this.fields.url = document.location.origin + route.path + `?video=${props.id}`
+ this.fields.url = (props?.skipBaseURL ? '' : document.location.origin) + route.path + `?video=${props.id}`
}
});
}
\ No newline at end of file