From afe66d365642d3d8e21400334998203f51b04a1a Mon Sep 17 00:00:00 2001 From: varjolintu Date: Thu, 2 Aug 2018 16:51:00 +0300 Subject: [PATCH] Add slash to URL from notification button --- keepassxc-browser/global.js | 6 ++++++ keepassxc-browser/keepassxc-browser.js | 6 +++++- keepassxc-browser/options/options.js | 8 +------- keepassxc-browser/popups/popup.css | 3 +++ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/keepassxc-browser/global.js b/keepassxc-browser/global.js index 23cbd06..826949a 100755 --- a/keepassxc-browser/global.js +++ b/keepassxc-browser/global.js @@ -90,4 +90,10 @@ var matchPatternToRegExp = function(pattern) { var siteMatch = function(site, url) { const rx = matchPatternToRegExp(site); return url.match(rx); +}; + +// Checks if URL has only scheme and host without the last / char. +var slashNeededForUrl = function(pattern) { + const matchPattern = new RegExp(`^${schemeSegment}://${hostSegment}$`); + return matchPattern.exec(pattern); }; \ No newline at end of file diff --git a/keepassxc-browser/keepassxc-browser.js b/keepassxc-browser/keepassxc-browser.js index 90c5e6d..1ed81b2 100755 --- a/keepassxc-browser/keepassxc-browser.js +++ b/keepassxc-browser/keepassxc-browser.js @@ -2053,9 +2053,13 @@ cip.ignoreSite = function(sites) { return; } - const site = sites[0]; + let site = sites[0]; cip.initializeSitePreferences(); + if (slashNeededForUrl(site)) { + site += '/'; + } + // Check if the site already exists let siteExists = false; for (const existingSite of cip.settings['sitePreferences']) { diff --git a/keepassxc-browser/options/options.js b/keepassxc-browser/options/options.js index 3d5f374..26b168e 100644 --- a/keepassxc-browser/options/options.js +++ b/keepassxc-browser/options/options.js @@ -314,7 +314,7 @@ options.initSitePreferences = function() { trClone.removeClass('clone'); // Fills the last / char if needed. This ensures the compatibility with Match Patterns - if (options.slashNeededForUrl(value)) { + if (slashNeededForUrl(value)) { value += '/'; } @@ -396,9 +396,3 @@ options.initAbout = function() { $('#default-pass-shortcut').show(); } }; - -// Checks if URL has only scheme and host without the last / char. -options.slashNeededForUrl = function(pattern) { - const matchPattern = new RegExp(`^${schemeSegment}://${hostSegment}$`); - return matchPattern.exec(pattern); -}; diff --git a/keepassxc-browser/popups/popup.css b/keepassxc-browser/popups/popup.css index 4902487..5704b7d 100644 --- a/keepassxc-browser/popups/popup.css +++ b/keepassxc-browser/popups/popup.css @@ -4,6 +4,9 @@ body { background-color: #eee; font-size: 15px; padding: 8px; + min-width: 440px; + max-width: 460px; + width: auto; } .container { min-width: 440px;