1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-25 12:15:18 +01:00

Merge branch 'master' into feature/sso

This commit is contained in:
Matt Smith 2020-08-19 15:08:09 -05:00
commit 4b3cd22bce
15 changed files with 595 additions and 1505 deletions

2
jslib

@ -1 +1 @@
Subproject commit ed6978baff5b129341bd46cc90a6155c1bcc5124
Subproject commit 9957125d3a9d416d7a60b9904f0b7882f3fb58d0

1998
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -24,8 +24,8 @@
"test:watch": "karma start"
},
"devDependencies": {
"@angular/compiler-cli": "^7.2.11",
"@ngtools/webpack": "^7.2.2",
"@angular/compiler-cli": "^9.1.12",
"@ngtools/webpack": "^9.1.12",
"@types/chrome": "^0.0.73",
"@types/jasmine": "^3.3.12",
"@types/lunr": "^2.3.3",
@ -68,28 +68,27 @@
"node-sass": "^4.13.1",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.0",
"ts-loader": "^5.3.3",
"tslint": "^5.12.1",
"ts-loader": "^8.0.2",
"tslint": "^6.1.3",
"tslint-loader": "^3.5.4",
"typescript": "3.2.4",
"typescript": "3.8.3",
"webpack": "^4.29.0",
"webpack-cli": "^3.2.1"
},
"dependencies": {
"@angular/animations": "7.2.1",
"@angular/cdk": "7.2.1",
"@angular/common": "7.2.1",
"@angular/compiler": "7.2.1",
"@angular/core": "7.2.1",
"@angular/forms": "7.2.1",
"@angular/platform-browser": "7.2.1",
"@angular/platform-browser-dynamic": "7.2.1",
"@angular/router": "7.2.1",
"@angular/upgrade": "7.2.1",
"@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",
"@microsoft/signalr": "3.1.0",
"@microsoft/signalr-protocol-msgpack": "3.1.0",
"angular2-toaster": "6.1.0",
"angulartics2": "6.3.0",
"angular2-toaster": "8.0.0",
"angulartics2": "9.1.0",
"big-integer": "1.6.36",
"core-js": "2.6.2",
"duo_web_sdk": "git+https://github.com/duosecurity/duo_web_sdk.git",
@ -100,11 +99,12 @@
"node-forge": "0.7.6",
"nord": "^0.2.1",
"papaparse": "4.6.0",
"rxjs": "6.3.3",
"rxjs": "6.6.2",
"sweetalert2": "9.8.2",
"tldjs": "2.3.1",
"tslib": "^2.0.1",
"web-animations-js": "2.3.1",
"zone.js": "0.8.28",
"zone.js": "0.10.3",
"zxcvbn": "4.4.2"
}
}

View File

@ -142,7 +142,7 @@ export default class RuntimeBackground {
break;
case 'autofiller':
case 'autofill_cmd':
const totpCode = await this.autofillService.doAutoFillForLastUsedLogin([{
const totpCode = await this.autofillService.doAutoFillActiveTab([{
frameId: sender.frameId,
tab: msg.tab,
details: msg.details,

View File

@ -183,7 +183,7 @@ export class BrowserApi {
navigator.msSaveBlob(blob, fileName);
} else {
const a = win.document.createElement('a');
a.href = win.URL.createObjectURL(blob);
a.href = URL.createObjectURL(blob);
a.download = fileName;
win.document.body.appendChild(a);
a.click();

View File

@ -20,7 +20,7 @@ document.addEventListener('DOMContentLoaded', (event) => {
let autofillCommand = ['mod+shift+l'];
if (isSafari) {
autofillCommand = ['mod+\\', 'mod+8'];
autofillCommand = ['mod+\\', 'mod+8', 'mod+shift+p'];
} else if (isEdge) {
autofillCommand = ['mod+\\', 'mod+9'];
}

View File

@ -1,4 +1,4 @@
import { NgModule } from '@angular/core';
import { NgModule, Injectable } from '@angular/core';
import {
ActivatedRouteSnapshot,
RouteReuseStrategy,
@ -256,6 +256,7 @@ const routes: Routes = [
},
];
@Injectable()
export class NoRouteReuseStrategy implements RouteReuseStrategy {
shouldDetach(route: ActivatedRouteSnapshot) {
return false;

View File

@ -150,7 +150,7 @@ registerLocaleData(localeZhTw, 'zh-TW');
FormsModule,
AppRoutingModule,
ServicesModule,
Angulartics2Module.forRoot([Angulartics2GoogleAnalytics], {
Angulartics2Module.forRoot({
pageTracking: {
clearQueryParams: true,
},

View File

@ -21,7 +21,7 @@ import { AuthService as AuthServiceAbstraction } from 'jslib/abstractions/auth.s
import { CipherService } from 'jslib/abstractions/cipher.service';
import { CollectionService } from 'jslib/abstractions/collection.service';
import { CryptoService } from 'jslib/abstractions/crypto.service';
import { CryptoFunctionService } from 'jslib/abstractions/cryptoFunction.service'
import { CryptoFunctionService } from 'jslib/abstractions/cryptoFunction.service';
import { EnvironmentService } from 'jslib/abstractions/environment.service';
import { EventService } from 'jslib/abstractions/event.service';
import { ExportService } from 'jslib/abstractions/export.service';
@ -135,6 +135,11 @@ export function initFactory(i18nService: I18nService, storageService: StorageSer
{ provide: TokenService, useFactory: getBgService<TokenService>('tokenService'), deps: [] },
{ provide: I18nService, useFactory: getBgService<I18nService>('i18nService'), deps: [] },
{ provide: CryptoService, useFactory: getBgService<CryptoService>('cryptoService'), deps: [] },
{
provide: CryptoFunctionService,
useFactory: getBgService<CryptoFunctionService>('cryptoFunctionService'),
deps: [],
},
{ provide: EventService, useFactory: getBgService<EventService>('eventService'), deps: [] },
{ provide: PolicyService, useFactory: getBgService<PolicyService>('policyService'), deps: [] },
{

View File

@ -44,8 +44,8 @@ const RateUrls = {
templateUrl: 'settings.component.html',
})
export class SettingsComponent implements OnInit {
@ViewChild('vaultTimeoutSelect', { read: ElementRef }) vaultTimeoutSelectRef: ElementRef;
@ViewChild('vaultTimeoutActionSelect', { read: ElementRef }) vaultTimeoutActionSelectRef: ElementRef;
@ViewChild('vaultTimeoutSelect', { read: ElementRef, static: true }) vaultTimeoutSelectRef: ElementRef;
@ViewChild('vaultTimeoutActionSelect', { read: ElementRef, static: true }) vaultTimeoutActionSelectRef: ElementRef;
vaultTimeouts: any[];
vaultTimeout: number = null;
vaultTimeoutActions: any[];

View File

@ -48,8 +48,8 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
folderId: string = null;
collectionId: string = null;
type: CipherType = null;
nestedFolders: Array<TreeNode<FolderView>>;
nestedCollections: Array<TreeNode<CollectionView>>;
nestedFolders: TreeNode<FolderView>[];
nestedCollections: TreeNode<CollectionView>[];
searchTypeSearch = false;
private selectedTimeout: number;

View File

@ -96,7 +96,12 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
let messagesUrl = bundleUrl.appendingPathComponent("app/_locales/\(language)/messages.json")
do {
let json = try String(contentsOf: messagesUrl, encoding: .utf8)
webView.evaluateJavaScript("window.bitwardenLocaleStrings = \(json);", completionHandler: nil)
webView.evaluateJavaScript("window.bitwardenLocaleStrings = \(json);", completionHandler: {(result, error) in
guard let err = error else {
return;
}
NSLog("evaluateJavaScript error : %@", err.localizedDescription);
})
} catch {
NSLog("ERROR on getLocaleStrings, \(error)")
}
@ -236,7 +241,12 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
return
}
let json = (jsonSerialize(obj: message) ?? "null")
webView.evaluateJavaScript("window.bitwardenSafariAppMessageReceiver(\(json));", completionHandler: nil)
webView.evaluateJavaScript("window.bitwardenSafariAppMessageReceiver(\(json));", completionHandler: {(result, error) in
guard let err = error else {
return;
}
NSLog("evaluateJavaScript error : %@", err.localizedDescription);
})
}
}

View File

@ -3,5 +3,5 @@ import AutofillPageDetails from '../../models/autofillPageDetails';
export abstract class AutofillService {
getFormsWithPasswordFields: (pageDetails: AutofillPageDetails) => any[];
doAutoFill: (options: any) => Promise<string>;
doAutoFillForLastUsedLogin: (pageDetails: any, fromCommand: boolean) => Promise<string>;
doAutoFillActiveTab: (pageDetails: any, fromCommand: boolean) => Promise<string>;
}

View File

@ -3,6 +3,8 @@ import {
FieldType,
} from 'jslib/enums';
import { CipherView } from 'jslib/models/view';
import AutofillField from '../models/autofillField';
import AutofillPageDetails from '../models/autofillPageDetails';
import AutofillScript from '../models/autofillScript';
@ -117,6 +119,7 @@ var IsoProvinces: { [id: string]: string; } = {
/* tslint:enable */
export default class AutofillService implements AutofillServiceInterface {
constructor(private cipherService: CipherService, private userService: UserService,
private totpService: TotpService, private eventService: EventService) { }
@ -217,23 +220,24 @@ export default class AutofillService implements AutofillServiceInterface {
}
}
async doAutoFillForLastUsedLogin(pageDetails: any, fromCommand: boolean) {
async doAutoFillActiveTab(pageDetails: any, fromCommand: boolean) {
const tab = await this.getActiveTab();
if (!tab || !tab.url) {
return;
}
const lastUsedCipher = await this.cipherService.getLastUsedForUrl(tab.url);
if (!lastUsedCipher) {
return;
let cipher: CipherView;
if (fromCommand) {
cipher = await this.cipherService.getNextCipherForUrl(tab.url);
} else {
cipher = await this.cipherService.getLastUsedForUrl(tab.url);
}
return await this.doAutoFill({
cipher: lastUsedCipher,
// tslint:disable-next-line
cipher: cipher,
pageDetails: pageDetails,
skipTotp: !fromCommand,
skipLastUsed: true,
skipLastUsed: !fromCommand,
skipUsernameOnlyFill: !fromCommand,
onlyEmptyFields: !fromCommand,
onlyVisibleFields: !fromCommand,