Compare commits

...

1 Commits

Author SHA1 Message Date
Haelwenn (lanodan) Monnier 84cab03a1d Extract backend repository from nodeinfo
Also removes extractCommit, could be kept when the forge is git.pleroma.social

Partial fix of https://git.pleroma.social/pleroma/pleroma-fe/-/issues/1283
2023-11-09 08:45:07 +01:00
7 changed files with 5 additions and 25 deletions

View File

View File

@ -242,7 +242,7 @@ const resolveStaffAccounts = ({ store, accounts }) => {
const getNodeInfo = async ({ store }) => {
try {
const res = await preloadFetch('/nodeinfo/2.0.json')
const res = await preloadFetch('/nodeinfo/2.1.json')
if (res.ok) {
const data = await res.json()
const metadata = data.metadata
@ -277,6 +277,7 @@ const getNodeInfo = async ({ store }) => {
const software = data.software
store.dispatch('setInstanceOption', { name: 'backendVersion', value: software.version })
store.dispatch('setInstanceOption', { name: 'backendRepository', value: software.repository })
store.dispatch('setInstanceOption', { name: 'pleromaBackend', value: software.name === 'pleroma' })
const priv = metadata.private

View File

@ -1,22 +1,17 @@
import { extractCommit } from 'src/services/version/version.service'
const pleromaFeCommitUrl = 'https://git.pleroma.social/pleroma/pleroma-fe/commit/'
const pleromaBeCommitUrl = 'https://git.pleroma.social/pleroma/pleroma/commit/'
const VersionTab = {
data () {
const instance = this.$store.state.instance
return {
backendVersion: instance.backendVersion,
backendRepository: instance.backendRepository,
frontendVersion: instance.frontendVersion
}
},
computed: {
frontendVersionLink () {
return pleromaFeCommitUrl + this.frontendVersion
},
backendVersionLink () {
return pleromaBeCommitUrl + extractCommit(this.backendVersion)
}
}
}

View File

@ -7,7 +7,7 @@
<ul class="option-list">
<li>
<a
:href="backendVersionLink"
:href="backendRepository"
target="_blank"
>{{ backendVersion }}</a>
</li>

View File

@ -141,6 +141,7 @@ const defaultState = {
// Version Information
backendVersion: '',
backendRepository: '',
frontendVersion: '',
pollsAvailable: false,

View File

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

View File

@ -1,11 +0,0 @@
import { extractCommit } from 'src/services/version/version.service.js'
describe('extractCommit', () => {
it('return short commit hash following "-g" characters', () => {
expect(extractCommit('1.0.0-45-g5e7aeebc')).to.eql('5e7aeebc')
})
it('return short commit hash without branch name', () => {
expect(extractCommit('1.0.0-45-g5e7aeebc-branch')).to.eql('5e7aeebc')
})
})