thelounge/client/components/VersionChecker.vue

57 lines
1.5 KiB
Vue
Raw Normal View History

2019-08-05 14:29:35 +00:00
<template>
<div id="version-checker" :class="[$store.state.versionStatus]">
2020-08-25 09:49:53 +00:00
<p v-if="$store.state.versionStatus === 'loading'">Checking for updates</p>
2019-08-05 14:29:35 +00:00
<p v-if="$store.state.versionStatus === 'new-version'">
The Lounge <b>{{ $store.state.versionData.latest.version }}</b>
2020-08-25 09:49:53 +00:00
<template v-if="$store.state.versionData.latest.prerelease"> (pre-release) </template>
2019-08-05 14:29:35 +00:00
is now available.
<br />
<a :href="$store.state.versionData.latest.url" target="_blank" rel="noopener">
Read more on GitHub
</a>
</p>
<p v-if="$store.state.versionStatus === 'new-packages'">
The Lounge is up to date, but there are out of date packages Run
<code>thelounge upgrade</code> on the server to upgrade packages.
</p>
<template v-if="$store.state.versionStatus === 'up-to-date'">
2020-08-25 09:49:53 +00:00
<p>The Lounge is up to date!</p>
2019-08-05 14:29:35 +00:00
<button
v-if="$store.state.versionDataExpired"
id="check-now"
class="btn btn-small"
@click="checkNow"
>
Check now
</button>
</template>
<template v-if="$store.state.versionStatus === 'error'">
2020-08-25 09:49:53 +00:00
<p>Information about latest release could not be retrieved.</p>
2019-08-05 14:29:35 +00:00
<button id="check-now" class="btn btn-small" @click="checkNow">Try again</button>
</template>
</div>
</template>
<script>
2019-11-16 17:24:03 +00:00
import socket from "../js/socket";
2019-08-05 14:29:35 +00:00
export default {
name: "VersionChecker",
mounted() {
if (!this.$store.state.versionData) {
this.checkNow();
}
},
methods: {
checkNow() {
this.$store.commit("versionData", null);
this.$store.commit("versionStatus", "loading");
socket.emit("changelog");
},
},
};
</script>