From adc6b86e6b9255f840ff25310df564e6ba72b278 Mon Sep 17 00:00:00 2001 From: Sol Fisher Romanoff Date: Tue, 14 Jun 2022 22:06:02 +0300 Subject: [PATCH] Correctly link to BE commit in version tab --- .../settings_modal/tabs/version_tab.js | 2 +- src/services/version/version.service.js | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/components/settings_modal/tabs/version_tab.js b/src/components/settings_modal/tabs/version_tab.js index d69b131d..ce0b4d35 100644 --- a/src/components/settings_modal/tabs/version_tab.js +++ b/src/components/settings_modal/tabs/version_tab.js @@ -1,7 +1,7 @@ import { extractCommit } from 'src/services/version/version.service' const pleromaFeCommitUrl = 'https://akkoma.dev/AkkomaGang/pleroma-fe/commit/' -const pleromaBeCommitUrl = 'https://akkoma.dev/AkkomaGang/akkoma/commit/' +const pleromaBeCommitUrl = 'https://akkoma.dev/AkkomaGang/akkoma/commits/' const VersionTab = { data () { diff --git a/src/services/version/version.service.js b/src/services/version/version.service.js index 2e11bf3a..2432738c 100644 --- a/src/services/version/version.service.js +++ b/src/services/version/version.service.js @@ -1,6 +1,17 @@ export const extractCommit = versionString => { - const regex = /-g(\w+)/i - const matches = versionString.match(regex) - return matches ? matches[1] : '' + // X.Y.Z-1337-gdeadbeef => deadbeef + const commit = versionString.match(/-g(\w+)/i) + if (commit) { + return commit[1] + } + + // X.Y.Z-develop => develop + const branch = versionString.match(/-([\w-/]+)$/i) + if (branch) { + return branch[1] + } + + // X.Y.Z => vX.Y.Z + return 'v' + versionString }