mirror of
https://github.com/keeweb/keeweb.git
synced 2024-06-22 07:16:38 +02:00
Check for a URL in the title for unsupported apps
This commit is contained in:
parent
0b25fbdef2
commit
807128bc2f
|
@ -42,7 +42,13 @@ 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); }
|
||||
return callback(null, out.trim());
|
||||
// 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);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user