mirror of https://github.com/keeweb/keeweb.git
URL matching moved from helper to auto-type
This commit is contained in:
parent
0aa029a495
commit
7055c9421f
|
@ -42,13 +42,7 @@ AutoTypeHelper.prototype.getActiveWindowTitle = function(callback) {
|
|||
// special cases are not available. this method may ask the user about assistive access
|
||||
AutoTypeHelper.exec(OtherAppsScript.replace(/\{}/g, appName), (err, out) => {
|
||||
if (err) { return callback(err); }
|
||||
// try to find a URL in the title
|
||||
const urlMatcher = new RegExp(
|
||||
'https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,4}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)'
|
||||
);
|
||||
const urlMatches = urlMatcher.exec(out);
|
||||
const url = urlMatches && urlMatches.length > 0 ? urlMatches[0] : null;
|
||||
return callback(null, out.trim(), url);
|
||||
return callback(null, out.trim());
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -164,6 +164,14 @@ const AutoType = {
|
|||
if (err) {
|
||||
logger.error('Error get window title', err);
|
||||
} else {
|
||||
if (!url) {
|
||||
// try to find a URL in the title
|
||||
const urlMatcher = new RegExp(
|
||||
'https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,4}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)'
|
||||
);
|
||||
const urlMatches = urlMatcher.exec(title);
|
||||
url = urlMatches && urlMatches.length > 0 ? urlMatches[0] : null;
|
||||
}
|
||||
logger.debug('Window title', title, url);
|
||||
}
|
||||
return callback(err, title, url);
|
||||
|
|
Loading…
Reference in New Issue