Fix some navigation, clear data on exit, and add more toast messages
This commit is contained in:
		
							parent
							
								
									093aa12810
								
							
						
					
					
						commit
						4203ff4ba3
					
				|  | @ -116,6 +116,20 @@ app.on('window-all-closed', () => { | |||
|   if (process.platform !== 'darwin') { | ||||
|     app.quit() | ||||
|   } | ||||
| 
 | ||||
|   mainWindow.webContents.session.clearCache() | ||||
|   mainWindow.webContents.session.clearStorageData({ | ||||
|     storages: [ | ||||
|       'appcache', | ||||
|       'cookies', | ||||
|       'filesystem', | ||||
|       'indexdb', | ||||
|       'shadercache', | ||||
|       'websql', | ||||
|       'serviceworkers', | ||||
|       'cachestorage' | ||||
|     ] | ||||
|   }) | ||||
| }) | ||||
| 
 | ||||
| app.on('activate', () => { | ||||
|  |  | |||
|  | @ -42,12 +42,12 @@ export default Vue.extend({ | |||
|       this.openAllLinksExternally() | ||||
|     } | ||||
| 
 | ||||
|     try { | ||||
|       const doc = yaml.safeLoad(fs.readFileSync('./static/locales/en-US.yaml')) | ||||
|       console.log(doc) | ||||
|     } catch (e) { | ||||
|       console.log(e) | ||||
|     } | ||||
|     // try {
 | ||||
|     //   const doc = yaml.safeLoad(fs.readFileSync('./static/locales/en-US.yaml'))
 | ||||
|     //   console.log(doc)
 | ||||
|     // } catch (e) {
 | ||||
|     //   console.log(e)
 | ||||
|     // }
 | ||||
|   }, | ||||
|   methods: { | ||||
|     checkLocale: function () { | ||||
|  |  | |||
|  | @ -174,6 +174,9 @@ export default Vue.extend({ | |||
|           break | ||||
|         case 'copyYoutube': | ||||
|           navigator.clipboard.writeText(this.youtubeUrl) | ||||
|           this.showToast({ | ||||
|             message: this.$t('Share.YouTube URL copied to clipboard') | ||||
|           }) | ||||
|           break | ||||
|         case 'openYoutube': | ||||
|           if (this.usingElectron) { | ||||
|  | @ -183,6 +186,9 @@ export default Vue.extend({ | |||
|           break | ||||
|         case 'copyYoutubeEmbed': | ||||
|           navigator.clipboard.writeText(this.youtubeEmbedUrl) | ||||
|           this.showToast({ | ||||
|             message: this.$t('Share.YouTube Embed URL copied to clipboard') | ||||
|           }) | ||||
|           break | ||||
|         case 'openYoutubeEmbed': | ||||
|           if (this.usingElectron) { | ||||
|  | @ -192,6 +198,9 @@ export default Vue.extend({ | |||
|           break | ||||
|         case 'copyInvidious': | ||||
|           navigator.clipboard.writeText(this.invidiousUrl) | ||||
|           this.showToast({ | ||||
|             message: this.$t('Share.Invidious URL copied to clipboard') | ||||
|           }) | ||||
|           break | ||||
|         case 'openInvidious': | ||||
|           if (this.usingElectron) { | ||||
|  |  | |||
|  | @ -22,16 +22,6 @@ library.add(fas) | |||
| Vue.component('font-awesome-icon', FontAwesomeIcon) | ||||
| 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
 | ||||
| const activeLocales = ['en-US', 'de-DE', 'pt-PT'] | ||||
| const messages = {} | ||||
|  |  | |||
|  | @ -687,16 +687,20 @@ export default Vue.extend({ | |||
|     ]) | ||||
|   }, | ||||
|   beforeRouteLeave: function (to, from, next) { | ||||
|     if (this.rememberHistory) { | ||||
|       const currentTime = this.$refs.videoPlayer.player.currentTime() | ||||
|       console.log(currentTime) | ||||
|       const payload = { | ||||
|         videoId: this.videoId, | ||||
|         watchProgress: currentTime | ||||
|       } | ||||
|     if (this.rememberHistory && !this.isLoading && !this.isLive) { | ||||
|       const player = this.$refs.videoPlayer.player | ||||
| 
 | ||||
|       console.log('update watch progress') | ||||
|       this.updateWatchProgress(payload) | ||||
|       if (typeof player !== 'undefined') { | ||||
|         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() | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue