1
0
Fork 0
mirror of https://github.com/VueTorrent/VueTorrent.git synced 2025-04-06 08:43:51 +03:00

fix(MagnetHandler): Don't show add dialog if not authenticated ()

This commit is contained in:
Rémi Marseault 2024-04-21 13:29:23 +02:00 committed by GitHub
parent 5384a2e1ed
commit a0cdffd380
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 7 deletions

View file

@ -111,7 +111,7 @@ watchEffect(() => {
<v-main> <v-main>
<router-view /> <router-view />
</v-main> </v-main>
<AddPanel /> <AddPanel v-if="authStore.isAuthenticated" />
<DnDZone /> <DnDZone />
</v-app> </v-app>
</template> </template>

View file

@ -6,14 +6,15 @@ import { useRoute, useRouter } from 'vue-router'
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const addTorrentStore = useAddTorrentStore()
const dialogStore = useDialogStore()
onBeforeMount(async () => { onBeforeMount(async () => {
const magnetLink = decodeURIComponent(route.params.url as string) const magnetLink = decodeURIComponent(route.params.url as string)
if (magnetLink.startsWith('magnet:')) { if (magnetLink.startsWith('magnet:')) {
const addTorrentStore = useAddTorrentStore()
addTorrentStore.isFirstInit = false addTorrentStore.isFirstInit = false
addTorrentStore.pushTorrentToQueue(magnetLink) addTorrentStore.pushTorrentToQueue(magnetLink)
useDialogStore().createDialog(AddTorrentDialog, {}) dialogStore.createDialog(AddTorrentDialog, {})
} }
await router.push({ name: 'dashboard' }) await router.push({ name: 'dashboard' })
}) })

View file

@ -34,10 +34,7 @@ export const routes: RouteRecordRaw[] = [
{ {
name: 'magnetHandler', name: 'magnetHandler',
path: '/magnet/:url', path: '/magnet/:url',
component: () => import('./MagnetHandler.vue'), component: () => import('./MagnetHandler.vue')
meta: {
public: true
}
}, },
{ {
name: 'login', name: 'login',