Format links and show title in the in-app changelog (#5045)

This commit is contained in:
absidue 2024-05-14 02:41:27 +02:00 committed by GitHub
parent f462777a3b
commit a9c9f10059
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 1 deletions

View File

@ -227,7 +227,17 @@ export default defineComponent({
.then((json) => {
const tagName = json[0].tag_name
const versionNumber = tagName.replace('v', '').replace('-beta', '')
this.updateChangelog = marked.parse(json[0].body)
let changelog = json[0].body
// Link usernames to their GitHub profiles
.replaceAll(/@(\S+)\b/g, '[@$1](https://github.com/$1)')
// Shorten pull request links to #1234
.replaceAll(/https:\/\/github\.com\/FreeTubeApp\/FreeTube\/pull\/(\d+)/g, '[#$1]($&)')
// Add the title
changelog = `# ${json[0].name}\n${changelog}`
this.updateChangelog = marked.parse(changelog)
this.changeLogTitle = json[0].name
this.updateBannerMessage = this.$t('Version {versionNumber} is now available! Click for more details', { versionNumber })