A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
vue queries
aminnausin0dcead5d79c8
diff --git a/package-lock.json b/package-lock.jsonindex 06c41ef4..6b4f2bb5 100755--- a/package-lock.json+++ b/package-lock.json@@ -8,6 +8,7 @@"@eslint/compat": "^1.2.0","@tailwindcss/aspect-ratio": "^0.4.2","@tailwindcss/forms": "^0.5.7",+ "@tanstack/vue-query": "^5.59.20","@vueuse/components": "^10.11.0","@vueuse/core": "^10.11.0","@vueuse/integrations": "^11.0.0",@@ -1108,6 +1109,83 @@"tailwindcss": ">=3.0.0 || >= 3.0.0-alpha.1"}},+ "node_modules/@tanstack/match-sorter-utils": {+ "version": "8.19.4",+ "resolved": "https://registry.npmjs.org/@tanstack/match-sorter-utils/-/match-sorter-utils-8.19.4.tgz",+ "integrity": "sha512-Wo1iKt2b9OT7d+YGhvEPD3DXvPv2etTusIMhMUoG7fbhmxcXCtIjJDEygy91Y2JFlwGyjqiBPRozme7UD8hoqg==",+ "license": "MIT",+ "dependencies": {+ "remove-accents": "0.5.0"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/tannerlinsley"+ }+ },+ "node_modules/@tanstack/query-core": {+ "version": "5.59.20",+ "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.59.20.tgz",+ "integrity": "sha512-e8vw0lf7KwfGe1if4uPFhvZRWULqHjFcz3K8AebtieXvnMOz5FSzlZe3mTLlPuUBcydCnBRqYs2YJ5ys68wwLg==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/tannerlinsley"+ }+ },+ "node_modules/@tanstack/vue-query": {+ "version": "5.59.20",+ "resolved": "https://registry.npmjs.org/@tanstack/vue-query/-/vue-query-5.59.20.tgz",+ "integrity": "sha512-kIs1GfXh7jVLycbnQDghfdrcvrZz5fxnMF7eAAp8O3ZfhHQWfP57DBXbOvww4Y+TI0EvVoh+hihX+LNFBGFKLg==",+ "license": "MIT",+ "dependencies": {+ "@tanstack/match-sorter-utils": "^8.15.1",+ "@tanstack/query-core": "5.59.20",+ "@vue/devtools-api": "^6.6.3",+ "vue-demi": "^0.14.10"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/tannerlinsley"+ },+ "peerDependencies": {+ "@vue/composition-api": "^1.1.2",+ "vue": "^2.6.0 || ^3.3.0"+ },+ "peerDependenciesMeta": {+ "@vue/composition-api": {+ "optional": true+ }+ }+ },+ "node_modules/@tanstack/vue-query/node_modules/vue-demi": {+ "version": "0.14.10",+ "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz",+ "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==",+ "hasInstallScript": true,+ "license": "MIT",+ "bin": {+ "vue-demi-fix": "bin/vue-demi-fix.js",+ "vue-demi-switch": "bin/vue-demi-switch.js"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/antfu"+ },+ "peerDependencies": {+ "@vue/composition-api": "^1.0.0-rc.1",+ "vue": "^3.0.0-0 || ^2.6.0"+ },+ "peerDependenciesMeta": {+ "@vue/composition-api": {+ "optional": true+ }+ }+ },"node_modules/@types/estree": {"version": "1.0.5","resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",@@ -3822,6 +3900,12 @@"node": ">=8.10.0"}},+ "node_modules/remove-accents": {+ "version": "0.5.0",+ "resolved": "https://registry.npmjs.org/remove-accents/-/remove-accents-0.5.0.tgz",+ "integrity": "sha512-8g3/Otx1eJaVD12e31UbJj1YzdtVvzH85HV7t+9MJYk/u3XmkOUJ5Ys9wQrf9PCPK8+xn4ymzqYCiZl6QWKn+A==",+ "license": "MIT"+ },"node_modules/resolve": {"version": "1.22.8","resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",diff --git a/package.json b/package.jsonindex 44ca5991..41506cc8 100755--- a/package.json+++ b/package.json@@ -31,6 +31,7 @@"@eslint/compat": "^1.2.0","@tailwindcss/aspect-ratio": "^0.4.2","@tailwindcss/forms": "^0.5.7",+ "@tanstack/vue-query": "^5.59.20","@vueuse/components": "^10.11.0","@vueuse/core": "^10.11.0","@vueuse/integrations": "^11.0.0",diff --git a/resources/js/app.js b/resources/js/app.jsindex a8720391..6f186b36 100755--- a/resources/js/app.js+++ b/resources/js/app.js@@ -1,6 +1,9 @@import './bootstrap';-import { createApp } from 'vue';++import { VueQueryPlugin } from '@tanstack/vue-query';import { createPinia } from 'pinia';+import { createApp } from 'vue';+import ToastService from './service/toastService';import router from './router';import App from './App.vue';@@ -11,4 +14,5 @@ const pinia = createPinia();application.use(router);application.use(pinia);application.use(ToastService);+application.use(VueQueryPlugin);application.mount('#app');diff --git a/resources/js/service/mediaAPI.ts b/resources/js/service/mediaAPI.tsindex 01719389..1a06bc24 100644--- a/resources/js/service/mediaAPI.ts+++ b/resources/js/service/mediaAPI.ts@@ -34,4 +34,7 @@ export default {getVideos(data: { folder_id: number }) {return API.get(`/videos?folder_id=${data.folder_id}`);},+ getTags() {+ return API.get('/tags');+ },};diff --git a/resources/js/service/mutations.ts b/resources/js/service/mutations.tsnew file mode 100644index 00000000..0883fd47--- /dev/null+++ b/resources/js/service/mutations.ts@@ -0,0 +1,32 @@+// export const useChangeSettings = () => {+// const queryClient = useQueryClient()+// return useMutation({+// mutationFn: handleToggleSettings,+// onError: () => {+// toast.error('Failed to update settings.')+// },+// onSuccess: (data, variable) => {+// //TODO: make the toast message more dynamic based on the variable.settings fields for instance+// console.log(variable)+// toast.success('Successfully updated settings.')+// },+// onSettled: async (data, error, variable) => {+// // TODO: Find the ID to go along with the queryKey for invalidating+// console.log(variable)+// await queryClient.invalidateQueries({+// queryKey: ['current-user'],+// })+// },+// })+// }++// export const handleToggleSettings = async (data: SettingToggleInput) => {+// try {+// const response = await axios.patch(`/account/settings/${data.accountId}/`, {+// setting_name: data.setting_name,+// })+// return response.data+// } catch (error) {+// console.error('Failed to toggle settings', error)+// }+// }diff --git a/resources/js/service/queries.ts b/resources/js/service/queries.tsnew file mode 100644index 00000000..e7885ad1--- /dev/null+++ b/resources/js/service/queries.ts@@ -0,0 +1,31 @@+import { useQuery } from '@tanstack/vue-query';+import mediaAPI from './mediaAPI';+export const useGetVideoTags = () => {+ return useQuery({+ queryKey: ['videoTags'],+ queryFn: () => {+ mediaAPI.getTags();+ },+ });+};++// export const useGetChatRoomMessagesQuery = (chat_id: number | null) => {+// return useInfiniteQuery({+// queryKey: ['chatroom-messages', chat_id],+// initialPageParam: `/chat/chatroom/${chat_id}/messages/?page=${1}`,+// getNextPageParam: (lastPage) => lastPage.next,+// queryFn: async ({ pageParam }: { pageParam: string }): Promise<PaginatedResponse<MessageResponse>> => {+// if (!chat_id)+// return {+// count: 0,+// total_pages: 0,+// page_size: 0,+// next: null,+// previous: null,+// results: [],+// };+// const response = await axios.get(pageParam);+// return response.data;+// },+// });+// };