mirror of
https://github.com/bitwarden/browser.git
synced 2025-03-18 14:39:21 +01:00
manage ui location for popup app
This commit is contained in:
parent
31f73895b8
commit
d4cf0fe338
@ -351,7 +351,7 @@ function dist(edge, cb) {
|
||||
|
||||
var sidebarActionManifestObj = {
|
||||
"default_title": "bitwarden",
|
||||
"default_panel": "popup/index.html?sidebar=true",
|
||||
"default_panel": "popup/index.html?uilocation=sidebar",
|
||||
"default_icon": "images/icon19.png"
|
||||
};
|
||||
|
||||
|
@ -62,7 +62,7 @@
|
||||
"38": "images/icon38.png"
|
||||
},
|
||||
"default_title": "bitwarden",
|
||||
"default_popup": "popup/index.html"
|
||||
"default_popup": "popup/index.html?uilocation=popup"
|
||||
},
|
||||
"permissions": [
|
||||
"tabs",
|
||||
|
@ -175,7 +175,9 @@
|
||||
params = providers[constants.twoFactorProvider.email];
|
||||
$scope.twoFactorEmail = params.Email;
|
||||
|
||||
if (chrome.extension.getViews({ type: 'popup' }).length > 0 && !utilsService.inSidebar($window)) {
|
||||
if (chrome.extension.getViews({ type: 'popup' }).length > 0 &&
|
||||
!utilsService.inSidebar($window) &&
|
||||
!utilsService.inTab($window)) {
|
||||
SweetAlert.swal({
|
||||
title: i18nService.twoStepLogin,
|
||||
text: i18nService.popup2faCloseMessage,
|
||||
@ -184,7 +186,7 @@
|
||||
cancelButtonText: i18nService.no
|
||||
}, function (confirmed) {
|
||||
if (confirmed) {
|
||||
chrome.tabs.create({ url: '/popup/index.html#!/login' });
|
||||
chrome.tabs.create({ url: '/popup/index.html?uilocation=tab#!/login' });
|
||||
return;
|
||||
}
|
||||
else if (Object.keys(providers).length > 1) {
|
||||
|
@ -79,7 +79,7 @@ angular
|
||||
if (totpCode && utilsService.isFirefox()) {
|
||||
utilsService.copyToClipboard(totpCode, document);
|
||||
}
|
||||
if (!utilsService.inSidebar($window)) {
|
||||
if (utilsService.inPopup($window)) {
|
||||
$window.close();
|
||||
}
|
||||
}, function () {
|
||||
|
@ -33,6 +33,7 @@ angular
|
||||
}
|
||||
}
|
||||
|
||||
href = href.replace('uilocation=popup', 'uilocation=tab').replace('uilocation=sidebar', 'uilocation=tab');
|
||||
chrome.tabs.create({ url: href });
|
||||
};
|
||||
|
||||
|
@ -178,7 +178,7 @@
|
||||
if (login.uri.startsWith('http://') || login.uri.startsWith('https://')) {
|
||||
$analytics.eventTrack('Launched Website From Listing');
|
||||
chrome.tabs.create({ url: login.uri });
|
||||
if (!utilsService.inSidebar($window)) {
|
||||
if (utilsService.inPopup($window)) {
|
||||
$window.close();
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +136,7 @@
|
||||
if (login.uri.startsWith('http://') || login.uri.startsWith('https://')) {
|
||||
$analytics.eventTrack('Launched Website From Listing');
|
||||
chrome.tabs.create({ url: login.uri });
|
||||
if (!utilsService.inSidebar($window)) {
|
||||
if (utilsService.inPopup($window)) {
|
||||
$window.close();
|
||||
}
|
||||
}
|
||||
|
@ -24,10 +24,11 @@ function initLockService(self) {
|
||||
self.lastLockCheck = now;
|
||||
|
||||
var popupOpen = chrome.extension.getViews({ type: 'popup' }).length > 0;
|
||||
var tabOpen = chrome.extension.getViews({ type: 'tab' }).length > 0;
|
||||
var sidebarView = sidebarViewName(self.utilsService);
|
||||
var sidebarOpen = sidebarView && chrome.extension.getViews({ type: sidebarView }).length > 0;
|
||||
|
||||
if (popupOpen || sidebarOpen) {
|
||||
if (popupOpen || tabOpen || sidebarOpen) {
|
||||
// Do not lock
|
||||
return;
|
||||
}
|
||||
|
@ -229,7 +229,15 @@ function initUtilsService() {
|
||||
};
|
||||
|
||||
UtilsService.prototype.inSidebar = function (theWindow) {
|
||||
return theWindow.location.search && theWindow.location.search.indexOf('sidebar=true') > -1;
|
||||
return theWindow.location.search && theWindow.location.search.indexOf('uilocation=sidebar') > -1;
|
||||
};
|
||||
|
||||
UtilsService.prototype.inTab = function (theWindow) {
|
||||
return theWindow.location.search && theWindow.location.search.indexOf('uilocation=tab') > -1;
|
||||
};
|
||||
|
||||
UtilsService.prototype.inPopup = function (theWindow) {
|
||||
return theWindow.location.search && theWindow.location.search.indexOf('uilocation=popup') > -1;
|
||||
};
|
||||
|
||||
function validIpAddress(ipString) {
|
||||
|
Loading…
Reference in New Issue
Block a user