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,16 +687,20 @@ 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 currentTime = this.$refs.videoPlayer.player.currentTime() const player = this.$refs.videoPlayer.player
console.log(currentTime)
const payload = {
videoId: this.videoId,
watchProgress: currentTime
}
console.log('update watch progress') if (typeof player !== 'undefined') {
this.updateWatchProgress(payload) const currentTime = this.$refs.videoPlayer.player.currentTime()
console.log(currentTime)
const payload = {
videoId: this.videoId,
watchProgress: currentTime
}
console.log('update watch progress')
this.updateWatchProgress(payload)
}
} }
next() next()