mirror of https://github.com/keeweb/keeweb
commit
69f7b02ce6
|
@ -45,12 +45,28 @@ const PopupNotifier = {
|
|||
Timeouts.CheckWindowClosed
|
||||
);
|
||||
} else {
|
||||
const loc = PopupNotifier.tryGetLocationSearch(win);
|
||||
if (loc) {
|
||||
try {
|
||||
win.close();
|
||||
} catch {}
|
||||
PopupNotifier.triggerClosed(win, loc);
|
||||
return;
|
||||
}
|
||||
PopupNotifier.deferCheckClosed(win);
|
||||
}
|
||||
},
|
||||
|
||||
triggerClosed(win) {
|
||||
Events.emit('popup-closed', win);
|
||||
tryGetLocationSearch(win) {
|
||||
try {
|
||||
if (win.location.host === location.host) {
|
||||
return win.location.search;
|
||||
}
|
||||
} catch {}
|
||||
},
|
||||
|
||||
triggerClosed(window, locationSearch) {
|
||||
Events.emit('popup-closed', { window, locationSearch });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -26,10 +26,12 @@ const GDriveApps = {
|
|||
|
||||
const OneDriveApps = {
|
||||
Local: {
|
||||
id: 'b97c53d5-db5b-4124-aab9-d39195293815',
|
||||
secret: 'V9b6:iJU]N7cImE1f_OLNjqZJDBnumR?'
|
||||
id: 'b97c53d5-db5b-4124-aab9-d39195293815'
|
||||
},
|
||||
Production: {
|
||||
id: 'bbc74d1b-3a9c-46e6-9da4-4c645e830923'
|
||||
},
|
||||
Desktop: {
|
||||
id: 'bbc74d1b-3a9c-46e6-9da4-4c645e830923',
|
||||
secret: 'aOMJaktJEAs_Tmh]fx4iQ[Zd3mp3KK7-'
|
||||
}
|
||||
|
|
|
@ -222,7 +222,9 @@ class StorageOneDrive extends StorageBase {
|
|||
let clientId = this.appSettings.onedriveClientId;
|
||||
let clientSecret = this.appSettings.onedriveClientSecret;
|
||||
if (!clientId) {
|
||||
if (Features.isLocal) {
|
||||
if (Features.isDesktop) {
|
||||
({ id: clientId, secret: clientSecret } = OneDriveApps.Desktop);
|
||||
} else if (Features.isLocal) {
|
||||
({ id: clientId, secret: clientSecret } = OneDriveApps.Local);
|
||||
} else {
|
||||
({ id: clientId, secret: clientSecret } = OneDriveApps.Production);
|
||||
|
|
|
@ -264,11 +264,33 @@ class StorageBase {
|
|||
|
||||
this.logger.debug('OAuth: popup opened');
|
||||
|
||||
const popupClosed = () => {
|
||||
const processWindowMessage = (locationSearch) => {
|
||||
const data = {};
|
||||
for (const [key, value] of new URLSearchParams(locationSearch).entries()) {
|
||||
data[key] = value;
|
||||
}
|
||||
if (data.error) {
|
||||
this.logger.error('OAuth error', data.error, data.error_description);
|
||||
callback('OAuth: ' + data.error);
|
||||
} else if (data.code) {
|
||||
Events.off('popup-closed', popupClosed);
|
||||
window.removeEventListener('message', windowMessage);
|
||||
this._oauthCodeReceived(data, session, callback);
|
||||
} else {
|
||||
this.logger.debug('Skipped OAuth message', data);
|
||||
}
|
||||
};
|
||||
|
||||
const popupClosed = (e) => {
|
||||
Events.off('popup-closed', popupClosed);
|
||||
window.removeEventListener('message', windowMessage);
|
||||
this.logger.error('OAuth error', 'popup closed');
|
||||
callback('OAuth: popup closed');
|
||||
if (e.locationSearch) {
|
||||
// see #1711: mobile Safari in PWA mode can't close the pop-up, but it returns the url
|
||||
processWindowMessage(e.locationSearch);
|
||||
} else {
|
||||
this.logger.error('OAuth error', 'popup closed');
|
||||
callback('OAuth: popup closed');
|
||||
}
|
||||
};
|
||||
|
||||
const windowMessage = (e) => {
|
||||
|
@ -283,20 +305,7 @@ class StorageBase {
|
|||
this.logger.debug('Skipped OAuth message for another storage', e.data.storage);
|
||||
return;
|
||||
}
|
||||
const data = {};
|
||||
for (const [key, value] of new URLSearchParams(e.data.search).entries()) {
|
||||
data[key] = value;
|
||||
}
|
||||
if (data.error) {
|
||||
this.logger.error('OAuth error', data.error, data.error_description);
|
||||
callback('OAuth: ' + data.error);
|
||||
} else if (data.code) {
|
||||
Events.off('popup-closed', popupClosed);
|
||||
window.removeEventListener('message', windowMessage);
|
||||
this._oauthCodeReceived(data, session, callback);
|
||||
} else {
|
||||
this.logger.debug('Skipped OAuth message', data);
|
||||
}
|
||||
processWindowMessage(e.data.search);
|
||||
};
|
||||
Events.on('popup-closed', popupClosed);
|
||||
window.addEventListener('message', windowMessage);
|
||||
|
|
|
@ -127,8 +127,8 @@ class EntrySearch {
|
|||
return context.matches && context.matches.length === find.length;
|
||||
}
|
||||
|
||||
static matchStringMultiLower(str, find, context, lower) {
|
||||
return EntrySearch.matchStringLower(str, find, context, true);
|
||||
static matchStringMultiLower(str, find, context) {
|
||||
return EntrySearch.matchStringMulti(str, find, context, true);
|
||||
}
|
||||
|
||||
static matchRegex(str, regex) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "KeeWeb",
|
||||
"version": "1.16.7",
|
||||
"version": "1.16.8",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "KeeWeb",
|
||||
"version": "1.16.7",
|
||||
"version": "1.16.8",
|
||||
"description": "Free cross-platform password manager compatible with KeePass",
|
||||
"main": "main.js",
|
||||
"homepage": "https://keeweb.info",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "keeweb",
|
||||
"version": "1.16.7",
|
||||
"version": "1.16.8",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "keeweb",
|
||||
"version": "1.16.7",
|
||||
"version": "1.16.8",
|
||||
"description": "Free cross-platform password manager compatible with KeePass",
|
||||
"main": "Gruntfile.js",
|
||||
"private": true,
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
Release notes
|
||||
-------------
|
||||
##### v1.16.8 (2021-03-02)
|
||||
`-` fix #1726: search in protected fields
|
||||
`-` fix #1713: OneDrive authentication on web
|
||||
`-` fix #1715: storage authentication in Epiphany browser
|
||||
`-` fix #1711: storage authentication in iOS
|
||||
|
||||
##### v1.16.7 (2020-12-31)
|
||||
`-` fix #1671: new lines removal issue in notes
|
||||
|
||||
|
|
Loading…
Reference in New Issue