Show commit hash in About window for beta builds

pull/238/head
sachaaaaa 6 years ago
parent 55e0ff1a88
commit 37f0fced29

@ -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',
]);
};

@ -36,6 +36,7 @@
<img src='images/icon_256.png' width='250' height='250'>
<div class='version'></div>
<div class='commitHash'></div>
<div class='environment'></div>
<div>
<a href="https://loki.network">loki.network</a>

@ -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');

@ -8,6 +8,7 @@
"disableAutoUpdate": false,
"openDevTools": false,
"buildExpiration": 0,
"commitHash": "",
"certificateAuthority":
"-----BEGIN CERTIFICATE-----\nMIID7zCCAtegAwIBAgIJAIm6LatK5PNiMA0GCSqGSIb3DQEBBQUAMIGNMQswCQYD\nVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYT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Io3J/s2WF\n/KVYZyciu6b4ubJ91XPAuBNZwImug7/srWvbpk0hq6A6z140WTVSKtJG7EP41kJe\n/oF4usY5J7LPkxK3LWzMJnb5EIJDmRvyH8pyRwWg6Qm6qiGFaI4nL8QU4La1x2en\n4DGXRaLMPRwjELNgQPodR38zoCMuA8gHZfZYYoZ7D7Q1wNUiVHcxuFrEeBaYJbLE\nrwLV\n-----END CERTIFICATE-----\n",
"import": false,

@ -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 = [];

@ -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'),

@ -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",

@ -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;

Loading…
Cancel
Save