fix: 🐛 fix all small bugs

This commit is contained in:
Michel Roux 2024-09-14 16:04:25 +02:00
parent 1e1bb03c23
commit 23280d68b9
7 changed files with 65 additions and 65 deletions

View File

@ -1,7 +1,7 @@
module.exports = {
extends: [
'@nextcloud',
'@vue/eslint-config-typescript',
'@vue/eslint-config-typescript/recommended',
'plugin:pinia/recommended',
'plugin:prettier/recommended',
],

56
package-lock.json generated
View File

@ -15,7 +15,6 @@
"@nextcloud/vue": "9.0.0-alpha.5",
"dompurify": "^3.1.6",
"linkify-html": "^4.1.3",
"petite-utils": "^0.0.5-3",
"pinia": "^2.2.2",
"toastify-js": "^1.12.0",
"vite": "^5.4.5",
@ -36,7 +35,7 @@
"eslint-plugin-pinia": "^0.4.1",
"eslint-plugin-prettier": "^5.2.1",
"ts-node": "^10.9.2",
"typescript": "5.5.4",
"typescript": "5.5",
"vue-eslint-parser": "^9.4.3",
"vue-tsc": "^2.1.6"
}
@ -2272,9 +2271,9 @@
"integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g=="
},
"node_modules/@types/node": {
"version": "22.5.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz",
"integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==",
"version": "22.5.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.5.tgz",
"integrity": "sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==",
"devOptional": true,
"peer": true,
"dependencies": {
@ -2550,29 +2549,29 @@
}
},
"node_modules/@volar/typescript": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.4.4.tgz",
"integrity": "sha512-QQMQRVj0fVHJ3XdRKiS1LclhG0VBXdFYlyuHRQF/xLk2PuJuHNWP26MDZNvEVCvnyUQuUQhIAfylwY5TGPgc6w==",
"version": "2.4.5",
"resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.4.5.tgz",
"integrity": "sha512-mcT1mHvLljAEtHviVcBuOyAwwMKz1ibXTi5uYtP/pf4XxoAzpdkQ+Br2IC0NPCvLCbjPZmbf3I0udndkfB1CDg==",
"dev": true,
"dependencies": {
"@volar/language-core": "2.4.4",
"@volar/language-core": "2.4.5",
"path-browserify": "^1.0.1",
"vscode-uri": "^3.0.8"
}
},
"node_modules/@volar/typescript/node_modules/@volar/language-core": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.4.tgz",
"integrity": "sha512-kO9k4kTLfxpg+6lq7/KAIv3m2d62IHuCL6GbVgYZTpfKvIGoAIlDxK7pFcB/eczN2+ydg/vnyaeZ6SGyZrJw2w==",
"version": "2.4.5",
"resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.5.tgz",
"integrity": "sha512-F4tA0DCO5Q1F5mScHmca0umsi2ufKULAnMOVBfMsZdT4myhVl4WdKRwCaKcfOkIEuyrAVvtq1ESBdZ+rSyLVww==",
"dev": true,
"dependencies": {
"@volar/source-map": "2.4.4"
"@volar/source-map": "2.4.5"
}
},
"node_modules/@volar/typescript/node_modules/@volar/source-map": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.4.tgz",
"integrity": "sha512-xG3PZqOP2haG8XG4Pg3PD1UGDAdqZg24Ru8c/qYjYAnmcj6GBR64mstx+bZux5QOyRaJK+/lNM/RnpvBD3489g==",
"version": "2.4.5",
"resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.5.tgz",
"integrity": "sha512-varwD7RaKE2J/Z+Zu6j3mNNJbNT394qIxXwdvz/4ao/vxOfyClZpSDtLKkwWmecinkOVos5+PWkWraelfMLfpw==",
"dev": true
},
"node_modules/@vue/babel-helper-vue-transform-on": {
@ -4401,9 +4400,9 @@
}
},
"node_modules/electron-to-chromium": {
"version": "1.5.22",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.22.tgz",
"integrity": "sha512-tKYm5YHPU1djz0O+CGJ+oJIvimtsCcwR2Z9w7Skh08lUdyzXY5djods3q+z2JkWdb7tCcmM//eVavSRAiaPRNg=="
"version": "1.5.23",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.23.tgz",
"integrity": "sha512-mBhODedOXg4v5QWwl21DjM5amzjmI1zw9EPrPK/5Wx7C8jt33bpZNrC7OhHUG3pxRtbLpr3W2dXT+Ph1SsfRZA=="
},
"node_modules/elliptic": {
"version": "6.5.7",
@ -8788,11 +8787,6 @@
"resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz",
"integrity": "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA=="
},
"node_modules/petite-utils": {
"version": "0.0.5-3",
"resolved": "https://registry.npmjs.org/petite-utils/-/petite-utils-0.0.5-3.tgz",
"integrity": "sha512-oeuwgChhxtYMuxyaHzSo8aoix+pjTKBnHlii04uMRhUIaazCCCG4NAkGwdpnvgfdYE2ajVhnARoFtdRujJuUjA=="
},
"node_modules/picocolors": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz",
@ -12038,18 +12032,18 @@
}
},
"node_modules/vue-tsc/node_modules/@volar/language-core": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.4.tgz",
"integrity": "sha512-kO9k4kTLfxpg+6lq7/KAIv3m2d62IHuCL6GbVgYZTpfKvIGoAIlDxK7pFcB/eczN2+ydg/vnyaeZ6SGyZrJw2w==",
"version": "2.4.5",
"resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.5.tgz",
"integrity": "sha512-F4tA0DCO5Q1F5mScHmca0umsi2ufKULAnMOVBfMsZdT4myhVl4WdKRwCaKcfOkIEuyrAVvtq1ESBdZ+rSyLVww==",
"dev": true,
"dependencies": {
"@volar/source-map": "2.4.4"
"@volar/source-map": "2.4.5"
}
},
"node_modules/vue-tsc/node_modules/@volar/source-map": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.4.tgz",
"integrity": "sha512-xG3PZqOP2haG8XG4Pg3PD1UGDAdqZg24Ru8c/qYjYAnmcj6GBR64mstx+bZux5QOyRaJK+/lNM/RnpvBD3489g==",
"version": "2.4.5",
"resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.5.tgz",
"integrity": "sha512-varwD7RaKE2J/Z+Zu6j3mNNJbNT394qIxXwdvz/4ao/vxOfyClZpSDtLKkwWmecinkOVos5+PWkWraelfMLfpw==",
"dev": true
},
"node_modules/vue-tsc/node_modules/@vue/language-core": {

View File

@ -22,7 +22,6 @@
"@nextcloud/vue": "9.0.0-alpha.5",
"dompurify": "^3.1.6",
"linkify-html": "^4.1.3",
"petite-utils": "^0.0.5-3",
"pinia": "^2.2.2",
"toastify-js": "^1.12.0",
"vite": "^5.4.5",
@ -43,7 +42,7 @@
"eslint-plugin-pinia": "^0.4.1",
"eslint-plugin-prettier": "^5.2.1",
"ts-node": "^10.9.2",
"typescript": "5.5.4",
"typescript": "5.5",
"vue-eslint-parser": "^9.4.3",
"vue-tsc": "^2.1.6"
},

View File

@ -41,7 +41,6 @@ import Loading from '../Atoms/Loading.vue'
import PlusIcon from 'vue-material-design-icons/Plus.vue'
import type { PodcastDataInterface } from '../../utils/types.ts'
import axios from '@nextcloud/axios'
import { debounce } from 'petite-utils'
import { formatLocaleDate } from '../../utils/time.ts'
import { generateUrl } from '@nextcloud/router'
import { showError } from '../../utils/toast.ts'
@ -67,36 +66,17 @@ export default {
data: () => ({
feeds: [] as PodcastDataInterface[],
loading: false,
timeout: null as NodeJS.Timeout | null,
}),
computed: {
...mapState(useSubscriptions, ['getSubByUrl']),
},
watch: {
value() {
const that = this
debounce(async function () {
try {
that.loading = true
const currentSearch = that.value
const feeds = await axios.get<PodcastDataInterface[]>(
generateUrl('/apps/repod/search?q={value}', {
value: currentSearch,
}),
)
if (currentSearch === that.value) {
that.feeds = [...feeds.data].sort(
(a, b) => b.fetchedAtUnix - a.fetchedAtUnix,
)
}
} catch (e) {
console.error(e)
showError(t('repod', 'Could not fetch search results'))
} finally {
if (that.feeds) {
that.loading = false
}
}
}, 200)
if (this.timeout) {
clearTimeout(this.timeout)
}
this.timeout = setTimeout(this.search, 200)
},
},
methods: {
@ -117,9 +97,31 @@ export default {
console.error(e)
showError(t('repod', 'Error while adding the feed'))
}
this.fetch()
},
async search() {
try {
this.loading = true
const currentSearch = this.value
const feeds = await axios.get<PodcastDataInterface[]>(
generateUrl('/apps/repod/search?q={value}', {
value: currentSearch,
}),
)
if (currentSearch === this.value) {
this.feeds = [...feeds.data].sort(
(a, b) => b.fetchedAtUnix - a.fetchedAtUnix,
)
}
} catch (e) {
console.error(e)
showError(t('repod', 'Could not fetch search results'))
} finally {
if (this.feeds) {
this.loading = false
}
}
},
},
}
</script>

View File

@ -91,7 +91,7 @@ export default {
},
),
)
this.addFavoriteData(podcastData.data.data)
this.addMetadatas(this.url, podcastData.data.data)
} catch (e) {
this.failed = true
console.error(e)
@ -100,7 +100,7 @@ export default {
}
},
methods: {
...mapActions(useSubscriptions, ['fetch', 'addFavoriteData', 'setFavorite']),
...mapActions(useSubscriptions, ['fetch', 'addMetadatas', 'setFavorite']),
t,
toFeedUrl,
async deleteSubscription() {

View File

@ -6,6 +6,11 @@ export const useSettings = defineStore('settings', {
state: () => {
try {
const filters = JSON.parse(getCookie('repod.filters') || '{}') || {}
if (!filters.length) {
throw new Error('Empty cookie')
}
return {
filters: {
listened: filters.listened,

View File

@ -34,13 +34,13 @@ export const useSubscriptions = defineStore('subscriptions', {
data: this.subs.find((s) => s.metrics.url === sub.url)?.data,
}))
},
addFavoriteData(data: PodcastDataInterface) {
addMetadatas(link: string, data: PodcastDataInterface) {
this.subs = this.subs.map((sub) =>
sub.metrics.url === data.link ? { ...sub, data } : sub,
sub.metrics.url === link ? { ...sub, data } : sub,
)
},
setFavorite(link: string, isFavorite: boolean) {
this.subs.map((sub) =>
this.subs = this.subs.map((sub) =>
sub.metrics.url === link ? { ...sub, isFavorite } : sub,
)