mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2025-02-18 00:02:02 +03:00
parent
a5d2fce65a
commit
6432dd9416
1 changed files with 11 additions and 1 deletions
|
@ -7,9 +7,19 @@ import { General } from '@/mixins'
|
||||||
export default {
|
export default {
|
||||||
name: 'MagnetHandler',
|
name: 'MagnetHandler',
|
||||||
mixins: [General],
|
mixins: [General],
|
||||||
|
methods: {
|
||||||
|
decodeMagnet(url) {
|
||||||
|
if (url.startsWith('magnet:?')) {
|
||||||
|
return url
|
||||||
|
} else {
|
||||||
|
return this.decodeMagnet(decodeURIComponent(url))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
const regex = new RegExp('^\/download\=(.+?)(?:\/(?=$))?$', 'is')
|
const regex = new RegExp('^\/download\=(.+?)(?:\/(?=$))?$', 'is')
|
||||||
this.createModal('AddModal', { initialMagnet: regex.exec(this.$route.fullPath)[1] })
|
let magnetLink = this.decodeMagnet(regex.exec(this.$route.fullPath)[1])
|
||||||
|
this.createModal('AddModal', { initialMagnet: magnetLink })
|
||||||
this.$router.push({ name: 'dashboard' })
|
this.$router.push({ name: 'dashboard' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue