mirror of https://github.com/Kylart/KawAnime.git
Fix torrent opening from external when app already opened
This commit is contained in:
parent
eb4cb552aa
commit
f93a77f8ac
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "kawanime",
|
||||
"name": "KawAnime",
|
||||
"version": "0.4.0",
|
||||
"main": "background.js",
|
||||
"repository": "https://github.com/Kylart/KawAnime.git",
|
||||
|
|
|
@ -13,5 +13,7 @@ export default function (e, args) {
|
|||
|
||||
sendToWindows(eventsList.externalOpen.success, Array.isArray(args) ? args : [args])
|
||||
|
||||
setTimeout(BrowserWindow.getAllWindows()[0].focus, 100)
|
||||
setTimeout(() => {
|
||||
BrowserWindow.getAllWindows()[0].focus()
|
||||
}, 100)
|
||||
}
|
||||
|
|
|
@ -58,6 +58,8 @@ function createWindow () {
|
|||
|
||||
win.once('ready-to-show', () => {
|
||||
win.show()
|
||||
|
||||
if (process.argv.length) external(null, process.argv)
|
||||
})
|
||||
|
||||
win.on('close', () => {
|
||||
|
@ -87,6 +89,8 @@ if (!gotTheLock) {
|
|||
if (win) {
|
||||
if (win.isMinimized()) win.restore()
|
||||
win.focus()
|
||||
|
||||
if (process.argv.length) external(null, process.argv)
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -173,8 +177,6 @@ app.on('quit', () => {
|
|||
})
|
||||
})
|
||||
|
||||
if (process.argv.length) external(null, process.argv)
|
||||
|
||||
app.on('open-file', external)
|
||||
app.on('open-url', external)
|
||||
|
||||
|
|
|
@ -142,10 +142,10 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import NotFoundImage from '../../../public/images/not-found.png'
|
||||
import Episodes from '@/mixins/info/currentEps.js'
|
||||
|
||||
import { mapGetters } from 'vuex'
|
||||
import { join } from 'path'
|
||||
|
||||
export default {
|
||||
name: 'Info-Displayer',
|
||||
|
@ -242,7 +242,7 @@ export default {
|
|||
sanitize (link) {
|
||||
// This redirects unwanted picture links to fallback picture
|
||||
return /(questionmark)/.test(link)
|
||||
? join(process.env.BASE_URL, 'images', 'not-found.png')
|
||||
? NotFoundImage
|
||||
: link
|
||||
},
|
||||
openLink (link) {
|
||||
|
|
|
@ -44,6 +44,11 @@
|
|||
p Grabbing those data...
|
||||
p Please bear with us for a moment.
|
||||
|
||||
v-divider
|
||||
v-card-actions
|
||||
v-spacer
|
||||
v-btn(@click='back') Cancel
|
||||
|
||||
v-card(v-else)
|
||||
v-toolbar(dense, color='indigo')
|
||||
v-spacer
|
||||
|
@ -114,6 +119,7 @@ export default {
|
|||
this.isRemote = false
|
||||
},
|
||||
back () {
|
||||
this.searching = false
|
||||
this.current = null
|
||||
},
|
||||
getPictureUrl (url) {
|
||||
|
|
|
@ -32,7 +32,7 @@ export default {
|
|||
mounted () {
|
||||
const { app } = this.$electron.remote
|
||||
|
||||
this.isDefault = this.protocols.some((protocol) => app.isDefaultProtocolClient(protocol))
|
||||
this.isDefault = this.protocols.every((protocol) => app.isDefaultProtocolClient(protocol))
|
||||
},
|
||||
|
||||
computed: {
|
||||
|
|
|
@ -52,9 +52,12 @@ export default {
|
|||
|
||||
created () {
|
||||
this.$ipc.on(this.$eventsList.externalOpen.success, (e, args) => {
|
||||
const toAdd = args.filter((e) => ['magnet', '.torrent'].includes(e))
|
||||
const toAdd = args.filter(
|
||||
(e) => ['magnet:', '.torrent'].some((id) => e.includes(id))
|
||||
)
|
||||
|
||||
if (toAdd.length) {
|
||||
this.$log('External torrents opening', toAdd)
|
||||
this.addTorrentsFromPath(toAdd)
|
||||
this.show = true
|
||||
}
|
||||
|
|
|
@ -28,10 +28,6 @@ export default {
|
|||
Player
|
||||
},
|
||||
|
||||
beforeDestroy () {
|
||||
this.$ipc.send(this.$eventsList.video.close.main)
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
videoPort: null,
|
||||
|
|
Loading…
Reference in New Issue