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
This commit is contained in:
Shpuld Shpludson 2019-03-21 15:25:59 +00:00
commit 57cd6f8018
6 changed files with 61 additions and 4 deletions

View file

@ -203,6 +203,12 @@ const getNodeInfo = async ({ store }) => {
const suggestions = metadata.suggestions const suggestions = metadata.suggestions
store.dispatch('setInstanceOption', { name: 'suggestionsEnabled', value: suggestions.enabled }) store.dispatch('setInstanceOption', { name: 'suggestionsEnabled', value: suggestions.enabled })
store.dispatch('setInstanceOption', { name: 'suggestionsWeb', value: suggestions.web }) 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 { } else {
throw (res) throw (res)
} }

View file

@ -1,8 +1,13 @@
/* eslint-env browser */ /* eslint-env browser */
import { filter, trim } from 'lodash'
import TabSwitcher from '../tab_switcher/tab_switcher.js' import TabSwitcher from '../tab_switcher/tab_switcher.js'
import StyleSwitcher from '../style_switcher/style_switcher.vue' import StyleSwitcher from '../style_switcher/style_switcher.vue'
import InterfaceLanguageSwitcher from '../interface_language_switcher/interface_language_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 = { const settings = {
data () { data () {
@ -78,7 +83,10 @@ const settings = {
// Future spec, still not supported in Nightly 63 as of 08/2018 // Future spec, still not supported in Nightly 63 as of 08/2018
Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, 'audioTracks'), Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, 'audioTracks'),
playVideosInModal: user.playVideosInModal, playVideosInModal: user.playVideosInModal,
useContainFit: user.useContainFit useContainFit: user.useContainFit,
backendVersion: instance.backendVersion,
frontendVersion: instance.frontendVersion
} }
}, },
components: { components: {
@ -96,7 +104,13 @@ const settings = {
postFormats () { postFormats () {
return this.$store.state.instance.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: { watch: {
hideAttachmentsLocal (value) { hideAttachmentsLocal (value) {

View file

@ -261,6 +261,28 @@
</div> </div>
</div> </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> </tab-switcher>
</keep-alive> </keep-alive>
</div> </div>

View file

@ -347,6 +347,11 @@
"checkbox": "I have skimmed over terms and conditions", "checkbox": "I have skimmed over terms and conditions",
"link": "a nice lil' link" "link": "a nice lil' link"
} }
},
"version": {
"title": "Version",
"backend_version": "Backend Version",
"frontend_version": "Frontend Version"
} }
}, },
"timeline": { "timeline": {

View file

@ -48,7 +48,11 @@ const defaultState = {
// Html stuff // Html stuff
instanceSpecificPanelContent: '', instanceSpecificPanelContent: '',
tos: '' tos: '',
// Version Information
backendVersion: '',
frontendVersion: ''
} }
const instance = { const instance = {

View file

@ -0,0 +1,6 @@
export const extractCommit = versionString => {
const regex = /-g(\w+)$/i
const matches = versionString.match(regex)
return matches ? matches[1] : ''
}