diff --git a/Gruntfile.js b/Gruntfile.js index 97ee125bd..1121a22b5 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -265,15 +265,35 @@ module.exports = grunt => { }); }); + function updateLocalConfig(update) { + const environment = process.env.SIGNAL_ENV || 'development'; + const configPath = `config/local-${environment}.json`; + let localConfig; + try { + localConfig = grunt.file.readJSON(configPath); + } catch (e) { + // + } + localConfig = { + ...localConfig, + ...update, + }; + grunt.file.write(configPath, `${JSON.stringify(localConfig)}\n`); + } + grunt.registerTask('getExpireTime', () => { grunt.task.requires('gitinfo'); const gitinfo = grunt.config.get('gitinfo'); const committed = gitinfo.local.branch.current.lastCommitTime; const time = Date.parse(committed) + 1000 * 60 * 60 * 24 * 90; - grunt.file.write( - 'config/local-production.json', - `${JSON.stringify({ buildExpiration: time })}\n` - ); + updateLocalConfig({ buildExpiration: time }); + }); + + grunt.registerTask('getCommitHash', () => { + grunt.task.requires('gitinfo'); + const gitinfo = grunt.config.get('gitinfo'); + const hash = gitinfo.local.branch.current.SHA; + updateLocalConfig({ commitHash: hash }); }); grunt.registerTask('clean-release', () => { @@ -505,5 +525,6 @@ module.exports = grunt => { 'copy:deps', 'sass', 'date', + 'getCommitHash', ]); }; diff --git a/about.html b/about.html index 7e2b15653..7e296de61 100644 --- a/about.html +++ b/about.html @@ -36,6 +36,7 @@
+
loki.network diff --git a/about_preload.js b/about_preload.js index 557d7ad32..c39456347 100644 --- a/about_preload.js +++ b/about_preload.js @@ -10,6 +10,7 @@ const localeMessages = ipcRenderer.sendSync('locale-data'); window.getEnvironment = () => config.environment; window.getVersion = () => config.version; +window.getCommitHash = () => config.commitHash; window.getAppInstance = () => config.appInstance; window.closeAbout = () => ipcRenderer.send('close-about'); diff --git a/config/default.json b/config/default.json index 77de93748..8b7d786f9 100644 --- a/config/default.json +++ b/config/default.json @@ -8,6 +8,7 @@ "disableAutoUpdate": false, "openDevTools": false, "buildExpiration": 0, + "commitHash": "", "certificateAuthority": "-----BEGIN CERTIFICATE-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/jMojFHxH4P3XPFfupjR+bkDq0pPOU6JjIxnrD1XD/EVmTTaTVY5\niOheyv7UzJOefb2pLOc9qsuvI4fnaESh9bhzln+LXxtCrRPGhkxA1IMIo3J/s2WF\n/KVYZyciu6b4ubJ91XPAuBNZwImug7/srWvbpk0hq6A6z140WTVSKtJG7EP41kJe\n/oF4usY5J7LPkxK3LWzMJnb5EIJDmRvyH8pyRwWg6Qm6qiGFaI4nL8QU4La1x2en\n4DGXRaLMPRwjELNgQPodR38zoCMuA8gHZfZYYoZ7D7Q1wNUiVHcxuFrEeBaYJbLE\nrwLV\n-----END CERTIFICATE-----\n", "import": false, diff --git a/js/about_start.js b/js/about_start.js index 60e649ba1..311b3ed48 100644 --- a/js/about_start.js +++ b/js/about_start.js @@ -1,7 +1,12 @@ /* global $: false */ // Add version -$('.version').text(`v${window.getVersion()}`); +const version = window.getVersion(); +$('.version').text(`v${version}`); + +if (/beta/.test(version)) { + $('.commitHash').text(window.getCommitHash()); +} // Add debugging metadata - environment if not production, app instance name const states = []; diff --git a/main.js b/main.js index 5e59c8eca..4c0bdc488 100644 --- a/main.js +++ b/main.js @@ -143,6 +143,7 @@ function prepareURL(pathSegments, moreKeys) { locale: locale.name, version: app.getVersion(), buildExpiration: config.get('buildExpiration'), + commitHash: config.get('commitHash'), serverUrl: config.get('serverUrl'), localUrl: config.get('localUrl'), cdnUrl: config.get('cdnUrl'), diff --git a/package.json b/package.json index 23d4eb2a8..3522f979f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "Loki Messenger", "description": "Private messaging from your desktop", "repository": "https://github.com/sloki-project/loki-messenger.git", - "version": "1.21.1", + "version": "0.0.0-beta1", "license": "GPL-3.0", "author": { "name": "Open Whisper Systems", diff --git a/preload.js b/preload.js index 9f7f90f8e..7b641e8bc 100644 --- a/preload.js +++ b/preload.js @@ -26,6 +26,7 @@ window.getAppInstance = () => config.appInstance; window.getVersion = () => config.version; window.isImportMode = () => config.importMode; window.getExpiration = () => config.buildExpiration; +window.getCommitHash = () => config.commitHash; window.getNodeVersion = () => config.node_version; window.getHostName = () => config.hostname; window.getServerTrustRoot = () => config.serverTrustRoot;