Fix some navigation, clear data on exit, and add more toast messages

This commit is contained in:
Preston 2020-08-20 21:20:22 -04:00
parent 093aa12810
commit 4203ff4ba3
5 changed files with 42 additions and 25 deletions

View File

@ -116,6 +116,20 @@ app.on('window-all-closed', () => {
if (process.platform !== 'darwin') { if (process.platform !== 'darwin') {
app.quit() app.quit()
} }
mainWindow.webContents.session.clearCache()
mainWindow.webContents.session.clearStorageData({
storages: [
'appcache',
'cookies',
'filesystem',
'indexdb',
'shadercache',
'websql',
'serviceworkers',
'cachestorage'
]
})
}) })
app.on('activate', () => { app.on('activate', () => {

View File

@ -42,12 +42,12 @@ export default Vue.extend({
this.openAllLinksExternally() this.openAllLinksExternally()
} }
try { // try {
const doc = yaml.safeLoad(fs.readFileSync('./static/locales/en-US.yaml')) // const doc = yaml.safeLoad(fs.readFileSync('./static/locales/en-US.yaml'))
console.log(doc) // console.log(doc)
} catch (e) { // } catch (e) {
console.log(e) // console.log(e)
} // }
}, },
methods: { methods: {
checkLocale: function () { checkLocale: function () {

View File

@ -174,6 +174,9 @@ export default Vue.extend({
break break
case 'copyYoutube': case 'copyYoutube':
navigator.clipboard.writeText(this.youtubeUrl) navigator.clipboard.writeText(this.youtubeUrl)
this.showToast({
message: this.$t('Share.YouTube URL copied to clipboard')
})
break break
case 'openYoutube': case 'openYoutube':
if (this.usingElectron) { if (this.usingElectron) {
@ -183,6 +186,9 @@ export default Vue.extend({
break break
case 'copyYoutubeEmbed': case 'copyYoutubeEmbed':
navigator.clipboard.writeText(this.youtubeEmbedUrl) navigator.clipboard.writeText(this.youtubeEmbedUrl)
this.showToast({
message: this.$t('Share.YouTube Embed URL copied to clipboard')
})
break break
case 'openYoutubeEmbed': case 'openYoutubeEmbed':
if (this.usingElectron) { if (this.usingElectron) {
@ -192,6 +198,9 @@ export default Vue.extend({
break break
case 'copyInvidious': case 'copyInvidious':
navigator.clipboard.writeText(this.invidiousUrl) navigator.clipboard.writeText(this.invidiousUrl)
this.showToast({
message: this.$t('Share.Invidious URL copied to clipboard')
})
break break
case 'openInvidious': case 'openInvidious':
if (this.usingElectron) { if (this.usingElectron) {

View File

@ -22,16 +22,6 @@ library.add(fas)
Vue.component('font-awesome-icon', FontAwesomeIcon) Vue.component('font-awesome-icon', FontAwesomeIcon)
Vue.use(VueI18n) Vue.use(VueI18n)
fs.readdir('.', (err, dir) => {
if (err) {
console.log(err)
}
console.log(dir)
for (const filePath of dir) {
console.log(filePath)
}
})
// List of locales approved for use // List of locales approved for use
const activeLocales = ['en-US', 'de-DE', 'pt-PT'] const activeLocales = ['en-US', 'de-DE', 'pt-PT']
const messages = {} const messages = {}

View File

@ -687,7 +687,10 @@ export default Vue.extend({
]) ])
}, },
beforeRouteLeave: function (to, from, next) { beforeRouteLeave: function (to, from, next) {
if (this.rememberHistory) { if (this.rememberHistory && !this.isLoading && !this.isLive) {
const player = this.$refs.videoPlayer.player
if (typeof player !== 'undefined') {
const currentTime = this.$refs.videoPlayer.player.currentTime() const currentTime = this.$refs.videoPlayer.player.currentTime()
console.log(currentTime) console.log(currentTime)
const payload = { const payload = {
@ -698,6 +701,7 @@ export default Vue.extend({
console.log('update watch progress') console.log('update watch progress')
this.updateWatchProgress(payload) this.updateWatchProgress(payload)
} }
}
next() next()
} }