2020-02-16 18:30:00 +00:00
|
|
|
import Vue from 'vue'
|
2021-07-03 01:55:56 +00:00
|
|
|
import { mapActions, mapMutations } from 'vuex'
|
2020-08-24 19:50:03 +00:00
|
|
|
import { ObserveVisibility } from 'vue-observe-visibility'
|
2020-09-20 18:22:39 +00:00
|
|
|
import FtFlexBox from './components/ft-flex-box/ft-flex-box.vue'
|
2020-02-16 18:30:00 +00:00
|
|
|
import TopNav from './components/top-nav/top-nav.vue'
|
|
|
|
import SideNav from './components/side-nav/side-nav.vue'
|
2020-09-20 18:22:39 +00:00
|
|
|
import FtNotificationBanner from './components/ft-notification-banner/ft-notification-banner.vue'
|
|
|
|
import FtPrompt from './components/ft-prompt/ft-prompt.vue'
|
|
|
|
import FtButton from './components/ft-button/ft-button.vue'
|
2020-06-14 21:13:35 +00:00
|
|
|
import FtToast from './components/ft-toast/ft-toast.vue'
|
2020-08-31 21:35:22 +00:00
|
|
|
import FtProgressBar from './components/ft-progress-bar/ft-progress-bar.vue'
|
2020-02-16 18:30:00 +00:00
|
|
|
import $ from 'jquery'
|
2021-06-17 03:14:06 +00:00
|
|
|
import marked from 'marked'
|
2020-09-20 18:22:39 +00:00
|
|
|
import Parser from 'rss-parser'
|
2020-03-24 13:22:29 +00:00
|
|
|
|
2021-05-21 23:49:48 +00:00
|
|
|
let ipcRenderer = null
|
2020-03-24 13:22:29 +00:00
|
|
|
|
2020-08-24 19:50:03 +00:00
|
|
|
Vue.directive('observe-visibility', ObserveVisibility)
|
|
|
|
|
2020-02-16 18:30:00 +00:00
|
|
|
export default Vue.extend({
|
|
|
|
name: 'App',
|
|
|
|
components: {
|
2020-09-20 18:22:39 +00:00
|
|
|
FtFlexBox,
|
2020-02-16 18:30:00 +00:00
|
|
|
TopNav,
|
2020-06-14 21:13:35 +00:00
|
|
|
SideNav,
|
2020-09-20 18:22:39 +00:00
|
|
|
FtNotificationBanner,
|
|
|
|
FtPrompt,
|
|
|
|
FtButton,
|
2020-08-31 21:35:22 +00:00
|
|
|
FtToast,
|
|
|
|
FtProgressBar
|
2020-02-16 18:30:00 +00:00
|
|
|
},
|
2020-09-16 02:55:19 +00:00
|
|
|
data: function () {
|
|
|
|
return {
|
2021-04-20 18:07:47 +00:00
|
|
|
dataReady: false,
|
2020-09-20 18:22:39 +00:00
|
|
|
hideOutlines: true,
|
|
|
|
showUpdatesBanner: false,
|
|
|
|
showBlogBanner: false,
|
|
|
|
showReleaseNotes: false,
|
|
|
|
updateBannerMessage: '',
|
|
|
|
blogBannerMessage: '',
|
|
|
|
latestBlogUrl: '',
|
|
|
|
updateChangelog: '',
|
2021-09-16 23:03:25 +00:00
|
|
|
changeLogTitle: '',
|
|
|
|
|
|
|
|
lastExternalLinkToBeOpened: '',
|
|
|
|
showExternalLinkOpeningPrompt: false,
|
|
|
|
externalLinkOpeningPromptValues: [
|
|
|
|
'yes',
|
|
|
|
'no'
|
|
|
|
]
|
2020-09-16 02:55:19 +00:00
|
|
|
}
|
|
|
|
},
|
2020-02-16 18:30:00 +00:00
|
|
|
computed: {
|
2020-10-22 18:56:49 +00:00
|
|
|
isDev: function () {
|
|
|
|
return process.env.NODE_ENV === 'development'
|
|
|
|
},
|
2020-02-16 18:30:00 +00:00
|
|
|
isOpen: function () {
|
|
|
|
return this.$store.getters.getIsSideNavOpen
|
2020-08-31 21:35:22 +00:00
|
|
|
},
|
2021-06-06 17:13:36 +00:00
|
|
|
usingElectron: function() {
|
|
|
|
return this.$store.getters.getUsingElectron
|
|
|
|
},
|
2020-08-31 21:35:22 +00:00
|
|
|
showProgressBar: function () {
|
|
|
|
return this.$store.getters.getShowProgressBar
|
2020-09-16 13:51:26 +00:00
|
|
|
},
|
|
|
|
isRightAligned: function () {
|
|
|
|
return this.$i18n.locale === 'ar'
|
2020-09-20 18:22:39 +00:00
|
|
|
},
|
|
|
|
checkForUpdates: function () {
|
|
|
|
return this.$store.getters.getCheckForUpdates
|
|
|
|
},
|
|
|
|
checkForBlogPosts: function () {
|
|
|
|
return this.$store.getters.getCheckForBlogPosts
|
2020-10-04 20:31:07 +00:00
|
|
|
},
|
|
|
|
searchSettings: function () {
|
|
|
|
return this.$store.getters.getSearchSettings
|
2020-10-06 13:38:35 +00:00
|
|
|
},
|
|
|
|
profileList: function () {
|
|
|
|
return this.$store.getters.getProfileList
|
|
|
|
},
|
2021-07-21 15:45:02 +00:00
|
|
|
windowTitle: function () {
|
|
|
|
if (this.$route.meta.title !== 'Channel' && this.$route.meta.title !== 'Watch') {
|
|
|
|
let title =
|
|
|
|
this.$route.meta.path === '/home'
|
|
|
|
? process.env.PRODUCT_NAME
|
|
|
|
: `${this.$t(this.$route.meta.title)} - ${process.env.PRODUCT_NAME}`
|
|
|
|
if (!title) {
|
|
|
|
title = process.env.PRODUCT_NAME
|
|
|
|
}
|
|
|
|
return title
|
|
|
|
} else {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
},
|
2020-10-06 13:38:35 +00:00
|
|
|
activeProfile: function () {
|
|
|
|
return this.$store.getters.getActiveProfile
|
|
|
|
},
|
|
|
|
defaultProfile: function () {
|
|
|
|
return this.$store.getters.getDefaultProfile
|
2021-06-13 15:31:43 +00:00
|
|
|
},
|
|
|
|
externalPlayer: function () {
|
|
|
|
return this.$store.getters.getExternalPlayer
|
2021-07-03 01:55:56 +00:00
|
|
|
},
|
|
|
|
defaultInvidiousInstance: function () {
|
|
|
|
return this.$store.getters.getDefaultInvidiousInstance
|
2021-09-16 23:03:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
externalLinkOpeningPromptNames: function () {
|
|
|
|
return [
|
|
|
|
this.$t('Yes'),
|
|
|
|
this.$t('No')
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
externalLinkHandling: function () {
|
|
|
|
return this.$store.getters.getExternalLinkHandling
|
2020-02-16 18:30:00 +00:00
|
|
|
}
|
|
|
|
},
|
2021-07-21 15:45:02 +00:00
|
|
|
watch: {
|
2021-09-13 17:26:08 +00:00
|
|
|
windowTitle: 'setWindowTitle',
|
|
|
|
$route () {
|
|
|
|
// react to route changes...
|
|
|
|
// Hide top nav filter panel on page change
|
|
|
|
this.$refs.topNav.hideFilters()
|
|
|
|
}
|
2021-07-21 15:45:02 +00:00
|
|
|
},
|
|
|
|
created () {
|
|
|
|
this.setWindowTitle()
|
|
|
|
},
|
2020-02-16 18:30:00 +00:00
|
|
|
mounted: function () {
|
2021-07-03 01:55:56 +00:00
|
|
|
this.grabUserSettings().then(async () => {
|
|
|
|
await this.fetchInvidiousInstances()
|
|
|
|
if (this.defaultInvidiousInstance === '') {
|
|
|
|
await this.setRandomCurrentInvidiousInstance()
|
|
|
|
}
|
|
|
|
|
2021-05-21 23:56:32 +00:00
|
|
|
this.grabAllProfiles(this.$t('Profile.All Channels')).then(async () => {
|
|
|
|
this.grabHistory()
|
|
|
|
this.grabAllPlaylists()
|
2021-04-20 18:07:47 +00:00
|
|
|
this.checkThemeSettings()
|
2020-02-27 03:10:56 +00:00
|
|
|
|
2021-06-06 17:13:36 +00:00
|
|
|
if (this.usingElectron) {
|
2021-04-20 18:07:47 +00:00
|
|
|
console.log('User is using Electron')
|
2021-06-06 17:13:36 +00:00
|
|
|
ipcRenderer = require('electron').ipcRenderer
|
2021-06-20 18:34:11 +00:00
|
|
|
this.setupListenerToSyncWindows()
|
2021-04-20 18:07:47 +00:00
|
|
|
this.activateKeyboardShortcuts()
|
|
|
|
this.openAllLinksExternally()
|
|
|
|
this.enableOpenUrl()
|
2021-06-13 15:31:43 +00:00
|
|
|
await this.checkExternalPlayer()
|
2021-04-20 18:07:47 +00:00
|
|
|
}
|
2020-09-20 18:22:39 +00:00
|
|
|
|
2021-06-13 15:31:43 +00:00
|
|
|
this.dataReady = true
|
|
|
|
|
2021-04-20 18:07:47 +00:00
|
|
|
setTimeout(() => {
|
|
|
|
this.checkForNewUpdates()
|
|
|
|
this.checkForNewBlogPosts()
|
|
|
|
}, 500)
|
|
|
|
})
|
2021-09-16 22:58:03 +00:00
|
|
|
|
|
|
|
this.$router.afterEach((to, from) => {
|
|
|
|
this.$refs.topNav.navigateHistory()
|
|
|
|
})
|
2021-03-14 19:18:46 +00:00
|
|
|
})
|
2020-06-01 02:10:29 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
checkThemeSettings: function () {
|
|
|
|
let baseTheme = localStorage.getItem('baseTheme')
|
|
|
|
let mainColor = localStorage.getItem('mainColor')
|
|
|
|
let secColor = localStorage.getItem('secColor')
|
2020-02-27 03:10:56 +00:00
|
|
|
|
2020-06-01 02:10:29 +00:00
|
|
|
if (baseTheme === null) {
|
|
|
|
baseTheme = 'light'
|
|
|
|
}
|
2020-03-01 03:37:02 +00:00
|
|
|
|
2020-06-01 02:10:29 +00:00
|
|
|
if (mainColor === null) {
|
|
|
|
mainColor = 'mainRed'
|
|
|
|
}
|
2020-03-01 03:37:02 +00:00
|
|
|
|
2020-06-01 02:10:29 +00:00
|
|
|
if (secColor === null) {
|
|
|
|
secColor = 'secBlue'
|
|
|
|
}
|
2020-03-01 03:37:02 +00:00
|
|
|
|
2020-06-01 02:10:29 +00:00
|
|
|
const theme = {
|
|
|
|
baseTheme: baseTheme,
|
|
|
|
mainColor: mainColor,
|
|
|
|
secColor: secColor
|
|
|
|
}
|
2020-03-01 03:37:02 +00:00
|
|
|
|
2020-06-01 02:10:29 +00:00
|
|
|
this.updateTheme(theme)
|
|
|
|
},
|
2020-03-24 13:22:29 +00:00
|
|
|
|
2020-02-27 03:10:56 +00:00
|
|
|
updateTheme: function (theme) {
|
|
|
|
console.log(theme)
|
2020-03-01 03:37:02 +00:00
|
|
|
const className = `${theme.baseTheme} ${theme.mainColor} ${theme.secColor}`
|
2020-02-27 03:10:56 +00:00
|
|
|
const body = document.getElementsByTagName('body')[0]
|
2020-03-01 03:37:02 +00:00
|
|
|
body.className = className
|
|
|
|
localStorage.setItem('baseTheme', theme.baseTheme)
|
|
|
|
localStorage.setItem('mainColor', theme.mainColor)
|
|
|
|
localStorage.setItem('secColor', theme.secColor)
|
2020-06-01 02:10:29 +00:00
|
|
|
},
|
|
|
|
|
2020-09-20 18:22:39 +00:00
|
|
|
checkForNewUpdates: function () {
|
|
|
|
if (this.checkForUpdates) {
|
|
|
|
const { version } = require('../../package.json')
|
2020-10-01 02:12:29 +00:00
|
|
|
const requestUrl = 'https://api.github.com/repos/freetubeapp/freetube/releases'
|
2020-09-20 18:22:39 +00:00
|
|
|
|
|
|
|
$.getJSON(requestUrl, (response) => {
|
|
|
|
const tagName = response[0].tag_name
|
|
|
|
const versionNumber = tagName.replace('v', '').replace('-beta', '')
|
2021-06-17 03:14:06 +00:00
|
|
|
this.updateChangelog = marked(response[0].body)
|
2020-09-20 18:22:39 +00:00
|
|
|
this.changeLogTitle = response[0].name
|
|
|
|
|
|
|
|
const message = this.$t('Version $ is now available! Click for more details')
|
|
|
|
this.updateBannerMessage = message.replace('$', versionNumber)
|
2020-12-18 16:57:20 +00:00
|
|
|
|
|
|
|
const appVersion = version.split('.')
|
|
|
|
const latestVersion = versionNumber.split('.')
|
|
|
|
|
|
|
|
if (parseInt(appVersion[0]) < parseInt(latestVersion[0])) {
|
|
|
|
this.showUpdatesBanner = true
|
|
|
|
} else if (parseInt(appVersion[1]) < parseInt(latestVersion[1])) {
|
|
|
|
this.showUpdatesBanner = true
|
2021-09-01 20:31:20 +00:00
|
|
|
} else if (parseInt(appVersion[2]) < parseInt(latestVersion[2]) && parseInt(appVersion[1]) <= parseInt(latestVersion[1])) {
|
2020-09-20 18:22:39 +00:00
|
|
|
this.showUpdatesBanner = true
|
|
|
|
}
|
|
|
|
}).fail((xhr, textStatus, error) => {
|
|
|
|
console.log(xhr)
|
|
|
|
console.log(textStatus)
|
|
|
|
console.log(requestUrl)
|
|
|
|
console.log(error)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
checkForNewBlogPosts: function () {
|
|
|
|
if (this.checkForBlogPosts) {
|
|
|
|
const parser = new Parser()
|
|
|
|
const feedUrl = 'https://write.as/freetube/feed/'
|
|
|
|
let lastAppWasRunning = localStorage.getItem('lastAppWasRunning')
|
|
|
|
|
|
|
|
if (lastAppWasRunning !== null) {
|
|
|
|
lastAppWasRunning = new Date(lastAppWasRunning)
|
|
|
|
}
|
|
|
|
|
|
|
|
parser.parseURL(feedUrl).then((response) => {
|
|
|
|
const latestBlog = response.items[0]
|
|
|
|
const latestPubDate = new Date(latestBlog.pubDate)
|
|
|
|
|
|
|
|
if (lastAppWasRunning === null || latestPubDate > lastAppWasRunning) {
|
|
|
|
const message = this.$t('A new blog is now available, $. Click to view more')
|
|
|
|
this.blogBannerMessage = message.replace('$', latestBlog.title)
|
|
|
|
this.latestBlogUrl = latestBlog.link
|
|
|
|
this.showBlogBanner = true
|
|
|
|
}
|
|
|
|
|
|
|
|
localStorage.setItem('lastAppWasRunning', new Date())
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-06-13 15:31:43 +00:00
|
|
|
checkExternalPlayer: async function () {
|
|
|
|
const payload = {
|
|
|
|
isDev: this.isDev,
|
|
|
|
externalPlayer: this.externalPlayer
|
|
|
|
}
|
|
|
|
this.getExternalPlayerCmdArgumentsData(payload)
|
|
|
|
},
|
|
|
|
|
2020-09-20 18:22:39 +00:00
|
|
|
handleUpdateBannerClick: function (response) {
|
|
|
|
if (response !== false) {
|
|
|
|
this.showReleaseNotes = true
|
|
|
|
} else {
|
|
|
|
this.showUpdatesBanner = false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
handleNewBlogBannerClick: function (response) {
|
|
|
|
if (response) {
|
2021-05-21 23:49:48 +00:00
|
|
|
this.openExternalLink(this.latestBlogUrl)
|
2020-09-20 18:22:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
this.showBlogBanner = false
|
|
|
|
},
|
|
|
|
|
|
|
|
openDownloadsPage: function () {
|
|
|
|
const url = 'https://freetubeapp.io#download'
|
2021-05-21 23:49:48 +00:00
|
|
|
this.openExternalLink(url)
|
2020-09-20 18:22:39 +00:00
|
|
|
this.showReleaseNotes = false
|
|
|
|
this.showUpdatesBanner = false
|
|
|
|
},
|
|
|
|
|
2020-06-01 02:10:29 +00:00
|
|
|
activateKeyboardShortcuts: function () {
|
|
|
|
$(document).on('keydown', this.handleKeyboardShortcuts)
|
2020-09-16 02:55:19 +00:00
|
|
|
$(document).on('mousedown', () => {
|
|
|
|
this.hideOutlines = true
|
|
|
|
})
|
2020-06-01 02:10:29 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
handleKeyboardShortcuts: function (event) {
|
|
|
|
if (event.altKey) {
|
|
|
|
switch (event.code) {
|
|
|
|
case 'ArrowRight':
|
2021-09-16 22:58:03 +00:00
|
|
|
this.$refs.topNav.historyForward()
|
2020-06-01 02:10:29 +00:00
|
|
|
break
|
|
|
|
case 'ArrowLeft':
|
2021-09-16 22:58:03 +00:00
|
|
|
this.$refs.topNav.historyBack()
|
2020-06-01 02:10:29 +00:00
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
2020-09-16 02:55:19 +00:00
|
|
|
switch (event.code) {
|
|
|
|
case 'Tab':
|
|
|
|
this.hideOutlines = false
|
|
|
|
break
|
|
|
|
}
|
2020-06-01 02:10:29 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
openAllLinksExternally: function () {
|
|
|
|
$(document).on('click', 'a[href^="http"]', (event) => {
|
|
|
|
const el = event.currentTarget
|
2021-06-06 17:13:36 +00:00
|
|
|
console.log(this.usingElectron)
|
2020-06-01 02:10:29 +00:00
|
|
|
console.log(el)
|
2021-03-30 02:32:17 +00:00
|
|
|
event.preventDefault()
|
|
|
|
|
2021-04-25 00:28:29 +00:00
|
|
|
// Check if it's a YouTube link
|
2021-03-30 02:32:17 +00:00
|
|
|
const youtubeUrlPattern = /^https?:\/\/((www\.)?youtube\.com(\/embed)?|youtu\.be)\/.*$/
|
|
|
|
const isYoutubeLink = youtubeUrlPattern.test(el.href)
|
|
|
|
|
|
|
|
if (isYoutubeLink) {
|
|
|
|
this.handleYoutubeLink(el.href)
|
2021-09-16 23:03:25 +00:00
|
|
|
} else if (this.externalLinkHandling === 'doNothing') {
|
|
|
|
// Let user know opening external link is disabled via setting
|
|
|
|
this.showToast({
|
|
|
|
message: this.$t('External link opening has been disabled in the general settings')
|
|
|
|
})
|
|
|
|
} else if (this.externalLinkHandling === 'openLinkAfterPrompt') {
|
|
|
|
// Storing the URL is necessary as
|
|
|
|
// there is no other way to pass the URL to click callback
|
|
|
|
this.lastExternalLinkToBeOpened = el.href
|
|
|
|
this.showExternalLinkOpeningPrompt = true
|
2021-03-30 02:32:17 +00:00
|
|
|
} else {
|
2021-09-16 23:03:25 +00:00
|
|
|
// Open links externally
|
2021-05-21 23:49:48 +00:00
|
|
|
this.openExternalLink(el.href)
|
2021-03-30 02:32:17 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
handleYoutubeLink: function (href) {
|
2021-05-21 23:56:32 +00:00
|
|
|
this.getYoutubeUrlInfo(href).then((result) => {
|
2021-04-28 17:21:16 +00:00
|
|
|
switch (result.urlType) {
|
|
|
|
case 'video': {
|
2021-05-31 11:23:35 +00:00
|
|
|
const { videoId, timestamp, playlistId } = result
|
|
|
|
|
|
|
|
const query = {}
|
|
|
|
if (timestamp) {
|
|
|
|
query.timestamp = timestamp
|
|
|
|
}
|
|
|
|
if (playlistId && playlistId.length > 0) {
|
|
|
|
query.playlistId = playlistId
|
|
|
|
}
|
2021-04-28 17:21:16 +00:00
|
|
|
this.$router.push({
|
|
|
|
path: `/watch/${videoId}`,
|
2021-05-31 11:23:35 +00:00
|
|
|
query: query
|
2021-04-28 17:21:16 +00:00
|
|
|
})
|
|
|
|
break
|
|
|
|
}
|
2021-03-30 02:32:17 +00:00
|
|
|
|
2021-04-28 17:21:16 +00:00
|
|
|
case 'playlist': {
|
|
|
|
const { playlistId, query } = result
|
|
|
|
|
|
|
|
this.$router.push({
|
|
|
|
path: `/playlist/${playlistId}`,
|
|
|
|
query
|
|
|
|
})
|
|
|
|
break
|
2021-03-30 02:32:17 +00:00
|
|
|
}
|
|
|
|
|
2021-04-28 17:21:16 +00:00
|
|
|
case 'search': {
|
|
|
|
const { searchQuery, query } = result
|
2021-03-30 02:32:17 +00:00
|
|
|
|
2021-04-28 17:21:16 +00:00
|
|
|
this.$router.push({
|
|
|
|
path: `/search/${encodeURIComponent(searchQuery)}`,
|
|
|
|
query
|
|
|
|
})
|
|
|
|
break
|
|
|
|
}
|
2021-04-25 00:28:29 +00:00
|
|
|
|
2021-04-28 17:21:16 +00:00
|
|
|
case 'hashtag': {
|
|
|
|
// TODO: Implement a hashtag related view
|
|
|
|
let message = 'Hashtags have not yet been implemented, try again later'
|
|
|
|
if (this.$te(message) && this.$t(message) !== '') {
|
|
|
|
message = this.$t(message)
|
2021-04-25 00:28:29 +00:00
|
|
|
}
|
|
|
|
|
2021-04-28 17:21:16 +00:00
|
|
|
this.showToast({
|
|
|
|
message: message
|
|
|
|
})
|
|
|
|
break
|
|
|
|
}
|
2021-03-30 02:32:17 +00:00
|
|
|
|
2021-04-28 17:21:16 +00:00
|
|
|
case 'channel': {
|
|
|
|
const { channelId } = result
|
|
|
|
|
|
|
|
this.$router.push({
|
|
|
|
path: `/channel/${channelId}`
|
|
|
|
})
|
|
|
|
break
|
|
|
|
}
|
2021-03-30 02:32:17 +00:00
|
|
|
|
2021-04-28 17:21:16 +00:00
|
|
|
case 'invalid_url': {
|
|
|
|
// Do nothing
|
|
|
|
break
|
|
|
|
}
|
2021-04-25 00:28:29 +00:00
|
|
|
|
2021-04-28 17:21:16 +00:00
|
|
|
default: {
|
|
|
|
// Unknown URL type
|
|
|
|
let message = 'Unknown YouTube url type, cannot be opened in app'
|
|
|
|
if (this.$te(message) && this.$t(message) !== '') {
|
|
|
|
message = this.$t(message)
|
2021-03-30 02:32:17 +00:00
|
|
|
}
|
2021-04-28 17:21:16 +00:00
|
|
|
|
|
|
|
this.showToast({
|
|
|
|
message: message
|
|
|
|
})
|
2021-03-30 02:32:17 +00:00
|
|
|
}
|
2020-06-01 02:10:29 +00:00
|
|
|
}
|
|
|
|
})
|
2020-09-20 18:54:23 +00:00
|
|
|
},
|
|
|
|
|
2020-10-15 13:33:25 +00:00
|
|
|
enableOpenUrl: function () {
|
2021-05-21 23:52:11 +00:00
|
|
|
ipcRenderer.on('openUrl', (event, url) => {
|
2020-10-04 20:31:07 +00:00
|
|
|
if (url) {
|
2021-05-21 23:52:11 +00:00
|
|
|
this.handleYoutubeLink(url)
|
2020-10-04 20:31:07 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2021-05-21 23:49:48 +00:00
|
|
|
ipcRenderer.send('appReady')
|
2020-10-04 20:31:07 +00:00
|
|
|
},
|
|
|
|
|
2021-09-16 23:03:25 +00:00
|
|
|
handleExternalLinkOpeningPromptAnswer: function (option) {
|
|
|
|
this.showExternalLinkOpeningPrompt = false
|
|
|
|
|
|
|
|
if (option === 'yes' && this.lastExternalLinkToBeOpened.length > 0) {
|
|
|
|
// Maybe user should be notified
|
|
|
|
// if `lastExternalLinkToBeOpened` is empty
|
|
|
|
|
|
|
|
// Open links externally
|
|
|
|
this.openExternalLink(this.lastExternalLinkToBeOpened)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-07-03 01:55:56 +00:00
|
|
|
...mapMutations([
|
|
|
|
'setInvidiousInstancesList'
|
|
|
|
]),
|
|
|
|
|
2021-07-21 15:45:02 +00:00
|
|
|
setWindowTitle: function() {
|
|
|
|
if (this.windowTitle !== null) {
|
|
|
|
document.title = this.windowTitle
|
|
|
|
}
|
|
|
|
},
|
2021-04-25 00:28:29 +00:00
|
|
|
...mapActions([
|
2021-05-21 23:49:48 +00:00
|
|
|
'showToast',
|
2021-05-21 23:56:32 +00:00
|
|
|
'openExternalLink',
|
|
|
|
'grabUserSettings',
|
|
|
|
'grabAllProfiles',
|
|
|
|
'grabHistory',
|
|
|
|
'grabAllPlaylists',
|
2021-05-25 17:39:34 +00:00
|
|
|
'getYoutubeUrlInfo',
|
2021-06-13 15:31:43 +00:00
|
|
|
'getExternalPlayerCmdArgumentsData',
|
2021-07-03 01:55:56 +00:00
|
|
|
'fetchInvidiousInstances',
|
|
|
|
'setRandomCurrentInvidiousInstance',
|
2021-06-20 18:34:11 +00:00
|
|
|
'setupListenerToSyncWindows'
|
2021-04-25 00:28:29 +00:00
|
|
|
])
|
2020-02-16 18:30:00 +00:00
|
|
|
}
|
|
|
|
})
|