mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
import ts through node_modules alias
This commit is contained in:
@@ -4,7 +4,7 @@ import MainBackground from './main.background';
|
||||
|
||||
import PasswordGenerationService from '../services/passwordGeneration.service';
|
||||
|
||||
import { Services } from '@bitwarden/jslib';
|
||||
import { UtilsService } from 'jslib/services/utils.service';
|
||||
|
||||
export default class CommandsBackground {
|
||||
private commands: any;
|
||||
@@ -35,7 +35,7 @@ export default class CommandsBackground {
|
||||
private async generatePasswordToClipboard() {
|
||||
const options = await this.passwordGenerationService.getOptions();
|
||||
const password = PasswordGenerationService.generatePassword(options);
|
||||
Services.UtilsService.copyToClipboard(password);
|
||||
UtilsService.copyToClipboard(password);
|
||||
this.passwordGenerationService.addHistory(password);
|
||||
|
||||
(window as any).ga('send', {
|
||||
|
||||
@@ -5,7 +5,7 @@ import MainBackground from './main.background';
|
||||
import CipherService from '../services/cipher.service';
|
||||
import PasswordGenerationService from '../services/passwordGeneration.service';
|
||||
|
||||
import { Services } from '@bitwarden/jslib';
|
||||
import { UtilsService } from 'jslib/services/utils.service';
|
||||
|
||||
export default class ContextMenusBackground {
|
||||
private contextMenus: any;
|
||||
@@ -33,7 +33,7 @@ export default class ContextMenusBackground {
|
||||
private async generatePasswordToClipboard() {
|
||||
const options = await this.passwordGenerationService.getOptions();
|
||||
const password = PasswordGenerationService.generatePassword(options);
|
||||
Services.UtilsService.copyToClipboard(password);
|
||||
UtilsService.copyToClipboard(password);
|
||||
this.passwordGenerationService.addHistory(password);
|
||||
|
||||
(window as any).ga('send', {
|
||||
@@ -69,13 +69,13 @@ export default class ContextMenusBackground {
|
||||
hitType: 'event',
|
||||
eventAction: 'Copied Username From Context Menu',
|
||||
});
|
||||
Services.UtilsService.copyToClipboard(cipher.login.username);
|
||||
UtilsService.copyToClipboard(cipher.login.username);
|
||||
} else if (info.parentMenuItemId === 'copy-password') {
|
||||
(window as any).ga('send', {
|
||||
hitType: 'event',
|
||||
eventAction: 'Copied Password From Context Menu',
|
||||
});
|
||||
Services.UtilsService.copyToClipboard(cipher.login.password);
|
||||
UtilsService.copyToClipboard(cipher.login.password);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -2,13 +2,13 @@ import ConstantsService from '../services/constants.service';
|
||||
import LockService from '../services/lock.service';
|
||||
import MainBackground from './main.background';
|
||||
|
||||
import { Abstractions } from '@bitwarden/jslib';
|
||||
import { StorageService } from 'jslib/abstractions';
|
||||
|
||||
export default class IdleBackground {
|
||||
private idle: any;
|
||||
|
||||
constructor(private main: MainBackground, private lockService: LockService,
|
||||
private storageService: Abstractions.StorageService) {
|
||||
private storageService: StorageService) {
|
||||
this.idle = chrome.idle;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
import { Abstractions, Enums, Services } from '@bitwarden/jslib';
|
||||
import { CipherType } from 'jslib/enums';
|
||||
|
||||
import {
|
||||
CryptoService,
|
||||
UtilsService,
|
||||
} from 'jslib/services';
|
||||
|
||||
import {
|
||||
CryptoService as CryptoServiceAbstraction,
|
||||
MessagingService as MessagingServiceAbstraction,
|
||||
PlatformUtilsService as PlatformUtilsServiceAbstraction,
|
||||
StorageService as StorageServiceAbstraction,
|
||||
UtilsService as UtilsServiceAbstraction,
|
||||
} from 'jslib/abstractions';
|
||||
|
||||
import BrowserApi from '../browser/browserApi';
|
||||
|
||||
@@ -32,13 +45,13 @@ import TotpService from '../services/totp.service';
|
||||
import UserService from '../services/user.service';
|
||||
|
||||
export default class MainBackground {
|
||||
messagingService: Abstractions.MessagingService;
|
||||
storageService: Abstractions.StorageService;
|
||||
messagingService: MessagingServiceAbstraction;
|
||||
storageService: StorageServiceAbstraction;
|
||||
i18nService: any;
|
||||
platformUtilsService: Abstractions.PlatformUtilsService;
|
||||
utilsService: Abstractions.UtilsService;
|
||||
platformUtilsService: PlatformUtilsServiceAbstraction;
|
||||
utilsService: UtilsServiceAbstraction;
|
||||
constantsService: ConstantsService;
|
||||
cryptoService: Abstractions.CryptoService;
|
||||
cryptoService: CryptoServiceAbstraction;
|
||||
tokenService: TokenService;
|
||||
appIdService: AppIdService;
|
||||
apiService: ApiService;
|
||||
@@ -75,13 +88,13 @@ export default class MainBackground {
|
||||
|
||||
constructor() {
|
||||
// Services
|
||||
this.utilsService = new Services.UtilsService();
|
||||
this.utilsService = new UtilsService();
|
||||
this.platformUtilsService = new BrowserPlatformUtilsService();
|
||||
this.messagingService = new BrowserMessagingService(this.platformUtilsService);
|
||||
this.storageService = new BrowserStorageService(this.platformUtilsService);
|
||||
this.i18nService = i18nService(this.platformUtilsService);
|
||||
this.constantsService = new ConstantsService(this.i18nService, this.platformUtilsService);
|
||||
this.cryptoService = new Services.CryptoService(this.storageService,
|
||||
this.cryptoService = new CryptoService(this.storageService,
|
||||
this.storageService);
|
||||
this.tokenService = new TokenService(this.storageService);
|
||||
this.appIdService = new AppIdService(this.storageService);
|
||||
@@ -346,7 +359,7 @@ export default class MainBackground {
|
||||
}
|
||||
|
||||
private async loadLoginContextMenuOptions(cipher: any) {
|
||||
if (cipher == null || cipher.type !== Enums.CipherType.Login) {
|
||||
if (cipher == null || cipher.type !== CipherType.Login) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -363,7 +376,7 @@ export default class MainBackground {
|
||||
|
||||
private async loadContextMenuOptions(title: string, idSuffix: string, cipher: any) {
|
||||
if (!chrome.contextMenus || this.menuOptionsLoaded.indexOf(idSuffix) > -1 ||
|
||||
(cipher != null && cipher.type !== Enums.CipherType.Login)) {
|
||||
(cipher != null && cipher.type !== CipherType.Login)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import { Abstractions, Enums, Services } from '@bitwarden/jslib';
|
||||
import { CipherType } from 'jslib/enums';
|
||||
|
||||
import { UtilsService } from 'jslib/services/utils.service';
|
||||
|
||||
import {
|
||||
PlatformUtilsService,
|
||||
} from 'jslib/abstractions';
|
||||
|
||||
import BrowserApi from '../browser/browserApi';
|
||||
|
||||
@@ -13,7 +19,7 @@ export default class RuntimeBackground {
|
||||
private pageDetailsToAutoFill: any[] = [];
|
||||
|
||||
constructor(private main: MainBackground, private autofillService: AutofillService,
|
||||
private cipherService: CipherService, private platformUtilsService: Abstractions.PlatformUtilsService) {
|
||||
private cipherService: CipherService, private platformUtilsService: PlatformUtilsService) {
|
||||
this.runtime = chrome.runtime;
|
||||
}
|
||||
|
||||
@@ -146,7 +152,7 @@ export default class RuntimeBackground {
|
||||
favorite: false,
|
||||
name: loginInfo.name,
|
||||
notes: null,
|
||||
type: Enums.CipherType.Login,
|
||||
type: CipherType.Login,
|
||||
login: {
|
||||
uri: loginInfo.uri,
|
||||
username: loginInfo.username,
|
||||
@@ -177,7 +183,7 @@ export default class RuntimeBackground {
|
||||
}
|
||||
|
||||
this.main.loginsToAdd.splice(i, 1);
|
||||
const hostname = Services.UtilsService.getHostname(tab.url);
|
||||
const hostname = UtilsService.getHostname(tab.url);
|
||||
await this.cipherService.saveNeverDomain(hostname);
|
||||
BrowserApi.tabSendMessage(tab, 'closeNotificationBar');
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import CipherService from '../services/cipher.service';
|
||||
|
||||
import { Abstractions } from '@bitwarden/jslib';
|
||||
import { PlatformUtilsService } from 'jslib/abstractions';
|
||||
|
||||
export default class WebRequestBackground {
|
||||
private pendingAuthRequests: any[] = [];
|
||||
private webRequest: any;
|
||||
private isFirefox: boolean;
|
||||
|
||||
constructor(private platformUtilsService: Abstractions.PlatformUtilsService,
|
||||
constructor(private platformUtilsService: PlatformUtilsService,
|
||||
private cipherService: CipherService) {
|
||||
this.webRequest = (window as any).chrome.webRequest;
|
||||
this.isFirefox = platformUtilsService.isFirefox();
|
||||
|
||||
Reference in New Issue
Block a user