1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-15 16:05:03 +00:00

Merge branch 'master' into feature/i18n-component-template

This commit is contained in:
Shane Melton
2023-10-10 11:03:01 -07:00
committed by GitHub
29 changed files with 126 additions and 48 deletions

View File

@@ -179,6 +179,23 @@
"rules": {
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/vault/*", "src/**/*"] }]
}
},
{
"files": ["apps/browser/src/**/*.ts", "libs/**/*.ts"],
"excludedFiles": "apps/browser/src/autofill/{content,notification}/**/*.ts",
"rules": {
"no-restricted-syntax": [
"error",
{
"message": "Using addListener in the browser popup produces a memory leak in Safari, use `BrowserApi.messageListener` instead",
"selector": "CallExpression > [object.object.object.name='chrome'][object.object.property.name='runtime'][object.property.name='onMessage'][property.name='addListener']"
},
{
"message": "Using addListener in the browser popup produces a memory leak in Safari, use `BrowserApi.storageChangeListener` instead",
"selector": "CallExpression > [object.object.object.name='chrome'][object.object.property.name='storage'][object.property.name='onChanged'][property.name='addListener']"
}
]
}
}
]
}

View File

@@ -208,6 +208,7 @@ export class BrowserApi {
name: string,
callback: (message: any, sender: chrome.runtime.MessageSender, response: any) => void
) {
// eslint-disable-next-line no-restricted-syntax
chrome.runtime.onMessage.addListener(callback);
if (BrowserApi.isSafariApi && !BrowserApi.isBackgroundPage(window)) {
@@ -219,6 +220,7 @@ export class BrowserApi {
static storageChangeListener(
callback: Parameters<typeof chrome.storage.onChanged.addListener>[0]
) {
// eslint-disable-next-line no-restricted-syntax
chrome.storage.onChanged.addListener(callback);
if (BrowserApi.isSafariApi && !BrowserApi.isBackgroundPage(window)) {

View File

@@ -45,10 +45,20 @@ const routes: Routes = [
},
{
path: "tools",
loadChildren: () =>
import("../tools/import-export/org-import-export.module").then(
(m) => m.OrganizationImportExportModule
),
children: [
{
path: "import",
loadChildren: () =>
import("../tools/import/org-import.module").then((m) => m.OrganizationImportModule),
},
{
path: "export",
loadChildren: () =>
import("../tools/vault-export/org-vault-export.module").then(
(m) => m.OrganizationVaultExportModule
),
},
],
},
],
},

View File

@@ -3,14 +3,13 @@ import { RouterModule, Routes } from "@angular/router";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { OrganizationPermissionsGuard } from "../../../../admin-console/organizations/guards/org-permissions.guard";
import { OrganizationPermissionsGuard } from "../../guards/org-permissions.guard";
import { OrganizationExportComponent } from "./org-export.component";
import { OrganizationImportComponent } from "./org-import.component";
const routes: Routes = [
{
path: "import",
path: "",
component: OrganizationImportComponent,
canActivate: [OrganizationPermissionsGuard],
data: {
@@ -18,18 +17,9 @@ const routes: Routes = [
organizationPermissions: (org: Organization) => org.canAccessImportExport,
},
},
{
path: "export",
component: OrganizationExportComponent,
canActivate: [OrganizationPermissionsGuard],
data: {
titleId: "exportVault",
organizationPermissions: (org: Organization) => org.canAccessImportExport,
},
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
})
export class OrganizationImportExportRoutingModule {}
export class OrganizationImportRoutingModule {}

View File

@@ -18,11 +18,11 @@ import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.serv
import { DialogService } from "@bitwarden/components";
import { ImportServiceAbstraction } from "@bitwarden/importer";
import { ImportComponent } from "../../../../tools/import-export/import.component";
import { ImportComponent } from "../../../../tools/import/import.component";
@Component({
selector: "app-org-import",
templateUrl: "../../../../tools/import-export/import.component.html",
templateUrl: "../../../../tools/import/import.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class OrganizationImportComponent extends ImportComponent {

View File

@@ -15,13 +15,12 @@ import {
import { LooseComponentsModule, SharedModule } from "../../../../shared";
import { OrganizationExportComponent } from "./org-export.component";
import { OrganizationImportExportRoutingModule } from "./org-import-export-routing.module";
import { OrganizationImportRoutingModule } from "./org-import-routing.module";
import { OrganizationImportComponent } from "./org-import.component";
@NgModule({
imports: [SharedModule, LooseComponentsModule, OrganizationImportExportRoutingModule],
declarations: [OrganizationImportComponent, OrganizationExportComponent],
imports: [SharedModule, LooseComponentsModule, OrganizationImportRoutingModule],
declarations: [OrganizationImportComponent],
providers: [
{
provide: ImportApiServiceAbstraction,
@@ -42,4 +41,4 @@ import { OrganizationImportComponent } from "./org-import.component";
},
],
})
export class OrganizationImportExportModule {}
export class OrganizationImportModule {}

View File

@@ -0,0 +1,25 @@
import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { OrganizationPermissionsGuard } from "../../guards/org-permissions.guard";
import { OrganizationVaultExportComponent } from "./org-vault-export.component";
const routes: Routes = [
{
path: "",
component: OrganizationVaultExportComponent,
canActivate: [OrganizationPermissionsGuard],
data: {
titleId: "exportVault",
organizationPermissions: (org: Organization) => org.canAccessImportExport,
},
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
})
export class OrganizationVaultExportRoutingModule {}

View File

@@ -14,14 +14,14 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
import { DialogService } from "@bitwarden/components";
import { VaultExportServiceAbstraction } from "@bitwarden/exporter/vault-export";
import { ExportComponent } from "../../../../tools/import-export/export.component";
import { ExportComponent } from "../../../../tools/vault-export/export.component";
@Component({
selector: "app-org-export",
templateUrl: "../../../../tools/import-export/export.component.html",
templateUrl: "../../../../tools/vault-export/export.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class OrganizationExportComponent extends ExportComponent {
export class OrganizationVaultExportComponent extends ExportComponent {
constructor(
cryptoService: CryptoService,
i18nService: I18nService,

View File

@@ -0,0 +1,12 @@
import { NgModule } from "@angular/core";
import { LooseComponentsModule, SharedModule } from "../../../../shared";
import { OrganizationVaultExportRoutingModule } from "./org-vault-export-routing.module";
import { OrganizationVaultExportComponent } from "./org-vault-export.component";
@NgModule({
imports: [SharedModule, LooseComponentsModule, OrganizationVaultExportRoutingModule],
declarations: [OrganizationVaultExportComponent],
})
export class OrganizationVaultExportModule {}

View File

@@ -254,11 +254,13 @@ const routes: Routes = [
children: [
{ path: "", pathMatch: "full", redirectTo: "generator" },
{
path: "",
path: "import",
loadChildren: () => import("./tools/import/import.module").then((m) => m.ImportModule),
},
{
path: "export",
loadChildren: () =>
import("./tools/import-export/import-export.module").then(
(m) => m.ImportExportModule
),
import("./tools/vault-export/export.module").then((m) => m.ExportModule),
},
{
path: "generator",

View File

@@ -0,0 +1,17 @@
import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { ImportComponent } from "./import.component";
const routes: Routes = [
{
path: "",
component: ImportComponent,
data: { titleId: "importData" },
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
})
export class ImportRoutingModule {}

View File

@@ -20,15 +20,13 @@ import {
ImportSuccessDialogComponent,
FilePasswordPromptComponent,
} from "./dialog";
import { ExportComponent } from "./export.component";
import { ImportExportRoutingModule } from "./import-export-routing.module";
import { ImportRoutingModule } from "./import-routing.module";
import { ImportComponent } from "./import.component";
@NgModule({
imports: [SharedModule, LooseComponentsModule, ImportExportRoutingModule],
imports: [SharedModule, LooseComponentsModule, ImportRoutingModule],
declarations: [
ImportComponent,
ExportComponent,
FilePasswordPromptComponent,
ImportErrorDialogComponent,
ImportSuccessDialogComponent,
@@ -53,4 +51,4 @@ import { ImportComponent } from "./import.component";
},
],
})
export class ImportExportModule {}
export class ImportModule {}

View File

@@ -2,16 +2,10 @@ import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { ExportComponent } from "./export.component";
import { ImportComponent } from "./import.component";
const routes: Routes = [
{
path: "import",
component: ImportComponent,
data: { titleId: "importData" },
},
{
path: "export",
path: "",
component: ExportComponent,
data: { titleId: "exportVault" },
},
@@ -20,4 +14,4 @@ const routes: Routes = [
@NgModule({
imports: [RouterModule.forChild(routes)],
})
export class ImportExportRoutingModule {}
export class ExportRoutingModule {}

View File

@@ -0,0 +1,12 @@
import { NgModule } from "@angular/core";
import { LooseComponentsModule, SharedModule } from "../../shared";
import { ExportRoutingModule } from "./export-routing.module";
import { ExportComponent } from "./export.component";
@NgModule({
imports: [SharedModule, LooseComponentsModule, ExportRoutingModule],
declarations: [ExportComponent],
})
export class ExportModule {}

View File

@@ -1,5 +1,5 @@
<form [formGroup]="formGroup" [bitSubmit]="submit">
<bit-dialog dialogSize="small">
<bit-dialog dialogSize="default">
<ng-container bitDialogTitle>
<span>{{ title | i18n }}</span>
<span class="tw-text-sm tw-normal-case tw-text-muted">

View File

@@ -1,5 +1,5 @@
<form [formGroup]="formGroup" [bitSubmit]="submit">
<bit-dialog dialogSize="small">
<bit-dialog dialogSize="default">
<span bitDialogTitle>{{ title | i18n }}</span>
<span bitDialogContent>
<div *ngIf="loading" class="tw-text-center">

View File

@@ -1,5 +1,5 @@
<form [formGroup]="formGroup" [bitSubmit]="submit">
<bit-dialog dialogSize="small">
<bit-dialog dialogSize="default">
<ng-container bitDialogTitle>
<span>{{ title }}</span>
<span class="tw-text-sm tw-normal-case tw-text-muted">

View File

@@ -1,5 +1,5 @@
<form [formGroup]="formGroup" [bitSubmit]="submit">
<bit-dialog dialogSize="small">
<bit-dialog dialogSize="default">
<ng-container bitDialogTitle>{{ title | i18n }}</ng-container>
<div bitDialogContent>
<div *ngIf="loading" class="tw-text-center">