forked from AkkomaGang/akkoma-fe
Added new tab to display versions of BE/FE
This commit is contained in:
parent
841648676c
commit
068c9724e4
6 changed files with 63 additions and 3 deletions
src
boot
components/settings
i18n
modules
services/version
|
@ -176,6 +176,12 @@ const afterStoreSetup = ({ store, i18n }) => {
|
|||
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 })
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
/* 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 { parseBackendVersionString, parseFrontendVersionString } from '../../services/version/version.service'
|
||||
|
||||
const settings = {
|
||||
data () {
|
||||
|
@ -78,7 +80,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: {
|
||||
|
@ -98,6 +103,14 @@ const settings = {
|
|||
},
|
||||
instanceSpecificPanelPresent () { return this.$store.state.instance.showInstanceSpecificPanel }
|
||||
},
|
||||
methods: {
|
||||
parseBackendVersion (versionString) {
|
||||
return parseBackendVersionString(versionString)
|
||||
},
|
||||
parseFrontendVersion (versionString) {
|
||||
return parseFrontendVersionString(versionString)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
hideAttachmentsLocal (value) {
|
||||
this.$store.dispatch('setOption', { name: 'hideAttachments', value })
|
||||
|
|
|
@ -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>
|
||||
<div v-html="parseBackendVersion(backendVersion)"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>{{$t('settings.version.frontend_version')}}</p>
|
||||
<ul class="option-list">
|
||||
<li>
|
||||
<div v-html="parseFrontendVersion(frontendVersion)"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</tab-switcher>
|
||||
</keep-alive>
|
||||
</div>
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -48,7 +48,11 @@ const defaultState = {
|
|||
|
||||
// Html stuff
|
||||
instanceSpecificPanelContent: '',
|
||||
tos: ''
|
||||
tos: '',
|
||||
|
||||
// Version Information
|
||||
backendVersion: '',
|
||||
frontendVersion: ''
|
||||
}
|
||||
|
||||
const instance = {
|
||||
|
|
10
src/services/version/version.service.js
Normal file
10
src/services/version/version.service.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
export const parseBackendVersionString = versionString => {
|
||||
const regex = /(-g)(\w+)$/i
|
||||
const replacer = '$1<a href="https://git.pleroma.social/pleroma/pleroma/commit/$2" target="_blank">$2</a>'
|
||||
return versionString.replace(regex, replacer)
|
||||
}
|
||||
|
||||
export const parseFrontendVersionString = versionString => {
|
||||
return `<a href="https://git.pleroma.social/pleroma/pleroma-fe/commit/${versionString}" target="_blank">#${versionString}</a>`
|
||||
}
|
Loading…
Reference in a new issue