Skip to content

A self-hosted media server and file management system

fix copy to clipboard timeout and verify folder urls

aminnausinf14d5630dfcc
diff --git a/app/Jobs/VerifyFolders.php b/app/Jobs/VerifyFolders.php
index f1d0a045..cbfc40e7 100644
--- a/app/Jobs/VerifyFolders.php
+++ b/app/Jobs/VerifyFolders.php
@@ -100,7 +100,7 @@ class VerifyFolders implements ShouldQueue {
$changes['title'] = $folder->name;
}
- if (isset($series->thumbnail_url) && ! strpos($series->thumbnail_url, env('APP_URL'))) {
+ if (isset($series->thumbnail_url) && ! strpos($series->thumbnail_url, str_replace('http://', '', str_replace('https://', '', env('APP_URL'))))) {
dump('Getting thumbnail');
$response = Http::get($series->thumbnail_url);
if ($response->successful()) {
diff --git a/resources/js/components/pinesUI/ButtonClipboard.vue b/resources/js/components/pinesUI/ButtonClipboard.vue
index aad95e7f..879df1d4 100755
--- a/resources/js/components/pinesUI/ButtonClipboard.vue
+++ b/resources/js/components/pinesUI/ButtonClipboard.vue
@@ -1,8 +1,32 @@
-<script setup>
-import useClipboard from '@/composables/useClipboard';
-import ButtonIcon from '../inputs/ButtonIcon.vue';
+<script setup lang="ts">
+import { toast } from '@/service/toaster/toastService';
+import { ref } from 'vue';
+
+import ButtonIcon from '@/components/inputs/ButtonIcon.vue';
+
const props = defineProps(['text', 'tabindex']);
-const clipboard = useClipboard(props.text);
+
+const copyTimeout = ref<null | number>(null);
+const copyNotification = ref(false);
+const copyText = ref('');
+
+const copyToClipboard = async () => {
+ try {
+ await navigator.clipboard.writeText(copyText.value);
+ copyNotification.value = true;
+ if (copyTimeout.value !== null) clearTimeout(copyTimeout.value);
+ copyTimeout.value = setTimeout(function () {
+ copyNotification.value = false;
+ }, 3000);
+ } catch (error) {
+ console.log(error);
+ toast.add('Error', {
+ type: 'danger',
+ description: 'Unable to copy. Network is not secure.',
+ life: 3000,
+ });
+ }
+};
</script>
<template>
@@ -21,7 +45,7 @@ const clipboard = useClipboard(props.text);
leave-from-class="opacity-100 translate-x-0"
leave-to-class="opacity-0 translate-x-2"
>
- <div v-if="clipboard.copyNotification" class="absolute left-0" v-cloak>
+ <div v-if="copyNotification" class="absolute left-0" v-cloak>
<div class="px-3 h-7 -ml-1.5 items-center flex text-xs bg-green-500 border-r border-green-500 -translate-x-full text-white rounded">
<span>Copied!</span>
<div class="absolute right-0 inline-block h-full -mt-px overflow-hidden translate-x-3 -translate-y-2 top-1/2">
@@ -31,13 +55,13 @@ const clipboard = useClipboard(props.text);
</div>
</Transition>
<ButtonIcon
- @click="clipboard.copyToClipboard()"
+ @click="copyToClipboard()"
:tabindex="props.tabindex ?? 1"
class="flex items-center justify-center h-8 w-9 text-xs group text-neutral-500 hover:text-neutral-600 dark:text-gray-300 dark:hover:text-gray-400 hover:bg-neutral-100 focus:!ring-green-600/50"
>
<template #icon>
<svg
- v-if="clipboard.copyNotification"
+ v-if="copyNotification"
class="w-4 h-4 text-green-500 stroke-current"
xmlns="http://www.w3.org/2000/svg"
fill="none"
@@ -48,7 +72,7 @@ const clipboard = useClipboard(props.text);
>
<path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" />
</svg>
- <svg v-if="!clipboard.copyNotification" class="w-4 h-4 stroke-current" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
+ <svg v-if="!copyNotification" class="w-4 h-4 stroke-current" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<g fill="none" stroke="none">
<path
d="M7.75 7.757V6.75a3 3 0 0 1 3-3h6.5a3 3 0 0 1 3 3v6.5a3 3 0 0 1-3 3h-.992"