From f51c33615cb2571b55c6ef29f8ff9f76064045f3 Mon Sep 17 00:00:00 2001 From: Eliot Berriot <contact@eliotberriot.com> Date: Sun, 3 Jun 2018 18:01:42 +0200 Subject: [PATCH] Fix #270: display server version in the footer --- changes/changelog.d/270.enhancement | 1 + front/src/App.vue | 36 +++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 changes/changelog.d/270.enhancement diff --git a/changes/changelog.d/270.enhancement b/changes/changelog.d/270.enhancement new file mode 100644 index 0000000000..1d035640d7 --- /dev/null +++ b/changes/changelog.d/270.enhancement @@ -0,0 +1 @@ +Display server version in the footer (#270) diff --git a/front/src/App.vue b/front/src/App.vue index a213374284..673f838646 100644 --- a/front/src/App.vue +++ b/front/src/App.vue @@ -12,10 +12,13 @@ <router-link class="item" to="/about"> <i18next path="About this instance" /> </router-link> - <i18next tag="a" href="https://funkwhale.audio" class="item" target="_blank" path="Official website" /> - <i18next tag="a" href="https://docs.funkwhale.audio" class="item" target="_blank" path="Documentation" /> - <i18next tag="a" href="https://code.eliotberriot.com/funkwhale/funkwhale" class="item" target="_blank" path="Source code" /> - <i18next tag="a" href="https://code.eliotberriot.com/funkwhale/funkwhale/issues" class="item" target="_blank" path="Issue tracker" /> + <a href="https://funkwhale.audio" class="item" target="_blank">{{ $t('Official website') }}</a> + <a href="https://docs.funkwhale.audio" class="item" target="_blank">{{ $t('Documentation') }}</a> + <a href="https://code.eliotberriot.com/funkwhale/funkwhale" class="item" target="_blank"> + <template v-if="version">{{ $t('Source code ({% version %})', {version: version}) }}</template> + <template v-else>{{ $t('Source code') }}</template> + </a> + <a href="https://code.eliotberriot.com/funkwhale/funkwhale/issues" class="item" target="_blank">{{ $t('Issue tracker') }}</a> </div> </div> <div class="ten wide column"> @@ -39,6 +42,9 @@ </template> <script> +import axios from 'axios' +import _ from 'lodash' + import Sidebar from '@/components/Sidebar' import Raven from '@/components/Raven' @@ -51,6 +57,11 @@ export default { Raven, PlaylistModal }, + data () { + return { + nodeinfo: null + } + }, created () { this.$store.dispatch('instance/fetchSettings') let self = this @@ -58,6 +69,23 @@ export default { // used to redraw ago dates every minute self.$store.commit('ui/computeLastDate') }, 1000 * 60) + this.fetchNodeInfo() + }, + methods: { + fetchNodeInfo () { + let self = this + axios.get('instance/nodeinfo/2.0/').then(response => { + self.nodeinfo = response.data + }) + } + }, + computed: { + version () { + if (!this.nodeinfo) { + return null + } + return _.get(this.nodeinfo, 'software.version') + } } } </script> -- GitLab