WhatsNew: Save build creation time, use as displayed date

This commit is contained in:
Scott Nonnenberg 2021-09-13 12:00:32 -07:00 committed by GitHub
parent 240585ef94
commit 29a3a2ac58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 3 deletions

View File

@ -158,10 +158,11 @@ module.exports = grunt => {
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;
const buildCreation = Date.parse(committed);
const buildExpiration = buildCreation + 1000 * 60 * 60 * 24 * 90;
grunt.file.write(
'config/local-production.json',
`${JSON.stringify({ buildExpiration: time })}\n`
`${JSON.stringify({ buildCreation, buildExpiration })}\n`
);
});

View File

@ -15,6 +15,7 @@
"updatesEnabled": false,
"enableCI": false,
"openDevTools": false,
"buildCreation": 0,
"buildExpiration": 0,
"certificateAuthority": "-----BEGIN CERTIFICATE-----\nMIID7zCCAtegAwIBAgIJAIm6LatK5PNiMA0GCSqGSIb3DQEBBQUAMIGNMQswCQYD\nVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5j\naXNjbzEdMBsGA1UECgwUT3BlbiBXaGlzcGVyIFN5c3RlbXMxHTAbBgNVBAsMFE9w\nZW4gV2hpc3BlciBTeXN0ZW1zMRMwEQYDVQQDDApUZXh0U2VjdXJlMB4XDTEzMDMy\nNTIyMTgzNVoXDTIzMDMyMzIyMTgzNVowgY0xCzAJBgNVBAYTAlVTMRMwEQYDVQQI\nDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMR0wGwYDVQQKDBRP\ncGVuIFdoaXNwZXIgU3lzdGVtczEdMBsGA1UECwwUT3BlbiBXaGlzcGVyIFN5c3Rl\nbXMxEzARBgNVBAMMClRleHRTZWN1cmUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw\nggEKAoIBAQDBSWBpOCBDF0i4q2d4jAXkSXUGpbeWugVPQCjaL6qD9QDOxeW1afvf\nPo863i6Crq1KDxHpB36EwzVcjwLkFTIMeo7t9s1FQolAt3mErV2U0vie6Ves+yj6\ngrSfxwIDAcdsKmI0a1SQCZlr3Q1tcHAkAKFRxYNawADyps5B+Zmqcgf653TXS5/0\nIPPQLocLn8GWLwOYNnYfBvILKDMItmZTtEbucdigxEA9mfIvvHADEbteLtVgwBm9\nR5vVvtwrD6CCxI3pgH7EH7kMP0Od93wLisvn1yhHY7FuYlrkYqdkMvWUrKoASVw4\njb69vaeJCUdU+HCoXOSP1PQcL6WenNCHAgMBAAGjUDBOMB0GA1UdDgQWBBQBixjx\nP/s5GURuhYa+lGUypzI8kDAfBgNVHSMEGDAWgBQBixjxP/s5GURuhYa+lGUypzI8\nkDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQB+Hr4hC56m0LvJAu1R\nK6NuPDbTMEN7/jMojFHxH4P3XPFfupjR+bkDq0pPOU6JjIxnrD1XD/EVmTTaTVY5\niOheyv7UzJOefb2pLOc9qsuvI4fnaESh9bhzln+LXxtCrRPGhkxA1IMIo3J/s2WF\n/KVYZyciu6b4ubJ91XPAuBNZwImug7/srWvbpk0hq6A6z140WTVSKtJG7EP41kJe\n/oF4usY5J7LPkxK3LWzMJnb5EIJDmRvyH8pyRwWg6Qm6qiGFaI4nL8QU4La1x2en\n4DGXRaLMPRwjELNgQPodR38zoCMuA8gHZfZYYoZ7D7Q1wNUiVHcxuFrEeBaYJbLE\nrwLV\n-----END CERTIFICATE-----\n",
"import": false,

View File

@ -253,6 +253,7 @@ function prepareUrl(
name: packageJson.productName,
locale: locale.name,
version: app.getVersion(),
buildCreation: config.get('buildCreation'),
buildExpiration: config.get('buildExpiration'),
serverUrl: config.get('serverUrl'),
storageUrl: config.get('storageUrl'),

View File

@ -13,6 +13,7 @@ try {
const semver = require('semver');
const _ = require('lodash');
const { strictAssert } = require('./ts/util/assert');
const { parseIntWithFallback } = require('./ts/util/parseIntWithFallback');
// It is important to call this as early as possible
require('./ts/windows/context');
@ -58,6 +59,7 @@ try {
window.getEnvironment = getEnvironment;
window.getAppInstance = () => config.appInstance;
window.getVersion = () => config.version;
window.getBuildCreation = () => parseIntWithFallback(config.buildCreation, 0);
window.getExpiration = () => {
const sixtyDays = 60 * 86400 * 1000;
const remoteBuildExpiration = window.storage.get('remoteBuildExpiration');

View File

@ -26,7 +26,7 @@ export const WhatsNew = ({ i18n }: PropsType): JSX.Element => {
const viewReleaseNotes = () => {
setReleaseNotes({
date: new Date('09/02/2021'),
date: new Date(window.getBuildCreation?.() || Date.now()),
version: window.getVersion(),
features: ['WhatsNew__v5.17--1', 'WhatsNew__v5.17--2'],
});

1
ts/window.d.ts vendored
View File

@ -199,6 +199,7 @@ declare global {
getAccountManager: () => AccountManager;
getBuiltInImages: () => Promise<Array<string>>;
getConversations: () => ConversationModelCollectionType;
getBuildCreation: () => number;
getEnvironment: typeof getEnvironment;
getExpiration: () => string;
getGuid: () => string;