diff --git a/gulpfile.ts b/gulpfile.ts index 7b612945..dfcfde6a 100644 --- a/gulpfile.ts +++ b/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')); diff --git a/src/backend/server.ts b/src/backend/server.ts index 4315ce77..6b5a8bc7 100644 --- a/src/backend/server.ts +++ b/src/backend/server.ts @@ -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(); diff --git a/src/common/config/public/ConfigClass.ts b/src/common/config/public/ConfigClass.ts index 02047374..b74911d9 100644 --- a/src/common/config/public/ConfigClass.ts +++ b/src/common/config/public/ConfigClass.ts @@ -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 diff --git a/src/frontend/app/ui/admin/admin.component.html b/src/frontend/app/ui/admin/admin.component.html index 4d675d92..f3072d0a 100644 --- a/src/frontend/app/ui/admin/admin.component.html +++ b/src/frontend/app/ui/admin/admin.component.html @@ -22,7 +22,7 @@