Added update checker
This commit is contained in:
16
server/src/routes/api/get/checkForUpdates.ts
Normal file
16
server/src/routes/api/get/checkForUpdates.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ApiHandler } from '../../../types'
|
||||
import { getLatestVersion, isUpdateAvailable } from '../../../main'
|
||||
|
||||
const path: ApiHandler['path'] = '/checkForUpdates'
|
||||
|
||||
const handler: ApiHandler['handler'] = async (_, res) => {
|
||||
const latestCommit = await getLatestVersion()
|
||||
res.send({
|
||||
latestCommit,
|
||||
updateAvailable: isUpdateAvailable()
|
||||
})
|
||||
}
|
||||
|
||||
const apiHandler: ApiHandler = { path, handler }
|
||||
|
||||
export default apiHandler
|
||||
@@ -16,6 +16,7 @@ import getUserSpotifyPlaylists from './getUserSpotifyPlaylists'
|
||||
import getUserFavorites from './getUserFavorites'
|
||||
import getQueue from './getQueue'
|
||||
import spotifyStatus from './spotifyStatus'
|
||||
import checkForUpdates from './checkForUpdates'
|
||||
|
||||
export default [
|
||||
albumSearch,
|
||||
@@ -35,5 +36,6 @@ export default [
|
||||
getUserSpotifyPlaylists,
|
||||
getUserFavorites,
|
||||
getQueue,
|
||||
spotifyStatus
|
||||
spotifyStatus,
|
||||
checkForUpdates
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user