mirror of
https://github.com/bpatrik/pigallery2.git
synced 2024-11-24 08:42:24 +02:00
adding git commit hash and built time to release package.json and showing it at admin
This commit is contained in:
parent
97c8f41fa3
commit
d38d0f01bf
11
gulpfile.ts
11
gulpfile.ts
@ -117,7 +117,9 @@ gulp.task('copy-package', function () {
|
||||
devDependencies: { [key: string]: string },
|
||||
scripts: { [key: string]: string },
|
||||
dependencies: { [key: string]: string },
|
||||
optionalDependencies: { [key: string]: string }
|
||||
optionalDependencies: { [key: string]: string },
|
||||
buildTime: string,
|
||||
buildCommitHash: string
|
||||
}) => {
|
||||
delete json.devDependencies;
|
||||
json.scripts = {start: 'node ./src/backend/index.js'};
|
||||
@ -139,6 +141,13 @@ gulp.task('copy-package', function () {
|
||||
}
|
||||
delete json.optionalDependencies;
|
||||
}
|
||||
json.buildTime = (new Date()).toISOString();
|
||||
|
||||
try {
|
||||
json.buildCommitHash = require('child_process').execSync('git rev-parse HEAD');
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
return json;
|
||||
}))
|
||||
.pipe(gulp.dest('./release'));
|
||||
|
@ -41,6 +41,8 @@ export class Server {
|
||||
await ConfigDiagnostics.runDiagnostics();
|
||||
Logger.verbose(LOG_TAG, 'using config:');
|
||||
Config.Client.appVersion = require('../../package.json').version;
|
||||
Config.Client.buildTime = require('../../package.json').buildTime;
|
||||
Config.Client.buildCommitHash = require('../../package.json').buildCommitHash;
|
||||
Logger.verbose(LOG_TAG, JSON.stringify(Config, null, '\t'));
|
||||
|
||||
this.app = _express();
|
||||
|
@ -92,6 +92,8 @@ export module ClientConfig {
|
||||
|
||||
export interface Config {
|
||||
appVersion: string;
|
||||
buildTime: string;
|
||||
buildCommitHash: string;
|
||||
applicationTitle: string;
|
||||
publicUrl: string;
|
||||
urlBase: string;
|
||||
@ -118,6 +120,8 @@ export class PublicConfigClass {
|
||||
public Client: ClientConfig.Config = {
|
||||
applicationTitle: 'PiGallery 2',
|
||||
appVersion: '',
|
||||
buildCommitHash: '',
|
||||
buildTime: '',
|
||||
Media: {
|
||||
Video: {
|
||||
enabled: true
|
||||
|
@ -22,7 +22,7 @@
|
||||
</div>
|
||||
<div class="form-horizontal">
|
||||
<div class="d-flex justify-content-between">
|
||||
<a class="version" href="https://github.com/bpatrik/pigallery2/releases">
|
||||
<a title="{{versionExtra}}" class="version" href="https://github.com/bpatrik/pigallery2/releases">
|
||||
<span i18n>App version:</span> v<span>{{appVersion}}</span>
|
||||
</a>
|
||||
<div class="form-group">
|
||||
@ -55,7 +55,8 @@
|
||||
(click)="scrollTo(i)"
|
||||
[hidden]="!s.HasAvailableSettings">
|
||||
{{s.Name}}<!--
|
||||
--><ng-container *ngIf="s.Changed">*</ng-container>
|
||||
-->
|
||||
<ng-container *ngIf="s.Changed">*</ng-container>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {AfterViewInit, Component, ElementRef, OnInit, QueryList, ViewChildren} from '@angular/core';
|
||||
import {AfterViewInit, Component, ElementRef, Inject, LOCALE_ID, OnInit, QueryList, ViewChildren} from '@angular/core';
|
||||
import {AuthenticationService} from '../../model/network/authentication.service';
|
||||
import {UserRoles} from '../../../../common/entities/UserDTO';
|
||||
import {NotificationService} from '../../model/notification.service';
|
||||
@ -8,6 +8,7 @@ import {I18n} from '@ngx-translate/i18n-polyfill';
|
||||
import {Config} from '../../../../common/config/public/Config';
|
||||
import {ISettingsComponent} from '../settings/_abstract/ISettingsComponent';
|
||||
import {PageHelper} from '../../model/page.helper';
|
||||
import {formatDate} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-admin',
|
||||
@ -21,6 +22,9 @@ export class AdminComponent implements OnInit, AfterViewInit {
|
||||
Simplified: 'Simplified'
|
||||
};
|
||||
appVersion = Config.Client.appVersion;
|
||||
versionExtra = '';
|
||||
buildTime = Config.Client.buildTime;
|
||||
buildCommitHash = Config.Client.buildCommitHash;
|
||||
@ViewChildren('setting') settingsComponents: QueryList<ISettingsComponent>;
|
||||
@ViewChildren('setting', {read: ElementRef}) settingsComponents2: QueryList<ElementRef>;
|
||||
contents: ISettingsComponent[] = [];
|
||||
@ -28,9 +32,17 @@ export class AdminComponent implements OnInit, AfterViewInit {
|
||||
constructor(private _authService: AuthenticationService,
|
||||
private _navigation: NavigationService,
|
||||
public notificationService: NotificationService,
|
||||
@Inject(LOCALE_ID) private locale: string,
|
||||
public i18n: I18n) {
|
||||
this.text.Advanced = i18n('Advanced');
|
||||
this.text.Simplified = i18n('Simplified');
|
||||
if (Config.Client.buildTime) {
|
||||
this.versionExtra = i18n('Built at') + ': ' + formatDate(Config.Client.buildTime, 'medium', locale);
|
||||
}
|
||||
if (Config.Client.buildCommitHash) {
|
||||
this.versionExtra += ', ' + i18n('git hash') + ': ' + Config.Client.buildCommitHash;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
|
Loading…
Reference in New Issue
Block a user