1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 14:23:32 +00:00

manage ui location for popup app

This commit is contained in:
Kyle Spearrin
2017-10-06 00:05:08 -04:00
parent 31f73895b8
commit d4cf0fe338
9 changed files with 21 additions and 9 deletions

View File

@@ -351,7 +351,7 @@ function dist(edge, cb) {
var sidebarActionManifestObj = { var sidebarActionManifestObj = {
"default_title": "bitwarden", "default_title": "bitwarden",
"default_panel": "popup/index.html?sidebar=true", "default_panel": "popup/index.html?uilocation=sidebar",
"default_icon": "images/icon19.png" "default_icon": "images/icon19.png"
}; };

View File

@@ -62,7 +62,7 @@
"38": "images/icon38.png" "38": "images/icon38.png"
}, },
"default_title": "bitwarden", "default_title": "bitwarden",
"default_popup": "popup/index.html" "default_popup": "popup/index.html?uilocation=popup"
}, },
"permissions": [ "permissions": [
"tabs", "tabs",

View File

@@ -175,7 +175,9 @@
params = providers[constants.twoFactorProvider.email]; params = providers[constants.twoFactorProvider.email];
$scope.twoFactorEmail = params.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({ SweetAlert.swal({
title: i18nService.twoStepLogin, title: i18nService.twoStepLogin,
text: i18nService.popup2faCloseMessage, text: i18nService.popup2faCloseMessage,
@@ -184,7 +186,7 @@
cancelButtonText: i18nService.no cancelButtonText: i18nService.no
}, function (confirmed) { }, function (confirmed) {
if (confirmed) { if (confirmed) {
chrome.tabs.create({ url: '/popup/index.html#!/login' }); chrome.tabs.create({ url: '/popup/index.html?uilocation=tab#!/login' });
return; return;
} }
else if (Object.keys(providers).length > 1) { else if (Object.keys(providers).length > 1) {

View File

@@ -79,7 +79,7 @@ angular
if (totpCode && utilsService.isFirefox()) { if (totpCode && utilsService.isFirefox()) {
utilsService.copyToClipboard(totpCode, document); utilsService.copyToClipboard(totpCode, document);
} }
if (!utilsService.inSidebar($window)) { if (utilsService.inPopup($window)) {
$window.close(); $window.close();
} }
}, function () { }, function () {

View File

@@ -33,6 +33,7 @@ angular
} }
} }
href = href.replace('uilocation=popup', 'uilocation=tab').replace('uilocation=sidebar', 'uilocation=tab');
chrome.tabs.create({ url: href }); chrome.tabs.create({ url: href });
}; };

View File

@@ -178,7 +178,7 @@
if (login.uri.startsWith('http://') || login.uri.startsWith('https://')) { if (login.uri.startsWith('http://') || login.uri.startsWith('https://')) {
$analytics.eventTrack('Launched Website From Listing'); $analytics.eventTrack('Launched Website From Listing');
chrome.tabs.create({ url: login.uri }); chrome.tabs.create({ url: login.uri });
if (!utilsService.inSidebar($window)) { if (utilsService.inPopup($window)) {
$window.close(); $window.close();
} }
} }

View File

@@ -136,7 +136,7 @@
if (login.uri.startsWith('http://') || login.uri.startsWith('https://')) { if (login.uri.startsWith('http://') || login.uri.startsWith('https://')) {
$analytics.eventTrack('Launched Website From Listing'); $analytics.eventTrack('Launched Website From Listing');
chrome.tabs.create({ url: login.uri }); chrome.tabs.create({ url: login.uri });
if (!utilsService.inSidebar($window)) { if (utilsService.inPopup($window)) {
$window.close(); $window.close();
} }
} }

View File

@@ -24,10 +24,11 @@ function initLockService(self) {
self.lastLockCheck = now; self.lastLockCheck = now;
var popupOpen = chrome.extension.getViews({ type: 'popup' }).length > 0; var popupOpen = chrome.extension.getViews({ type: 'popup' }).length > 0;
var tabOpen = chrome.extension.getViews({ type: 'tab' }).length > 0;
var sidebarView = sidebarViewName(self.utilsService); var sidebarView = sidebarViewName(self.utilsService);
var sidebarOpen = sidebarView && chrome.extension.getViews({ type: sidebarView }).length > 0; var sidebarOpen = sidebarView && chrome.extension.getViews({ type: sidebarView }).length > 0;
if (popupOpen || sidebarOpen) { if (popupOpen || tabOpen || sidebarOpen) {
// Do not lock // Do not lock
return; return;
} }

View File

@@ -229,7 +229,15 @@ function initUtilsService() {
}; };
UtilsService.prototype.inSidebar = function (theWindow) { 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) { function validIpAddress(ipString) {