diff --git a/jslib b/jslib index 0735569479..5c961ce847 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 07355694792999042e6373ebd1b3571329a969cc +Subproject commit 5c961ce847dd9ba13784ff9ba268753aae3a8c2e diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 6d0230f75d..0a764034c2 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -682,7 +682,7 @@ "message": "Select a file." }, "maxFileSize": { - "message": "Maximum file size is 100 MB." + "message": "Maximum file size is 500 MB." }, "featureUnavailable": { "message": "Feature Unavailable" diff --git a/src/background/main.background.ts b/src/background/main.background.ts index 382c4ba16c..e2a1e462c9 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -23,6 +23,7 @@ import { import { ConsoleLogService } from 'jslib/services/consoleLog.service'; import { EventService } from 'jslib/services/event.service'; import { ExportService } from 'jslib/services/export.service'; +import { FileUploadService } from 'jslib/services/fileUpload.service'; import { NotificationsService } from 'jslib/services/notifications.service'; import { PolicyService } from 'jslib/services/policy.service'; import { SearchService } from 'jslib/services/search.service'; @@ -56,6 +57,7 @@ import { import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from 'jslib/abstractions/cryptoFunction.service'; import { EventService as EventServiceAbstraction } from 'jslib/abstractions/event.service'; import { ExportService as ExportServiceAbstraction } from 'jslib/abstractions/export.service'; +import { FileUploadService as FileUploadServiceAbstraction } from 'jslib/abstractions/fileUpload.service'; import { NotificationsService as NotificationsServiceAbstraction } from 'jslib/abstractions/notifications.service'; import { PolicyService as PolicyServiceAbstraction } from 'jslib/abstractions/policy.service'; import { SearchService as SearchServiceAbstraction } from 'jslib/abstractions/search.service'; @@ -124,6 +126,7 @@ export default class MainBackground { analytics: Analytics; popupUtilsService: PopupUtilsService; sendService: SendServiceAbstraction; + fileUploadService: FileUploadServiceAbstraction onUpdatedRan: boolean; onReplacedRan: boolean; @@ -180,15 +183,16 @@ export default class MainBackground { (expired: boolean) => this.logout(expired)); this.userService = new UserService(this.tokenService, this.storageService); this.settingsService = new SettingsService(this.userService, this.storageService); + this.fileUploadService = new FileUploadService(this.consoleLogService, this.apiService); this.cipherService = new CipherService(this.cryptoService, this.userService, this.settingsService, - this.apiService, this.storageService, this.i18nService, () => this.searchService); + this.apiService, this.fileUploadService, this.storageService, this.i18nService, () => this.searchService); this.folderService = new FolderService(this.cryptoService, this.userService, this.apiService, this.storageService, this.i18nService, this.cipherService); this.collectionService = new CollectionService(this.cryptoService, this.userService, this.storageService, this.i18nService); this.searchService = new SearchService(this.cipherService, this.consoleLogService); - this.sendService = new SendService(this.cryptoService, this.userService, this.apiService, this.storageService, - this.i18nService, this.cryptoFunctionService); + this.sendService = new SendService(this.cryptoService, this.userService, this.apiService, this.fileUploadService, + this.storageService, this.i18nService, this.cryptoFunctionService); this.stateService = new StateService(); this.policyService = new PolicyService(this.userService, this.storageService); this.vaultTimeoutService = new VaultTimeoutService(this.cipherService, this.folderService, @@ -288,7 +292,7 @@ export default class MainBackground { await this.webRequestBackground.init(); await this.windowsBackground.init(); - return new Promise(resolve => { + return new Promise(resolve => { setTimeout(async () => { await this.environmentService.setUrlsFromStorage(); await this.setIcon(); @@ -717,7 +721,7 @@ export default class MainBackground { // Browser API Helpers private contextMenusRemoveAll() { - return new Promise(resolve => { + return new Promise(resolve => { chrome.contextMenus.removeAll(() => { resolve(); if (chrome.runtime.lastError) { @@ -728,7 +732,7 @@ export default class MainBackground { } private contextMenusCreate(options: any) { - return new Promise(resolve => { + return new Promise(resolve => { chrome.contextMenus.create(options, () => { resolve(); if (chrome.runtime.lastError) { @@ -757,7 +761,7 @@ export default class MainBackground { // which doesn't resolve within a reasonable time. theAction.setIcon(options); } else { - return new Promise(resolve => { + return new Promise(resolve => { theAction.setIcon(options, () => resolve()); }); } diff --git a/src/popup/services/services.module.ts b/src/popup/services/services.module.ts index d5bdf17bdb..44cad897f1 100644 --- a/src/popup/services/services.module.ts +++ b/src/popup/services/services.module.ts @@ -25,6 +25,7 @@ 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'; +import { FileUploadService } from 'jslib/abstractions/fileUpload.service'; import { FolderService } from 'jslib/abstractions/folder.service'; import { I18nService } from 'jslib/abstractions/i18n.service'; import { MessagingService } from 'jslib/abstractions/messaging.service'; @@ -126,6 +127,7 @@ export function initFactory(platformUtilsService: PlatformUtilsService, i18nServ { provide: StateServiceAbstraction, useValue: stateService }, { provide: SearchServiceAbstraction, useValue: searchService }, { provide: AuditService, useFactory: getBgService('auditService'), deps: [] }, + { provide: FileUploadService, useFactory: getBgService('fileUploadService'), deps: [] }, { provide: CipherService, useFactory: getBgService('cipherService'), deps: [] }, { provide: CryptoFunctionService, diff --git a/src/popup/vault/attachments.component.ts b/src/popup/vault/attachments.component.ts index 152c06d70d..e1b6f1291b 100644 --- a/src/popup/vault/attachments.component.ts +++ b/src/popup/vault/attachments.component.ts @@ -2,6 +2,7 @@ import { Location } from '@angular/common'; import { Component } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; +import { ApiService } from 'jslib/abstractions/api.service'; import { CipherService } from 'jslib/abstractions/cipher.service'; import { CryptoService } from 'jslib/abstractions/crypto.service'; import { I18nService } from 'jslib/abstractions/i18n.service'; @@ -19,9 +20,9 @@ export class AttachmentsComponent extends BaseAttachmentsComponent { constructor(cipherService: CipherService, i18nService: I18nService, cryptoService: CryptoService, userService: UserService, - platformUtilsService: PlatformUtilsService, private location: Location, + platformUtilsService: PlatformUtilsService, apiService: ApiService, private location: Location, private route: ActivatedRoute, private router: Router) { - super(cipherService, i18nService, cryptoService, userService, platformUtilsService, window); + super(cipherService, i18nService, cryptoService, userService, platformUtilsService, apiService, window); } async ngOnInit() {