hardlounge/client/components/VersionChecker.vue

67 lines
1.7 KiB
Vue
Raw Normal View History

2019-08-05 14:29:35 +00:00
<template>
<div id="version-checker" :class="[store.state.versionStatus]">
<p v-if="store.state.versionStatus === 'loading'">Checking for updates</p>
<p v-if="store.state.versionStatus === 'new-version'">
2023-10-09 10:28:14 +00:00
Hard Lounge <b>{{ store.state.versionData?.latest.version }}</b>
<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">
2019-08-05 14:29:35 +00:00
Read more on GitHub
</a>
</p>
<p v-if="store.state.versionStatus === 'new-packages'">
2023-10-09 10:28:14 +00:00
Hard Lounge is up to date, but there are out of date packages Run
2019-08-05 14:29:35 +00:00
<code>thelounge upgrade</code> on the server to upgrade packages.
</p>
<template v-if="store.state.versionStatus === 'up-to-date'">
2023-10-09 10:28:14 +00:00
<p>Hard Lounge is up to date!</p>
2019-08-05 14:29:35 +00:00
<button
v-if="store.state.versionDataExpired"
2019-08-05 14:29:35 +00:00
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 lang="ts">
import {defineComponent, onMounted} from "vue";
2019-11-16 17:24:03 +00:00
import socket from "../js/socket";
import {useStore} from "../js/store";
2019-08-05 14:29:35 +00:00
export default defineComponent({
2019-08-05 14:29:35 +00:00
name: "VersionChecker",
setup() {
const store = useStore();
const checkNow = () => {
store.commit("versionData", null);
store.commit("versionStatus", "loading");
2019-08-05 14:29:35 +00:00
socket.emit("changelog");
};
onMounted(() => {
if (!store.state.versionData) {
checkNow();
}
});
return {
store,
checkNow,
};
2019-08-05 14:29:35 +00:00
},
});
2019-08-05 14:29:35 +00:00
</script>