commit: e4a1a56dbdc1a2636b544378da890335dbafcf93
parent 7e92c4c1a32a5c32a99973e33c5e2c86124172ce
Author: HJ <30-hj@users.noreply.git.pleroma.social>
Date: Wed, 11 Dec 2024 13:35:27 +0000
Merge branch 'backend-repo-url' into 'develop'
Extract backend repository from nodeinfo
See merge request pleroma/pleroma-fe!1864
Diffstat:
7 files changed, 5 insertions(+), 25 deletions(-)
diff --git a/changelog.d/backend-repo-url.skip b/changelog.d/backend-repo-url.skip
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
@@ -278,6 +278,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
@@ -154,6 +154,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')
- })
-})