Merge pull request #1848 from keepassxreboot/fix/check_for_updates

Make sure checkUpdateKeePassXC is an integer
This commit is contained in:
Sami Vänttinen 2023-02-10 14:27:06 +02:00 committed by GitHub
commit ce4f5828d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -137,7 +137,7 @@ kpxcEvent.onCheckUpdateKeePassXC = async function() {
};
kpxcEvent.onUpdateAvailableKeePassXC = async function() {
return (page.settings.checkUpdateKeePassXC !== CHECK_UPDATE_NEVER) ? keepass.keePassXCUpdateAvailable() : false;
return (Number(page.settings.checkUpdateKeePassXC) !== CHECK_UPDATE_NEVER) ? keepass.keePassXCUpdateAvailable() : false;
};
kpxcEvent.onRemoveCredentialsFromTabInformation = async function(tab) {

View file

@ -800,10 +800,11 @@ keepass.setcurrentKeePassXCVersion = function(version) {
};
keepass.keePassXCUpdateAvailable = function() {
if (page.settings.checkUpdateKeePassXC && page.settings.checkUpdateKeePassXC !== CHECK_UPDATE_NEVER) {
const checkUpdate = Number(page.settings.checkUpdateKeePassXC);
if (checkUpdate !== CHECK_UPDATE_NEVER) {
const lastChecked = (keepass.latestKeePassXC.lastChecked) ? new Date(keepass.latestKeePassXC.lastChecked) : new Date(1986, 11, 21);
const daysSinceLastCheck = Math.floor(((new Date()).getTime() - lastChecked.getTime()) / 86400000);
if (daysSinceLastCheck >= page.settings.checkUpdateKeePassXC) {
if (daysSinceLastCheck >= checkUpdate) {
keepass.checkForNewKeePassXCVersion();
}