Skip to content

Commit

Permalink
Fix bug with update checker & only show update button if out of date
Browse files Browse the repository at this point in the history
  • Loading branch information
iDevelopThings committed Jan 22, 2023
1 parent 246b404 commit 3d0b415
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/package.json.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
32f43ced626aca09dfb9534fe4338f6a
32f43ced626aca09dfb9534fe4338f6a
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
</span>
</div>

<button @click="$modals.show('updates:info')" class="bg-main-400 flex flex-row items-center px-2 py-0.5 space-x-1 ">
<button
v-if="$app.$updater.hasUpdateAvailable"
@click="$modals.show('updates:info')"
class="bg-main-400 flex flex-row items-center px-2 py-0.5 space-x-1 "
>
<span class="font-semibold text-xs text-white">
Update Available
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@

<script setup lang="ts">
import {computed} from "vue";
import {app} from "../../../Stores/AppStore";
import {app} from "@/Stores/AppStore";
const dotBg = computed(() => {
const update = app.$updater.info;
if (!update) {
return "bg-green-500";
}
if (update.version.major > app.$updater.currentVersion.major) {
return "bg-red-500";
}
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/Services/Updater/Updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ export class Updater {
this.state.hide = value;
}

get hasUpdateAvailable() {
if(!this.state.info) {
return false;
}

return this.state.info.version.compare(this.state.current) === 1;
}

get currentVersion() {
return this.state.current;
}
Expand Down

0 comments on commit 3d0b415

Please sign in to comment.