@samitouri / QOSami-HFS / commits / cb413ae5

fix: admin: check updates didn't say anything when the version was already latest

Massimo Melina committed May 21, 2023 at 13:13 UTC cb413ae5b013b4e29b1bf7a545a152c57c96485c
2 files changed +3 -4
src/commands.ts
+2
@@ -110,6 +110,8 @@ const commands = {
110 params: '',
111 async cb() {
112 const update = await getUpdate()
113 + if (update.name === VERSION)
114 + throw "you already have the latest version: " + VERSION
115 console.log("new version available", update.name)
116 }
117 },
src/update.ts
+1 -4
@@ -12,10 +12,7 @@ import { Readable } from 'stream'
12 import open from 'open'
13
14 export async function getUpdate() {
15 - const [latest] = await getRepoInfo(HFS_REPO + '/releases?per_page=1')
16 - if (latest.name === VERSION)
17 - throw "you already have the latest version: " + VERSION
18 - return latest
15 + return (await getRepoInfo(HFS_REPO + '/releases?per_page=1'))[0]
16 }
17
18 const LOCAL_UPDATE = 'hfs-update.zip' // update from file takes precedence over net