feat: implemented link analyzer

This commit is contained in:
Roberto Tonino 2021-06-02 15:32:45 +02:00
parent f13f643baa
commit 72b78e35e9
5 changed files with 2145 additions and 2207 deletions

20
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "deemix-webui",
"version": "1.6.1",
"version": "1.6.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "deemix-webui",
"version": "1.6.1",
"version": "1.6.2",
"dependencies": {
"@vue/composition-api": "1.0.0-beta.21",
"flag-icon-css": "^3.5.0",
@ -30,7 +30,7 @@
"eslint": "7.23.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "3.3.1",
"node-sass": "^5.0.0",
"node-sass": "^6.0.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.2.1",
"prettier": "2.2.1",
@ -5446,9 +5446,9 @@
"dev": true
},
"node_modules/node-sass": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/node-sass/-/node-sass-5.0.0.tgz",
"integrity": "sha512-opNgmlu83ZCF792U281Ry7tak9IbVC+AKnXGovcQ8LG8wFaJv6cLnRlc6DIHlmNxWEexB5bZxi9SZ9JyUuOYjw==",
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/node-sass/-/node-sass-6.0.0.tgz",
"integrity": "sha512-GDzDmNgWNc9GNzTcSLTi6DU6mzSPupVJoStIi7cF3GjwSE9q1cVakbvAAVSt59vzUjV9JJoSZFKoo9krbjKd2g==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
@ -5473,7 +5473,7 @@
"node-sass": "bin/node-sass"
},
"engines": {
"node": ">=10"
"node": ">=12"
}
},
"node_modules/nopt": {
@ -15970,9 +15970,9 @@
"dev": true
},
"node-sass": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/node-sass/-/node-sass-5.0.0.tgz",
"integrity": "sha512-opNgmlu83ZCF792U281Ry7tak9IbVC+AKnXGovcQ8LG8wFaJv6cLnRlc6DIHlmNxWEexB5bZxi9SZ9JyUuOYjw==",
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/node-sass/-/node-sass-6.0.0.tgz",
"integrity": "sha512-GDzDmNgWNc9GNzTcSLTi6DU6mzSPupVJoStIi7cF3GjwSE9q1cVakbvAAVSt59vzUjV9JJoSZFKoo9krbjKd2g==",
"dev": true,
"requires": {
"async-foreach": "^0.1.3",

File diff suppressed because one or more lines are too long

View file

@ -102,6 +102,8 @@ import { defineComponent, ref } from '@vue/composition-api'
import { isValidURL } from '@/utils/utils'
import { sendAddToQueue } from '@/utils/downloads'
import { socket } from '@/utils/socket'
import { fetchData } from '@/utils/api'
import EventBus from '@/utils/EventBus'
export default defineComponent({
setup() {
@ -156,8 +158,27 @@ export default defineComponent({
}
if (isShowingAnalyzer) {
socket.emit('analyzeLink', term)
try {
const analyzedData = await fetchData('analyzeLink', { term })
const isError = !!analyzedData.errorCode
if (isError) {
throw new Error(analyzedData.errorMessage)
}
if (analyzedData.type === 'track') {
EventBus.$emit('analyze_track', analyzedData)
}
if (analyzedData.type === 'album') {
EventBus.$emit('analyze_album', analyzedData)
}
// socket.emit('analyzeLink', term)
return
} catch (error) {
console.error(error)
return
}
}
// ? Open downloads tab maybe?

View file

@ -134,10 +134,12 @@
</template>
<script>
/* eslint-disable camelcase */
import { socket } from '@/utils/socket'
import { convertDuration } from '@/utils/utils'
import { COUNTRIES } from '@/utils/countries'
import { sendAddToQueue } from '@/utils/downloads'
import EventBus from '@/utils/EventBus'
export default {
data() {
@ -153,8 +155,8 @@ export default {
}
},
mounted() {
socket.on('analyze_track', this.showTrack)
socket.on('analyze_album', this.showAlbum)
EventBus.$on('analyze_track', this.showTrack)
EventBus.$on('analyze_album', this.showAlbum)
socket.on('analyze_notSupported', this.notSupported)
},
methods: {

1577
yarn.lock

File diff suppressed because it is too large Load diff