mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2024-11-24 10:25:47 +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 {
|
||||
name: 'MagnetHandler',
|
||||
mixins: [General],
|
||||
methods: {
|
||||
decodeMagnet(url) {
|
||||
if (url.startsWith('magnet:?')) {
|
||||
return url
|
||||
} else {
|
||||
return this.decodeMagnet(decodeURIComponent(url))
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
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' })
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue