mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-01-23 15:18:30 +00:00
Old build detection: bump to 90 days, let packagers customize message
This commit is contained in:
parent
d0ab749bd6
commit
da06d933df
@ -29,7 +29,7 @@ if (require('electron-squirrel-startup')) {
|
|||||||
|
|
||||||
const appArgs = JSON.parse(fs.readFileSync(APP_ARGS_FILE_PATH, 'utf8'));
|
const appArgs = JSON.parse(fs.readFileSync(APP_ARGS_FILE_PATH, 'utf8'));
|
||||||
|
|
||||||
const OLD_BUILD_WARNING_THRESHOLD_DAYS = 60;
|
const OLD_BUILD_WARNING_THRESHOLD_DAYS = 90;
|
||||||
const OLD_BUILD_WARNING_THRESHOLD_MS =
|
const OLD_BUILD_WARNING_THRESHOLD_MS =
|
||||||
OLD_BUILD_WARNING_THRESHOLD_DAYS * 24 * 60 * 60 * 1000;
|
OLD_BUILD_WARNING_THRESHOLD_DAYS * 24 * 60 * 60 * 1000;
|
||||||
|
|
||||||
@ -222,12 +222,14 @@ if (shouldQuit) {
|
|||||||
!appArgs.disableOldBuildWarning &&
|
!appArgs.disableOldBuildWarning &&
|
||||||
new Date().getTime() - appArgs.buildDate > OLD_BUILD_WARNING_THRESHOLD_MS
|
new Date().getTime() - appArgs.buildDate > OLD_BUILD_WARNING_THRESHOLD_MS
|
||||||
) {
|
) {
|
||||||
|
const oldBuildWarningText =
|
||||||
|
appArgs.oldBuildWarningText ||
|
||||||
|
'This app was built a long time ago. Nativefier uses the Chrome browser (through Electron), and it is insecure to keep using an old version of it. Please upgrade Nativefier and rebuild this app.';
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
dialog.showMessageBox(null, {
|
dialog.showMessageBox(null, {
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
message: 'Old build detected',
|
message: 'Old build detected',
|
||||||
detail:
|
detail: oldBuildWarningText,
|
||||||
'This app was built a long time ago. Nativefier uses the Chrome browser (through Electron), and it is insecure to keep using an old version of it. Please upgrade Nativefier and rebuild this app.',
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -69,6 +69,12 @@ function pickElectronAppArgs(options: AppOptions): any {
|
|||||||
y: options.nativefier.y,
|
y: options.nativefier.y,
|
||||||
zoom: options.nativefier.zoom,
|
zoom: options.nativefier.zoom,
|
||||||
buildDate: new Date().getTime(),
|
buildDate: new Date().getTime(),
|
||||||
|
// OLD_BUILD_WARNING_TEXT is an undocumented env. var to let *packagers*
|
||||||
|
// tweak the message shown on warning about an old build, to something
|
||||||
|
// more tailored to their audience (who might not even know Nativefier).
|
||||||
|
// See https://github.com/kelyvin/Google-Messages-For-Desktop/issues/34#issuecomment-812731144
|
||||||
|
// and https://github.com/nativefier/nativefier/issues/1131#issuecomment-812646988
|
||||||
|
oldBuildWarningText: process.env.OLD_BUILD_WARNING_TEXT || '',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user