mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Allowed version build info to be shown in Admin
refs https://ghost.slack.com/archives/C02G9E68C/p1679577089441659 - this allows the full Ghost version through the API so we can extract the build info from it and provide a link to GitHub
This commit is contained in:
parent
3432857f9a
commit
db998e20ec
2 changed files with 5 additions and 10 deletions
|
@ -1,6 +1,6 @@
|
||||||
import Component from '@glimmer/component';
|
import Component from '@glimmer/component';
|
||||||
import config from 'ghost-admin/config/environment';
|
import config from 'ghost-admin/config/environment';
|
||||||
import semver from 'semver';
|
import semverParse from 'semver/functions/parse';
|
||||||
import {inject} from 'ghost-admin/decorators/inject';
|
import {inject} from 'ghost-admin/decorators/inject';
|
||||||
import {inject as service} from '@ember/service';
|
import {inject as service} from '@ember/service';
|
||||||
|
|
||||||
|
@ -24,15 +24,10 @@ export default class AboutModal extends Component {
|
||||||
get linkToGitHubReleases() {
|
get linkToGitHubReleases() {
|
||||||
if (this.config.version.includes('-pre.')) {
|
if (this.config.version.includes('-pre.')) {
|
||||||
try {
|
try {
|
||||||
const semverVersion = semver.parse(this.config.version, {includePrerelease: true});
|
const semverVersion = semverParse(this.config.version, {includePrerelease: true});
|
||||||
|
|
||||||
// Ensure this follows our prerelease format
|
if (semverVersion && semverVersion.build?.[0]) {
|
||||||
if (semverVersion
|
return `https://github.com/TryGhost/Ghost/commit/${semverVersion.build[0]}`;
|
||||||
&& semverVersion.prerelease?.[0] === 'pre'
|
|
||||||
&& semverVersion.prerelease?.[1]
|
|
||||||
&& Number.isInteger(semverVersion.prerelease?.[2])
|
|
||||||
) {
|
|
||||||
return `https://github.com/TryGhost/Ghost/commit/${semverVersion.prerelease[1]}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -6,7 +6,7 @@ const ghostVersion = require('@tryghost/version');
|
||||||
|
|
||||||
module.exports = function getConfigProperties() {
|
module.exports = function getConfigProperties() {
|
||||||
const configProperties = {
|
const configProperties = {
|
||||||
version: ghostVersion.full,
|
version: ghostVersion.original,
|
||||||
environment: config.get('env'),
|
environment: config.get('env'),
|
||||||
database: databaseInfo.getEngine(),
|
database: databaseInfo.getEngine(),
|
||||||
mail: isPlainObject(config.get('mail')) ? config.get('mail').transport : '',
|
mail: isPlainObject(config.get('mail')) ? config.get('mail').transport : '',
|
||||||
|
|
Loading…
Add table
Reference in a new issue