mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-22 16:29:09 +01:00
parent
2844a95183
commit
d252fd1740
2
jslib
2
jslib
@ -1 +1 @@
|
||||
Subproject commit 11fff06b8cd10468ffac617ab8674ba7ea6651a9
|
||||
Subproject commit aca098645a21eef496e21d7c3a942cf6a83ff7bc
|
@ -1,3 +1,5 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||
@ -5,35 +7,26 @@ module.exports = function(config) {
|
||||
|
||||
// frameworks to use
|
||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
frameworks: ['jasmine', 'karma-typescript'],
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
'jslib/src/abstractions/**/*.ts',
|
||||
'jslib/src/enums/**/*.ts',
|
||||
'jslib/src/models/**/*.ts',
|
||||
'jslib/src/services/**/*.ts',
|
||||
'jslib/src/misc/**/*.ts',
|
||||
'src/browser/**/*.ts',
|
||||
'src/services/**/*.ts'
|
||||
{ pattern: 'src/**/*.spec.ts', watch: false },
|
||||
],
|
||||
|
||||
// list of files to exclude
|
||||
exclude: [
|
||||
"jslib/src/services/nodeApi.service.ts",
|
||||
"jslib/src/services/lowdbStorage.service.ts"
|
||||
],
|
||||
|
||||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {
|
||||
'**/*.ts': 'karma-typescript'
|
||||
'src/**/*.ts': 'webpack'
|
||||
},
|
||||
|
||||
// test results reporter to use
|
||||
// possible values: 'dots', 'progress'
|
||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ['progress', 'karma-typescript', 'kjhtml'],
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
|
||||
// web server port
|
||||
port: 9876,
|
||||
@ -57,14 +50,26 @@ module.exports = function(config) {
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
|
||||
karmaTypescriptConfig: {
|
||||
tsconfig: './tsconfig.json',
|
||||
compilerOptions: {
|
||||
module: 'CommonJS'
|
||||
webpack: {
|
||||
mode: 'production',
|
||||
resolve: {
|
||||
extensions: ['.js', '.ts', '.tsx'],
|
||||
alias: {
|
||||
jslib: path.join(__dirname, 'jslib/src'),
|
||||
},
|
||||
},
|
||||
bundlerOptions: {
|
||||
entrypoints: /\.spec\.ts$/
|
||||
}
|
||||
module: {
|
||||
rules: [
|
||||
{test: /\.tsx?$/, loader: 'ts-loader'}
|
||||
]
|
||||
},
|
||||
stats: {
|
||||
colors: true,
|
||||
modules: true,
|
||||
reasons: true,
|
||||
errorDetails: true
|
||||
},
|
||||
devtool: 'inline-source-map',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
11907
package-lock.json
generated
11907
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
127
package.json
127
package.json
@ -27,89 +27,86 @@
|
||||
"test:watch": "karma start"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/compiler-cli": "^9.1.12",
|
||||
"@ngtools/webpack": "^9.1.12",
|
||||
"@types/chrome": "^0.0.73",
|
||||
"@types/firefox-webext-browser": "^78.0.1",
|
||||
"@types/jasmine": "^3.3.12",
|
||||
"@angular/compiler-cli": "^11.2.11",
|
||||
"@ngtools/webpack": "^11.2.10",
|
||||
"@types/chrome": "^0.0.135",
|
||||
"@types/firefox-webext-browser": "^82.0.0",
|
||||
"@types/jasmine": "^3.6.0",
|
||||
"@types/lunr": "^2.3.3",
|
||||
"@types/mousetrap": "^1.6.0",
|
||||
"@types/mousetrap": "^1.6.7",
|
||||
"@types/node-forge": "^0.9.7",
|
||||
"@types/papaparse": "^5.2.0",
|
||||
"@types/safari-extension": "^0.0.27",
|
||||
"@types/safari-extension-content": "^0.0.14",
|
||||
"@types/source-map": "0.5.2",
|
||||
"@types/tldjs": "^2.3.0",
|
||||
"@types/webcrypto": "^0.0.28",
|
||||
"@types/webpack": "^4.4.11",
|
||||
"@types/zxcvbn": "4.4.0",
|
||||
"angular2-template-loader": "^0.6.2",
|
||||
"clean-webpack-plugin": "^0.1.19",
|
||||
"copy-webpack-plugin": "^5.1.1",
|
||||
"cross-env": "^5.2.0",
|
||||
"css-loader": "^1.0.0",
|
||||
"del": "^3.0.0",
|
||||
"file-loader": "^2.0.0",
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-filter": "^5.1.0",
|
||||
"gulp-google-webfonts": "^2.0.0",
|
||||
"gulp-if": "^2.0.2",
|
||||
"gulp-json-editor": "^2.4.2",
|
||||
"gulp-replace": "^1.0.0",
|
||||
"gulp-zip": "^4.2.0",
|
||||
"html-loader": "^0.5.5",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"jasmine-core": "^3.3.0",
|
||||
"jasmine-spec-reporter": "^4.2.1",
|
||||
"karma": "^4.0.1",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"@types/webpack": "^4.41.27",
|
||||
"@types/zxcvbn": "^4.4.1",
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"copy-webpack-plugin": "^6.4.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^5.2.4",
|
||||
"del": "^6.0.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-filter": "^6.0.0",
|
||||
"gulp-google-webfonts": "^4.0.0",
|
||||
"gulp-if": "^3.0.0",
|
||||
"gulp-json-editor": "^2.5.5",
|
||||
"gulp-replace": "^1.1.0",
|
||||
"gulp-zip": "^5.1.0",
|
||||
"html-loader": "^1.3.2",
|
||||
"html-webpack-plugin": "^4.5.1",
|
||||
"jasmine-core": "^3.7.1",
|
||||
"jasmine-spec-reporter": "^7.0.0",
|
||||
"karma": "^6.3.2",
|
||||
"karma-chrome-launcher": "^3.1.0",
|
||||
"karma-cli": "^2.0.0",
|
||||
"karma-coverage-istanbul-reporter": "^2.0.5",
|
||||
"karma-jasmine": "^2.0.1",
|
||||
"karma-jasmine-html-reporter": "^1.4.0",
|
||||
"karma-typescript": "^4.0.0",
|
||||
"mini-css-extract-plugin": "^0.9.0",
|
||||
"node-sass": "^4.13.1",
|
||||
"sass-loader": "^7.1.0",
|
||||
"style-loader": "^0.23.0",
|
||||
"ts-loader": "^8.0.2",
|
||||
"tslint": "^6.1.3",
|
||||
"karma-jasmine": "^4.0.0",
|
||||
"karma-jasmine-html-reporter": "^1.5.0",
|
||||
"karma-webpack": "^4.0.2",
|
||||
"mini-css-extract-plugin": "^1.5.0",
|
||||
"sass-loader": "^10.1.1",
|
||||
"style-loader": "^2.0.0",
|
||||
"tapable": "^1.1.3",
|
||||
"ts-loader": "^8.1.0",
|
||||
"tslint": "^6.1.0",
|
||||
"tslint-loader": "^3.5.4",
|
||||
"typescript": "3.8.3",
|
||||
"webpack": "^4.29.0",
|
||||
"webpack-cli": "^3.2.1"
|
||||
"typescript": "4.1.5",
|
||||
"webpack": "^4.46.0",
|
||||
"webpack-cli": "^4.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular/animations": "9.1.12",
|
||||
"@angular/cdk": "9.2.4",
|
||||
"@angular/common": "9.1.12",
|
||||
"@angular/compiler": "9.1.12",
|
||||
"@angular/core": "9.1.12",
|
||||
"@angular/forms": "9.1.12",
|
||||
"@angular/platform-browser": "9.1.12",
|
||||
"@angular/platform-browser-dynamic": "9.1.12",
|
||||
"@angular/router": "9.1.12",
|
||||
"@angular/animations": "^11.2.11",
|
||||
"@angular/cdk": "^11.2.10",
|
||||
"@angular/common": "^11.2.11",
|
||||
"@angular/compiler": "^11.2.11",
|
||||
"@angular/core": "^11.2.11",
|
||||
"@angular/forms": "^11.2.11",
|
||||
"@angular/localize": "^11.2.11",
|
||||
"@angular/platform-browser": "^11.2.11",
|
||||
"@angular/platform-browser-dynamic": "^11.2.11",
|
||||
"@angular/router": "^11.2.11",
|
||||
"@microsoft/signalr": "3.1.13",
|
||||
"@microsoft/signalr-protocol-msgpack": "3.1.13",
|
||||
"angular2-toaster": "8.0.0",
|
||||
"@types/papaparse": "^5.2.5",
|
||||
"angular2-toaster": "^11.0.1",
|
||||
"big-integer": "1.6.48",
|
||||
"browser-hrtime": "^1.1.8",
|
||||
"core-js": "2.6.2",
|
||||
"core-js": "^3.11.0",
|
||||
"date-input-polyfill": "^2.14.0",
|
||||
"duo_web_sdk": "git+https://github.com/duosecurity/duo_web_sdk.git",
|
||||
"font-awesome": "4.7.0",
|
||||
"lunr": "2.3.3",
|
||||
"mousetrap": "1.6.2",
|
||||
"ngx-infinite-scroll": "7.0.1",
|
||||
"lunr": "^2.3.9",
|
||||
"mousetrap": "^1.6.5",
|
||||
"ngx-infinite-scroll": "^10.0.1",
|
||||
"node-forge": "0.10.0",
|
||||
"nord": "^0.2.1",
|
||||
"papaparse": "5.2.0",
|
||||
"rxjs": "6.6.2",
|
||||
"sweetalert2": "10.15.3",
|
||||
"papaparse": "^5.3.0",
|
||||
"rxjs": "^6.6.7",
|
||||
"sass": "^1.32.11",
|
||||
"sweetalert2": "^10.16.6",
|
||||
"tldjs": "2.3.1",
|
||||
"tslib": "^2.0.1",
|
||||
"web-animations-js": "2.3.1",
|
||||
"zone.js": "0.10.3",
|
||||
"tslib": "^2.0.0",
|
||||
"web-animations-js": "^2.3.2",
|
||||
"zone.js": "^0.11.4",
|
||||
"zxcvbn": "4.4.2"
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ export class BrowserApi {
|
||||
return;
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
return new Promise<void>(resolve => {
|
||||
chrome.tabs.sendMessage(tab.id, obj, options, () => {
|
||||
if (chrome.runtime.lastError) {
|
||||
// Some error happened
|
||||
@ -181,7 +181,7 @@ export class BrowserApi {
|
||||
if (BrowserApi.isWebExtensionsApi) {
|
||||
return browser.runtime.getPlatformInfo();
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
return new Promise(resolve => {
|
||||
chrome.runtime.getPlatformInfo(resolve);
|
||||
});
|
||||
}
|
||||
|
@ -118,6 +118,6 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
|
||||
}
|
||||
|
||||
async isLinux() {
|
||||
return (await BrowserApi.getPlatformInfo()).os === "linux";
|
||||
return (await BrowserApi.getPlatformInfo()).os === 'linux';
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,3 @@
|
||||
import 'core-js';
|
||||
import 'zone.js/dist/zone';
|
||||
|
||||
import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||
import { ToasterModule } from 'angular2-toaster';
|
||||
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
|
||||
|
@ -1,8 +1,5 @@
|
||||
import 'core-js/es7/reflect';
|
||||
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
import 'web-animations-js';
|
||||
|
||||
// tslint:disable-next-line
|
||||
require('./scss/popup.scss');
|
||||
|
@ -1,3 +1,6 @@
|
||||
/* tslint:disable */
|
||||
require('date-input-polyfill');
|
||||
import 'core-js/stable';
|
||||
import 'date-input-polyfill';
|
||||
import 'web-animations-js';
|
||||
import 'zone.js/dist/zone';
|
||||
/* tslint:enable */
|
||||
|
@ -353,6 +353,6 @@ input[type="password"]::-ms-reveal {
|
||||
// option elements will not render background-color correctly if identical to parent background-color
|
||||
select option {
|
||||
@include themify($themes) {
|
||||
background-color: adjust-color(themed('inputBackgroundColor'), +1);
|
||||
background-color: darken(themed('inputBackgroundColor'), +1);
|
||||
}
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ $fa-font-path: "~font-awesome/fonts";
|
||||
@extend .btn;
|
||||
|
||||
&.swal2-confirm {
|
||||
@extend .btn.primary;
|
||||
@extend .btn, .primary;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
@ -171,6 +171,13 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
|
||||
}, 200);
|
||||
}
|
||||
|
||||
closeOnEsc(e: KeyboardEvent) {
|
||||
// If input not empty, use browser default behavior of clearing input instead
|
||||
if (e.key === 'Escape' && (this.searchText == null || this.searchText === '')) {
|
||||
BrowserApi.closePopup(window);
|
||||
}
|
||||
}
|
||||
|
||||
private async load() {
|
||||
const tab = await BrowserApi.getTabFromCurrentWindow();
|
||||
if (tab != null) {
|
||||
@ -226,11 +233,4 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
|
||||
this.loginCiphers = this.loginCiphers.sort((a, b) => this.cipherService.sortCiphersByLastUsedThenName(a, b));
|
||||
this.loaded = true;
|
||||
}
|
||||
|
||||
closeOnEsc(e: KeyboardEvent) {
|
||||
// If input not empty, use browser default behavior of clearing input instead
|
||||
if (e.key === 'Escape' && (this.searchText == null || this.searchText === '')) {
|
||||
BrowserApi.closePopup(window);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,15 @@ const ScopeStateId = ComponentId + 'Scope';
|
||||
templateUrl: 'groupings.component.html',
|
||||
})
|
||||
export class GroupingsComponent extends BaseGroupingsComponent implements OnInit, OnDestroy {
|
||||
|
||||
get showNoFolderCiphers(): boolean {
|
||||
return this.noFolderCiphers != null && this.noFolderCiphers.length < this.noFolderListSize &&
|
||||
this.collections.length === 0;
|
||||
}
|
||||
|
||||
get folderCount(): number {
|
||||
return this.nestedFolders.length - (this.showNoFolderCiphers ? 0 : 1);
|
||||
}
|
||||
ciphers: CipherView[];
|
||||
favoriteCiphers: CipherView[];
|
||||
noFolderCiphers: CipherView[];
|
||||
@ -78,15 +87,6 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
|
||||
this.noFolderListSize = 100;
|
||||
}
|
||||
|
||||
get showNoFolderCiphers(): boolean {
|
||||
return this.noFolderCiphers != null && this.noFolderCiphers.length < this.noFolderListSize &&
|
||||
this.collections.length === 0;
|
||||
}
|
||||
|
||||
get folderCount(): number {
|
||||
return this.nestedFolders.length - (this.showNoFolderCiphers ? 0 : 1);
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.searchTypeSearch = !this.platformUtilsService.isSafari();
|
||||
this.showLeftHeader = !(this.popupUtils.inSidebar(window) && this.platformUtilsService.isFirefox());
|
||||
@ -296,6 +296,13 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
|
||||
return this.hasSearched || (!this.searchPending && this.searchService.isSearchable(this.searchText));
|
||||
}
|
||||
|
||||
closeOnEsc(e: KeyboardEvent) {
|
||||
// If input not empty, use browser default behavior of clearing input instead
|
||||
if (e.key === 'Escape' && (this.searchText == null || this.searchText === '')) {
|
||||
BrowserApi.closePopup(window);
|
||||
}
|
||||
}
|
||||
|
||||
private async saveState() {
|
||||
this.state = {
|
||||
scrollY: this.popupUtils.getContentScrollY(window),
|
||||
@ -353,11 +360,4 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
closeOnEsc(e: KeyboardEvent) {
|
||||
// If input not empty, use browser default behavior of clearing input instead
|
||||
if (e.key === 'Escape' && (this.searchText == null || this.searchText === '')) {
|
||||
BrowserApi.closePopup(window);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ export default class BrowserStorageService implements StorageService {
|
||||
async save(key: string, obj: any): Promise<any> {
|
||||
if (obj == null) {
|
||||
// Fix safari not liking null in set
|
||||
return new Promise(resolve => {
|
||||
return new Promise<void>(resolve => {
|
||||
this.chromeStorageApi.remove(key, () => {
|
||||
resolve();
|
||||
});
|
||||
@ -30,7 +30,7 @@ export default class BrowserStorageService implements StorageService {
|
||||
}
|
||||
|
||||
const keyedObj = { [key]: obj };
|
||||
return new Promise(resolve => {
|
||||
return new Promise<void>(resolve => {
|
||||
this.chromeStorageApi.set(keyedObj, () => {
|
||||
resolve();
|
||||
});
|
||||
@ -38,7 +38,7 @@ export default class BrowserStorageService implements StorageService {
|
||||
}
|
||||
|
||||
async remove(key: string): Promise<any> {
|
||||
return new Promise(resolve => {
|
||||
return new Promise<void>(resolve => {
|
||||
this.chromeStorageApi.remove(key, () => {
|
||||
resolve();
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
@ -63,37 +63,40 @@ const moduleRules = [
|
||||
test: /[\/\\]@angular[\/\\].+\.js$/,
|
||||
parser: { system: true },
|
||||
},
|
||||
{
|
||||
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
|
||||
loader: '@ngtools/webpack',
|
||||
}
|
||||
];
|
||||
|
||||
const plugins = [
|
||||
new CleanWebpackPlugin([
|
||||
path.resolve(__dirname, 'build/*'),
|
||||
]),
|
||||
// ref: https://github.com/angular/angular/issues/20357
|
||||
new webpack.ContextReplacementPlugin(/\@angular(\\|\/)core(\\|\/)fesm5/,
|
||||
path.resolve(__dirname, './src')),
|
||||
new HtmlWebpackPlugin({
|
||||
template: './src/popup/index.html',
|
||||
filename: 'popup/index.html',
|
||||
chunks: ['popup/polyfills', 'popup/vendor-angular', 'popup/vendor', 'popup/main'],
|
||||
cache: false, // Remove after upgrading to Webpack 5
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: './src/background.html',
|
||||
filename: 'background.html',
|
||||
chunks: ['vendor', 'background'],
|
||||
cache: false, // Remove after upgrading to Webpack 5
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: './src/notification/bar.html',
|
||||
filename: 'notification/bar.html',
|
||||
chunks: ['notification/bar']
|
||||
chunks: ['notification/bar'],
|
||||
cache: false, // Remove after upgrading to Webpack 5
|
||||
}),
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
'./src/manifest.json',
|
||||
{ from: './src/_locales', to: '_locales' },
|
||||
{ from: './src/images', to: 'images' },
|
||||
{ from: './src/popup/images', to: 'popup/images' },
|
||||
{ from: './src/content/autofill.css', to: 'content' },
|
||||
]
|
||||
}),
|
||||
new CopyWebpackPlugin([
|
||||
'./src/manifest.json',
|
||||
{ from: './src/_locales', to: '_locales' },
|
||||
{ from: './src/images', to: 'images' },
|
||||
{ from: './src/popup/images', to: 'popup/images' },
|
||||
{ from: './src/content/autofill.css', to: 'content' },
|
||||
]),
|
||||
new webpack.SourceMapDevToolPlugin({
|
||||
include: ['popup/main.js', 'background.js'],
|
||||
}),
|
||||
@ -106,25 +109,16 @@ const plugins = [
|
||||
'ENV': JSON.stringify(ENV)
|
||||
}
|
||||
}),
|
||||
];
|
||||
|
||||
if (ENV === 'production') {
|
||||
moduleRules.push({
|
||||
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
|
||||
loader: '@ngtools/webpack',
|
||||
});
|
||||
plugins.push(new AngularCompilerPlugin({
|
||||
new AngularCompilerPlugin({
|
||||
tsConfigPath: 'tsconfig.json',
|
||||
entryModule: 'src/popup/app.module#AppModule',
|
||||
sourceMap: true,
|
||||
}));
|
||||
} else {
|
||||
moduleRules.push({
|
||||
test: /\.ts$/,
|
||||
loaders: ['ts-loader', 'angular2-template-loader'],
|
||||
exclude: path.resolve(__dirname, 'node_modules'),
|
||||
});
|
||||
}
|
||||
}),
|
||||
new CleanWebpackPlugin({
|
||||
cleanAfterEveryBuildPatterns: ['!popup/fonts/**/*'],
|
||||
}),
|
||||
];
|
||||
|
||||
|
||||
const config = {
|
||||
mode: ENV,
|
||||
|
Loading…
Reference in New Issue
Block a user