commit: 70d925a9be7a921ddd5591df477ba1b80b812ad5
parent 989dc691618b4849bc9ad10865fe54ce7e4f233c
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 9 Nov 2023 08:27:58 +0100
Extract backend repository from nodeinfo
Also removes extractCommit, could be kept when the forge is git.pleroma.social
Diffstat:
6 files changed, 5 insertions(+), 25 deletions(-)
diff --git a/src/boot/after_store.js b/src/boot/after_store.js
@@ -241,7 +241,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
diff --git a/src/components/settings_modal/tabs/version_tab.js b/src/components/settings_modal/tabs/version_tab.js
@@ -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)
}
}
}
diff --git a/src/components/settings_modal/tabs/version_tab.vue b/src/components/settings_modal/tabs/version_tab.vue
@@ -7,7 +7,7 @@
<ul class="option-list">
<li>
<a
- :href="backendVersionLink"
+ :href="backendRepository"
target="_blank"
>{{ backendVersion }}</a>
</li>
diff --git a/src/modules/instance.js b/src/modules/instance.js
@@ -151,6 +151,7 @@ const defaultState = {
// Version Information
backendVersion: '',
+ backendRepository: '',
frontendVersion: '',
pollsAvailable: false,
diff --git a/src/services/version/version.service.js b/src/services/version/version.service.js
@@ -1,6 +0,0 @@
-
-export const extractCommit = versionString => {
- const regex = /-g(\w+)/i
- const matches = versionString.match(regex)
- return matches ? matches[1] : ''
-}
diff --git a/test/unit/specs/services/version/version.service.spec.js b/test/unit/specs/services/version/version.service.spec.js
@@ -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')
- })
-})