Compare versions properly

This commit is contained in:
varjolintu 2021-03-28 20:46:52 +03:00
parent 015b209412
commit b1faeddbd8
2 changed files with 12 additions and 2 deletions

View file

@ -194,12 +194,17 @@ kpxcEvent.pageClearLogins = async function(tab, alreadyCalled) {
}
};
kpxcEvent.compareVersion = async function(tab, args = []) {
return keepass.compareVersion(args[0], args[1]);
};
// All methods named in this object have to be declared BEFORE this!
kpxcEvent.messageHandlers = {
'add_credentials': keepass.addCredentials,
'associate': keepass.associate,
'check_database_hash': keepass.checkDatabaseHash,
'check_update_keepassxc': kpxcEvent.onCheckUpdateKeePassXC,
'compare_version': kpxcEvent.compareVersion,
'create_new_group': keepass.createNewGroup,
'enable_automatic_reconnect': keepass.enableAutomaticReconnect,
'disable_automatic_reconnect': keepass.disableAutomaticReconnect,

View file

@ -263,7 +263,7 @@ options.initGeneralSettings = function() {
}
};
options.showKeePassXCVersions = function(response) {
options.showKeePassXCVersions = async function(response) {
if (response.current === '') {
response.current = 'unknown';
}
@ -276,7 +276,12 @@ options.showKeePassXCVersions = function(response) {
$('#tab-about span.kpxcVersion').text(response.current);
$('#tab-general-settings button.checkUpdateKeePassXC:first').attr('disabled', false);
if (response.current.startsWith('2.6') || response.current.includes('snapshot')) {
const result = await browser.runtime.sendMessage({
action: 'compare_version',
args: [ '2.6.0', response.current ]
});
if (result) {
$('#tab-general-settings #versionRequiredAlert').hide();
} else {
$('#tab-general-settings #showGroupNameInAutocomplete').attr('disabled', true);