logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe
commit: 57cd6f8018b87e427812ec0c460ef490c604c862
parent: 0659d2fd3a8dca5ff93f1b23be289ef063b2e5ca
Author: Shpuld Shpludson <shp@cock.li>
Date:   Thu, 21 Mar 2019 15:25:59 +0000

Merge branch 'feature/version-info' into 'develop'

Added new tab to display versions of BE/FE

Closes #397

See merge request pleroma/pleroma-fe!671

Diffstat:

Msrc/boot/after_store.js6++++++
Msrc/components/settings/settings.js20+++++++++++++++++---
Msrc/components/settings/settings.vue22++++++++++++++++++++++
Msrc/i18n/en.json5+++++
Msrc/modules/instance.js6+++++-
Asrc/services/version/version.service.js6++++++
6 files changed, 61 insertions(+), 4 deletions(-)

diff --git a/src/boot/after_store.js b/src/boot/after_store.js @@ -203,6 +203,12 @@ const getNodeInfo = async ({ store }) => { const suggestions = metadata.suggestions store.dispatch('setInstanceOption', { name: 'suggestionsEnabled', value: suggestions.enabled }) store.dispatch('setInstanceOption', { name: 'suggestionsWeb', value: suggestions.web }) + + const software = data.software + store.dispatch('setInstanceOption', { name: 'backendVersion', value: software.version }) + + const frontendVersion = window.___pleromafe_commit_hash + store.dispatch('setInstanceOption', { name: 'frontendVersion', value: frontendVersion }) } else { throw (res) } diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js @@ -1,8 +1,13 @@ /* eslint-env browser */ +import { filter, trim } from 'lodash' + import TabSwitcher from '../tab_switcher/tab_switcher.js' import StyleSwitcher from '../style_switcher/style_switcher.vue' import InterfaceLanguageSwitcher from '../interface_language_switcher/interface_language_switcher.vue' -import { filter, trim } from 'lodash' +import { extractCommit } from '../../services/version/version.service' + +const pleromaFeCommitUrl = 'https://git.pleroma.social/pleroma/pleroma-fe/commit/' +const pleromaBeCommitUrl = 'https://git.pleroma.social/pleroma/pleroma/commit/' const settings = { data () { @@ -78,7 +83,10 @@ const settings = { // Future spec, still not supported in Nightly 63 as of 08/2018 Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, 'audioTracks'), playVideosInModal: user.playVideosInModal, - useContainFit: user.useContainFit + useContainFit: user.useContainFit, + + backendVersion: instance.backendVersion, + frontendVersion: instance.frontendVersion } }, components: { @@ -96,7 +104,13 @@ const settings = { postFormats () { return this.$store.state.instance.postFormats || [] }, - instanceSpecificPanelPresent () { return this.$store.state.instance.showInstanceSpecificPanel } + instanceSpecificPanelPresent () { return this.$store.state.instance.showInstanceSpecificPanel }, + frontendVersionLink () { + return pleromaFeCommitUrl + this.frontendVersion + }, + backendVersionLink () { + return pleromaBeCommitUrl + extractCommit(this.backendVersion) + } }, watch: { hideAttachmentsLocal (value) { diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue @@ -261,6 +261,28 @@ </div> </div> </div> + <div :label="$t('settings.version.title')" > + <div class="setting-item"> + <ul class="setting-list"> + <li> + <p>{{$t('settings.version.backend_version')}}</p> + <ul class="option-list"> + <li> + <a :href="backendVersionLink" target="_blank">{{backendVersion}}</a> + </li> + </ul> + </li> + <li> + <p>{{$t('settings.version.frontend_version')}}</p> + <ul class="option-list"> + <li> + <a :href="frontendVersionLink" target="_blank">{{frontendVersion}}</a> + </li> + </ul> + </li> + </ul> + </div> + </div> </tab-switcher> </keep-alive> </div> diff --git a/src/i18n/en.json b/src/i18n/en.json @@ -347,6 +347,11 @@ "checkbox": "I have skimmed over terms and conditions", "link": "a nice lil' link" } + }, + "version": { + "title": "Version", + "backend_version": "Backend Version", + "frontend_version": "Frontend Version" } }, "timeline": { diff --git a/src/modules/instance.js b/src/modules/instance.js @@ -48,7 +48,11 @@ const defaultState = { // Html stuff instanceSpecificPanelContent: '', - tos: '' + tos: '', + + // Version Information + backendVersion: '', + frontendVersion: '' } const instance = { diff --git a/src/services/version/version.service.js b/src/services/version/version.service.js @@ -0,0 +1,6 @@ + +export const extractCommit = versionString => { + const regex = /-g(\w+)$/i + const matches = versionString.match(regex) + return matches ? matches[1] : '' +}