Added support for updates check
This commit is contained in:
		
							parent
							
								
									f399df1285
								
							
						
					
					
						commit
						5ab3472a27
					
				
							
								
								
									
										11
									
								
								src/app.js
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								src/app.js
									
									
									
									
									
								
							| @ -89,6 +89,17 @@ async function startApp() { | |||||||
| 	} else { | 	} else { | ||||||
| 		loggedIn({ status: 3, user: connectResponse.currentUser, arl }) | 		loggedIn({ status: 3, user: connectResponse.currentUser, arl }) | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 	if (connectResponse.checkForUpdates) { | ||||||
|  | 		toast(i18n.t('toasts.checkingUpdates'), 'loading', false, 'updates-toast') | ||||||
|  | 		const updates = await fetchData('checkForUpdates') | ||||||
|  | 		store.dispatch('setUpdateInfo', updates).catch(console.error) | ||||||
|  | 		if (updates.updateAvailable) { | ||||||
|  | 			toast(i18n.t('toasts.updateAvailable'), 'chevron-triple-up', true, 'updates-toast') | ||||||
|  | 		} else { | ||||||
|  | 			toast(i18n.t('toasts.noUpdateAvailable'), 'done', true, 'updates-toast') | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function initClient() { | function initClient() { | ||||||
|  | |||||||
| @ -33,9 +33,9 @@ | |||||||
| 
 | 
 | ||||||
| 		<h2>{{ $t('about.titles.usefulLinks') }}</h2> | 		<h2>{{ $t('about.titles.usefulLinks') }}</h2> | ||||||
| 		<ul class="no-dots"> | 		<ul class="no-dots"> | ||||||
| 			<!-- <li> | 			<li> | ||||||
| 				<a href="" target="_blank">🌍 {{ $t('about.officialWebsite') }}</a> | 				<a href="https://deemix.app/gui" target="_blank">🌍 {{ $t('about.officialWebsite') }}</a> | ||||||
| 			</li> --> | 			</li> | ||||||
| 			<li> | 			<li> | ||||||
| 				<a href="https://git.freezer.life/RemixDev/deemix-js" target="_blank">🚀 {{ $t('about.officialRepo') }}</a> | 				<a href="https://git.freezer.life/RemixDev/deemix-js" target="_blank">🚀 {{ $t('about.officialRepo') }}</a> | ||||||
| 			</li> | 			</li> | ||||||
|  | |||||||
| @ -217,7 +217,10 @@ const en = { | |||||||
| 		deezerNotAvailable: 'Deezer is not available in your country. You should use a VPN.', | 		deezerNotAvailable: 'Deezer is not available in your country. You should use a VPN.', | ||||||
| 		startGeneratingItems: 'Processing {n} items...', | 		startGeneratingItems: 'Processing {n} items...', | ||||||
| 		finishGeneratingItems: 'Generated {n} items.', | 		finishGeneratingItems: 'Generated {n} items.', | ||||||
| 		noLovedPlaylist: 'No loved tracks playlist!' | 		noLovedPlaylist: 'No loved tracks playlist!', | ||||||
|  | 		checkingUpdates: 'Checking for updates...', | ||||||
|  | 		noUpdateAvailable: 'No updates found', | ||||||
|  | 		updateAvailable: 'An update is available!' | ||||||
| 	}, | 	}, | ||||||
| 	settings: { | 	settings: { | ||||||
| 		title: 'Settings', | 		title: 'Settings', | ||||||
|  | |||||||
| @ -217,7 +217,10 @@ const it = { | |||||||
| 		deezerNotAvailable: 'Deezer non è disponibile nel tuo paese. Dovresti usare una VPN.', | 		deezerNotAvailable: 'Deezer non è disponibile nel tuo paese. Dovresti usare una VPN.', | ||||||
| 		startGeneratingItems: 'Elaborando {n} oggetti...', | 		startGeneratingItems: 'Elaborando {n} oggetti...', | ||||||
| 		finishGeneratingItems: '{n} oggetti generati.', | 		finishGeneratingItems: '{n} oggetti generati.', | ||||||
| 		noLovedPlaylist: 'Nessuna playlist "Canzoni del cuore"!' | 		noLovedPlaylist: 'Nessuna playlist "Canzoni del cuore"!', | ||||||
|  | 		checkingUpdates: 'Cercando aggiornamenti...', | ||||||
|  | 		noUpdateAvailable: 'Nessun aggiornamento trovato', | ||||||
|  | 		updateAvailable: 'È disponibile un aggiornamento!' | ||||||
| 	}, | 	}, | ||||||
| 	settings: { | 	settings: { | ||||||
| 		title: 'Impostazioni', | 		title: 'Impostazioni', | ||||||
|  | |||||||
| @ -39,9 +39,11 @@ const actions = { | |||||||
| 	 */ | 	 */ | ||||||
| 	setAppInfo({ commit }, payload) { | 	setAppInfo({ commit }, payload) { | ||||||
| 		commit('SET_CURRENT_COMMIT', payload.currentCommit) | 		commit('SET_CURRENT_COMMIT', payload.currentCommit) | ||||||
|  | 		commit('SET_DEEMIX_VERSION', payload.deemixVersion) | ||||||
|  | 	}, | ||||||
|  | 	setUpdateInfo({ commit }, payload) { | ||||||
| 		commit('SET_LATEST_COMMIT', payload.latestCommit) | 		commit('SET_LATEST_COMMIT', payload.latestCommit) | ||||||
| 		commit('SET_UPDATE_AVAILABLE', payload.updateAvailable) | 		commit('SET_UPDATE_AVAILABLE', payload.updateAvailable) | ||||||
| 		commit('SET_DEEMIX_VERSION', payload.deemixVersion) |  | ||||||
| 	}, | 	}, | ||||||
| 	/** | 	/** | ||||||
| 	 * @param {any}												action | 	 * @param {any}												action | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user