mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-22 02:21:34 +01:00
added support for sidebar
This commit is contained in:
parent
915546aa0f
commit
6fa5582883
18
gulpfile.js
18
gulpfile.js
@ -215,6 +215,12 @@ gulp.task('dist', ['build'], function (cb) {
|
||||
cb);
|
||||
});
|
||||
|
||||
var sidebarActionManifestObj = {
|
||||
"default_title": "bitwarden",
|
||||
"default_panel": "popup/index.html?sidebar=true",
|
||||
"default_icon": "images/icon19.png"
|
||||
};
|
||||
|
||||
gulp.task('dist-firefox', ['dist'], function (cb) {
|
||||
gulp.src(paths.dist + 'manifest.json')
|
||||
.pipe(jeditor(function (manifest) {
|
||||
@ -224,12 +230,24 @@ gulp.task('dist-firefox', ['dist'], function (cb) {
|
||||
strict_min_version: '42.0'
|
||||
}
|
||||
};
|
||||
|
||||
manifest['sidebar_action'] = sidebarActionManifestObj;
|
||||
return manifest;
|
||||
}))
|
||||
.pipe(gulp.dest(paths.dist));
|
||||
return zipDist('dist-firefox');
|
||||
});
|
||||
|
||||
gulp.task('dist-opera', ['dist'], function (cb) {
|
||||
gulp.src(paths.dist + 'manifest.json')
|
||||
.pipe(jeditor(function (manifest) {
|
||||
manifest['sidebar_action'] = sidebarActionManifestObj;
|
||||
return manifest;
|
||||
}))
|
||||
.pipe(gulp.dest(paths.dist));
|
||||
return zipDist('dist-opera');
|
||||
});
|
||||
|
||||
gulp.task('dist-edge', ['dist'], function (cb) {
|
||||
// move dist to temp extension folder
|
||||
new Promise(function (resolve, reject) {
|
||||
|
@ -777,5 +777,8 @@
|
||||
},
|
||||
"cfTypeBoolean": {
|
||||
"message": "Boolean"
|
||||
},
|
||||
"popup2faCloseMessage": {
|
||||
"message": "Clicking outside the popup window to check your email for your verification code will cause this popup to close. Do you want to open this popup in a new window so that it does not close?"
|
||||
}
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ var bg_isBackground = true,
|
||||
bg_settingsService = new SettingsService(bg_userService);
|
||||
bg_loginService = new LoginService(bg_cryptoService, bg_userService, bg_apiService, bg_settingsService);
|
||||
bg_folderService = new FolderService(bg_cryptoService, bg_userService, bg_apiService, bg_i18nService);
|
||||
bg_lockService = new LockService(bg_constantsService, bg_cryptoService, bg_folderService, bg_loginService, setIcon,
|
||||
refreshBadgeAndMenu);
|
||||
bg_lockService = new LockService(bg_constantsService, bg_cryptoService, bg_folderService, bg_loginService, bg_utilsService,
|
||||
setIcon, refreshBadgeAndMenu);
|
||||
bg_syncService = new SyncService(bg_loginService, bg_folderService, bg_userService, bg_apiService, bg_settingsService,
|
||||
bg_cryptoService, logout);
|
||||
bg_passwordGenerationService = new PasswordGenerationService();
|
||||
@ -371,7 +371,7 @@ var bg_isBackground = true,
|
||||
}
|
||||
|
||||
function setIcon() {
|
||||
if (!chrome.browserAction.setIcon) {
|
||||
if (!chrome.browserAction && !chrome.sidebarAction) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -385,14 +385,21 @@ var bg_isBackground = true,
|
||||
suffix = '_locked';
|
||||
}
|
||||
|
||||
chrome.browserAction.setIcon({
|
||||
actionSetIcon(chrome.browserAction, suffix);
|
||||
actionSetIcon(chrome.sidebarAction, suffix);
|
||||
});
|
||||
});
|
||||
|
||||
function actionSetIcon(theAction, suffix) {
|
||||
if (theAction && theAction.setIcon) {
|
||||
theAction.setIcon({
|
||||
path: {
|
||||
'19': 'images/icon19' + suffix + '.png',
|
||||
'38': 'images/icon38' + suffix + '.png',
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function refreshBadgeAndMenu() {
|
||||
|
@ -175,12 +175,10 @@
|
||||
params = providers[constants.twoFactorProvider.email];
|
||||
$scope.twoFactorEmail = params.Email;
|
||||
|
||||
if (chrome.extension.getViews({ type: 'popup' }).length > 0) {
|
||||
if (chrome.extension.getViews({ type: 'popup' }).length > 0 && !utilsService.inSidebar($window)) {
|
||||
SweetAlert.swal({
|
||||
title: 'Two-step Login',
|
||||
text: 'Clicking outside the popup window to check your email for your verification code will ' +
|
||||
'cause this popup to close. ' +
|
||||
'Do you want to open this popup in a new window so that it does not close?',
|
||||
title: i18nService.twoStepLogin,
|
||||
text: i18nService.popup2faCloseMessage,
|
||||
showCancelButton: true,
|
||||
confirmButtonText: i18nService.yes,
|
||||
cancelButtonText: i18nService.no
|
||||
|
@ -109,6 +109,10 @@ angular
|
||||
});
|
||||
};
|
||||
|
||||
$scope.refresh = function () {
|
||||
loadVault();
|
||||
};
|
||||
|
||||
$scope.$on('syncCompleted', function (event, successfully) {
|
||||
if ($scope.loaded) {
|
||||
setTimeout(loadVault, 500);
|
||||
|
@ -1,7 +1,10 @@
|
||||
<div class="header header-search">
|
||||
<div class="left">
|
||||
<div class="left" ng-if="!main.inSidebar">
|
||||
<a href="" ng-click="main.expandVault()"><i class="fa fa-external-link fa-rotate-270 fa-lg"></i></a>
|
||||
</div>
|
||||
<div class="left" ng-if="main.inSidebar">
|
||||
<a href="" ng-click="refresh()"><i class="fa fa-refresh fa-lg"></i></a>
|
||||
</div>
|
||||
<div class="search" ng-style="{'visibility': main.disableSearch ? 'hidden' : 'visible'}">
|
||||
<input type="search" placeholder="{{i18n.searchVault}}" id="search" ng-model="searchText" ng-change="searchVault()" />
|
||||
<i class="fa fa-search"></i>
|
||||
@ -16,7 +19,7 @@
|
||||
<div class="list-grouped">
|
||||
<a href="#" stop-click ng-click="fillLogin(login)" class="list-grouped-item condensed"
|
||||
title="{{i18n.autoFill}} {{login.name}}"
|
||||
ng-repeat="login in theLogins = (logins | orderBy: [sortUriMatch, sortLastUsed, 'name', 'username'])
|
||||
ng-repeat="login in theLogins = (logins | orderBy: [sortUriMatch, sortLastUsed, 'name', 'username'])
|
||||
track by $index">
|
||||
<span class="btn-list" stop-prop stop-click title="{{i18n.copyPassword}}"
|
||||
ngclipboard ngclipboard-error="clipboardError(e)"
|
||||
|
@ -10,6 +10,7 @@ angular
|
||||
self.smBody = !self.xsBody && $window.screen.availHeight <= 800;
|
||||
self.lgBody = !self.xsBody && !self.smBody && utilsService && !utilsService.isFirefox() && !utilsService.isEdge();
|
||||
self.disableSearch = utilsService.isEdge();
|
||||
self.inSidebar = utilsService.inSidebar($window);
|
||||
|
||||
$scope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
|
||||
if (toParams.animation) {
|
||||
|
@ -35,6 +35,7 @@
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
padding: 12px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.left {
|
||||
@ -167,6 +168,7 @@
|
||||
i {
|
||||
display: block;
|
||||
margin-bottom: 2px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
function LockService(constantsService, cryptoService, folderService, loginService, setIcon, refreshBadgeAndMenu) {
|
||||
function LockService(constantsService, cryptoService, folderService, loginService, utilsService, setIcon, refreshBadgeAndMenu) {
|
||||
this.lastLockCheck = null;
|
||||
this.constantsService = constantsService;
|
||||
this.cryptoService = cryptoService;
|
||||
this.folderService = folderService;
|
||||
this.loginService = loginService;
|
||||
this.utilsService = utilsService;
|
||||
this.setIcon = setIcon;
|
||||
this.refreshBadgeAndMenu = refreshBadgeAndMenu;
|
||||
|
||||
@ -22,8 +23,12 @@ function initLockService(self) {
|
||||
}
|
||||
self.lastLockCheck = now;
|
||||
|
||||
if (chrome.extension.getViews({ type: 'popup' }).length > 0) {
|
||||
// popup is open, do not lock
|
||||
var popupOpen = chrome.extension.getViews({ type: 'popup' }).length > 0;
|
||||
var sidebarViewName = self.utilsService.sidebarViewName();
|
||||
var sidebarOpen = sidebarViewName && chrome.extension.getViews({ type: sidebarViewName }).length > 0;
|
||||
|
||||
if (popupOpen || sidebarOpen) {
|
||||
// Do not lock
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -228,6 +228,21 @@ function initUtilsService() {
|
||||
}
|
||||
};
|
||||
|
||||
UtilsService.prototype.inSidebar = function (theWindow) {
|
||||
return theWindow.location.search && theWindow.location.search.indexOf('sidebar=true') > -1;
|
||||
};
|
||||
|
||||
UtilsService.prototype.sidebarViewName = function () {
|
||||
if (this.isFirefox()) {
|
||||
return 'sidebar';
|
||||
}
|
||||
else if (this.isOpera()) {
|
||||
return 'sidebar_panel';
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
function validIpAddress(ipString) {
|
||||
var ipRegex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
||||
return ipRegex.test(ipString);
|
||||
|
Loading…
Reference in New Issue
Block a user