diff options
author | Marius David Wieschollek <passwords.public@mdns.eu> | 2021-12-15 22:13:23 +0300 |
---|---|---|
committer | Marius David Wieschollek <passwords.public@mdns.eu> | 2021-12-15 22:13:23 +0300 |
commit | ae6252433b32642a7cb1a955679424f5a7758903 (patch) | |
tree | 876b0a9e47ef8976379f600ef4b045e85d98e015 | |
parent | 21db88bfd314533671283a58bde97b40e4b125b1 (diff) |
Fix passlink on vivaldi
-rw-r--r-- | src/js/Manager/PassLinkManager.js | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/js/Manager/PassLinkManager.js b/src/js/Manager/PassLinkManager.js index a028382..e512d39 100644 --- a/src/js/Manager/PassLinkManager.js +++ b/src/js/Manager/PassLinkManager.js @@ -1,4 +1,4 @@ -import SystemService from "@js/Services/SystemService"; +import SystemService from '@js/Services/SystemService'; export default new class PassLinkManager { @@ -19,6 +19,22 @@ export default new class PassLinkManager { {urls: ['https://link.passwordsapp.org/open/*']}, ['blocking'] ); + + SystemService.getBrowserApi().tabs.onCreated.addListener( + (tab) => { + if(tab.url && tab.url.substr(0, 35) === 'https://link.passwordsapp.org/open/') { + this._processEventUrl(tab.url, tab.id); + } + } + ); + + SystemService.getBrowserApi().tabs.onUpdated.addListener( + (tabId, changeInfo) => { + if(changeInfo.url && changeInfo.url.substr(0, 35) === 'https://link.passwordsapp.org/open/') { + this._processEventUrl(changeInfo.url, tabId); + } + } + ); } /** @@ -28,12 +44,16 @@ export default new class PassLinkManager { * @private */ _redirectRequest(requestDetails) { - let passlinkUrl = SystemService.getBrowserApi().runtime.getURL('html/passlink.html'), - eventUrl = requestDetails.url.replace('https://link.passwordsapp.org/open/', 'ext+passlink:'); + this._processEventUrl(requestDetails.url, requestDetails.tabId); + return {cancel: true}; + } - passlinkUrl += '?link=' + encodeURIComponent(eventUrl); - SystemService.getBrowserApi().tabs.update(requestDetails.tabId, {url: passlinkUrl}); + _processEventUrl(eventUrl, tabId) { + let passlinkUrl = SystemService.getBrowserApi().runtime.getURL('html/passlink.html'); - return {cancel: true}; + eventUrl = eventUrl.replace('https://link.passwordsapp.org/open/', 'ext+passlink:'); + + passlinkUrl += '?link=' + encodeURIComponent(eventUrl); + SystemService.getBrowserApi().tabs.update(tabId, {url: passlinkUrl}); } };
\ No newline at end of file |