VueTube/NUXT/components/updateChecker.vue

45 lines
967 B
Vue
Raw Normal View History

2022-03-13 20:16:00 +00:00
<template>
2022-03-21 23:47:11 +00:00
<div>
2022-08-07 05:18:10 +00:00
<v-snackbar v-model="updateSnackbar" class="updateBar" :timeout="updateSnackbarTimeout" rounded>
2022-03-21 23:47:11 +00:00
{{ updateSnackbarText }}
2022-03-13 20:16:00 +00:00
2022-03-21 23:47:11 +00:00
<template #action="{ attrs }">
<v-btn
color="primary"
text
v-bind="attrs"
2022-08-07 05:18:10 +00:00
to="/mods/updates?nowait=true"
>Update</v-btn
2022-03-21 23:47:11 +00:00
>
</template>
</v-snackbar>
</div>
2022-03-13 20:16:00 +00:00
</template>
<style scoped>
.updateBar {
2022-03-21 23:47:11 +00:00
z-index: 99999999;
2022-03-13 20:16:00 +00:00
}
</style>
<script>
export default {
2022-03-21 23:47:11 +00:00
data() {
return {
updateSnackbar: false,
updateSnackbarText: "An update is available",
updateSnackbarTimeout: 5000,
};
},
2022-03-21 23:47:11 +00:00
async mounted() {
2022-06-22 16:19:51 +00:00
const releases = await this.$vuetube.releases;
const appVersion = process.env.version;
const appChannel = process.env.channel;
if (appVersion !== releases[0].tag_name && appVersion !== "dev-local" && appChannel !== "Unstable") {
2022-03-21 23:47:11 +00:00
this.updateSnackbar = true;
}
},
};
</script>