bitwarden-estensione-browser/src/popup/app-routing.module.ts

337 lines
9.9 KiB
TypeScript
Raw Normal View History

2021-02-10 16:40:15 +01:00
import { Injectable, NgModule } from '@angular/core';
2018-04-04 04:14:54 +02:00
import {
ActivatedRouteSnapshot,
RouteReuseStrategy,
2018-04-04 04:14:54 +02:00
RouterModule,
Routes,
} from '@angular/router';
import { AuthGuardService } from 'jslib-angular/services/auth-guard.service';
2018-04-05 04:59:42 +02:00
2018-04-10 23:14:10 +02:00
import { LaunchGuardService } from './services/launch-guard.service';
import { EnvironmentComponent } from './accounts/environment.component';
import { HintComponent } from './accounts/hint.component';
import { HomeComponent } from './accounts/home.component';
2018-04-05 04:59:42 +02:00
import { LockComponent } from './accounts/lock.component';
2018-04-04 04:14:54 +02:00
import { LoginComponent } from './accounts/login.component';
import { RegisterComponent } from './accounts/register.component';
import { SetPasswordComponent } from './accounts/set-password.component';
2021-02-10 16:40:15 +01:00
import { SsoComponent } from './accounts/sso.component';
import { TwoFactorOptionsComponent } from './accounts/two-factor-options.component';
import { TwoFactorComponent } from './accounts/two-factor.component';
import { PasswordGeneratorHistoryComponent } from './generator/password-generator-history.component';
2021-02-10 16:40:15 +01:00
import { PasswordGeneratorComponent } from './generator/password-generator.component';
2018-04-14 04:08:24 +02:00
import { PrivateModeComponent } from './private-mode.component';
import { TabsComponent } from './tabs.component';
2021-01-13 09:40:10 +01:00
import { ExcludedDomainsComponent } from './settings/excluded-domains.component';
import { ExportComponent } from './settings/export.component';
import { FolderAddEditComponent } from './settings/folder-add-edit.component';
import { FoldersComponent } from './settings/folders.component';
2018-04-13 20:19:33 +02:00
import { OptionsComponent } from './settings/options.component';
2018-04-13 19:18:56 +02:00
import { PremiumComponent } from './settings/premium.component';
2018-04-09 23:35:16 +02:00
import { SettingsComponent } from './settings/settings.component';
2018-04-13 17:49:03 +02:00
import { SyncComponent } from './settings/sync.component';
2018-04-06 05:49:04 +02:00
import { AddEditComponent } from './vault/add-edit.component';
2018-04-11 19:51:09 +02:00
import { AttachmentsComponent } from './vault/attachments.component';
import { CiphersComponent } from './vault/ciphers.component';
2018-10-23 18:16:27 +02:00
import { CollectionsComponent } from './vault/collections.component';
2018-04-05 04:59:42 +02:00
import { CurrentTabComponent } from './vault/current-tab.component';
import { GroupingsComponent } from './vault/groupings.component';
2018-07-30 16:54:38 +02:00
import { PasswordHistoryComponent } from './vault/password-history.component';
import { ShareComponent } from './vault/share.component';
2018-04-06 05:09:49 +02:00
import { ViewComponent } from './vault/view.component';
2018-04-04 04:14:54 +02:00
import { SendAddEditComponent } from './send/send-add-edit.component';
import { SendGroupingsComponent } from './send/send-groupings.component';
import { SendTypeComponent } from './send/send-type.component';
2018-04-04 04:14:54 +02:00
const routes: Routes = [
2018-04-10 23:14:10 +02:00
{
path: '',
redirectTo: 'home',
pathMatch: 'full',
},
{
path: 'vault',
redirectTo: '/tabs/vault',
pathMatch: 'full',
},
{
path: 'home',
component: HomeComponent,
canActivate: [LaunchGuardService],
data: { state: 'home' },
},
{
path: 'login',
component: LoginComponent,
canActivate: [LaunchGuardService],
data: { state: 'login' },
},
{
path: 'lock',
component: LockComponent,
data: { state: 'lock' },
},
{
path: '2fa',
component: TwoFactorComponent,
canActivate: [LaunchGuardService],
data: { state: '2fa' },
},
{
path: '2fa-options',
component: TwoFactorOptionsComponent,
canActivate: [LaunchGuardService],
data: { state: '2fa-options' },
},
{
path: 'sso',
component: SsoComponent,
canActivate: [LaunchGuardService],
data: { state: 'sso' },
},
{
path: 'set-password',
component: SetPasswordComponent,
data: { state: 'set-password' },
},
2018-04-10 23:14:10 +02:00
{
path: 'register',
component: RegisterComponent,
canActivate: [LaunchGuardService],
data: { state: 'register' },
},
{
path: 'hint',
component: HintComponent,
canActivate: [LaunchGuardService],
data: { state: 'hint' },
},
{
path: 'environment',
component: EnvironmentComponent,
canActivate: [LaunchGuardService],
data: { state: 'environment' },
},
{
path: 'ciphers',
component: CiphersComponent,
canActivate: [AuthGuardService],
data: { state: 'ciphers' },
},
{
path: 'view-cipher',
component: ViewComponent,
canActivate: [AuthGuardService],
data: { state: 'view-cipher' },
},
2018-07-30 16:54:38 +02:00
{
path: 'cipher-password-history',
component: PasswordHistoryComponent,
canActivate: [AuthGuardService],
data: { state: 'cipher-password-history' },
},
2018-04-10 23:14:10 +02:00
{
path: 'add-cipher',
component: AddEditComponent,
canActivate: [AuthGuardService],
data: { state: 'add-cipher' },
},
{
path: 'edit-cipher',
component: AddEditComponent,
canActivate: [AuthGuardService],
data: { state: 'edit-cipher' },
},
{
path: 'share-cipher',
component: ShareComponent,
canActivate: [AuthGuardService],
data: { state: 'share-cipher' },
},
2018-10-23 18:16:27 +02:00
{
path: 'collections',
component: CollectionsComponent,
canActivate: [AuthGuardService],
data: { state: 'collections' },
},
2018-04-11 19:51:09 +02:00
{
path: 'attachments',
component: AttachmentsComponent,
canActivate: [AuthGuardService],
data: { state: 'attachments' },
},
2018-04-10 23:14:10 +02:00
{
path: 'generator',
component: PasswordGeneratorComponent,
canActivate: [AuthGuardService],
data: { state: 'generator' },
},
{
path: 'generator-history',
component: PasswordGeneratorHistoryComponent,
canActivate: [AuthGuardService],
data: { state: 'generator-history' },
},
{
path: 'export',
component: ExportComponent,
canActivate: [AuthGuardService],
data: { state: 'export' },
},
{
path: 'folders',
component: FoldersComponent,
canActivate: [AuthGuardService],
data: { state: 'folders' },
},
{
path: 'add-folder',
component: FolderAddEditComponent,
canActivate: [AuthGuardService],
data: { state: 'add-folder' },
},
{
path: 'edit-folder',
component: FolderAddEditComponent,
canActivate: [AuthGuardService],
data: { state: 'edit-folder' },
},
2018-04-13 17:49:03 +02:00
{
path: 'sync',
component: SyncComponent,
canActivate: [AuthGuardService],
data: { state: 'sync' },
},
{
path: 'excluded-domains',
component: ExcludedDomainsComponent,
canActivate: [AuthGuardService],
data: { state: 'excluded-domains' },
},
2018-04-13 19:18:56 +02:00
{
path: 'premium',
component: PremiumComponent,
canActivate: [AuthGuardService],
data: { state: 'premium' },
},
2018-04-13 20:19:33 +02:00
{
path: 'options',
component: OptionsComponent,
canActivate: [AuthGuardService],
data: { state: 'options' },
},
2018-04-14 04:08:24 +02:00
{
path: 'private-mode',
component: PrivateModeComponent,
data: { state: 'private-mode' },
},
{
path: 'clone-cipher',
component: AddEditComponent,
canActivate: [AuthGuardService],
data: { state: 'clone-cipher' },
},
{
path: 'send-type',
component: SendTypeComponent,
canActivate: [AuthGuardService],
data: { state: 'send-type' },
},
{
path: 'add-send',
component: SendAddEditComponent,
canActivate: [AuthGuardService],
data: { state: 'add-send' },
},
{
path: 'edit-send',
component: SendAddEditComponent,
canActivate: [AuthGuardService],
data: { state: 'edit-send' },
},
2018-04-10 23:14:10 +02:00
{
path: 'tabs',
component: TabsComponent,
2018-04-09 15:51:22 +02:00
data: { state: 'tabs' },
2018-04-05 04:59:42 +02:00
children: [
2018-04-10 23:14:10 +02:00
{
path: '',
redirectTo: '/tabs/vault',
pathMatch: 'full',
},
2018-04-05 04:59:42 +02:00
{
path: 'current',
component: CurrentTabComponent,
canActivate: [AuthGuardService],
2018-04-09 15:51:22 +02:00
data: { state: 'tabs_current' },
2019-08-19 15:17:40 +02:00
runGuardsAndResolvers: 'always',
2018-04-05 04:59:42 +02:00
},
{
path: 'vault',
component: GroupingsComponent,
canActivate: [AuthGuardService],
2018-04-09 15:51:22 +02:00
data: { state: 'tabs_vault' },
2018-04-09 23:35:16 +02:00
},
{
2018-04-11 05:03:29 +02:00
path: 'generator',
component: PasswordGeneratorComponent,
2018-04-09 23:35:16 +02:00
canActivate: [AuthGuardService],
2018-04-11 05:03:29 +02:00
data: { state: 'tabs_generator' },
2018-04-09 23:35:16 +02:00
},
{
path: 'settings',
component: SettingsComponent,
canActivate: [AuthGuardService],
data: { state: 'tabs_settings' },
},
{
path: 'send',
component: SendGroupingsComponent,
canActivate: [AuthGuardService],
data: { state: 'tabs_send' },
},
2018-04-11 05:49:46 +02:00
],
},
2018-04-04 04:14:54 +02:00
];
@Injectable()
export class NoRouteReuseStrategy implements RouteReuseStrategy {
shouldDetach(route: ActivatedRouteSnapshot) {
return false;
}
store(route: ActivatedRouteSnapshot, handle: {}) { /* Nothing */ }
shouldAttach(route: ActivatedRouteSnapshot) {
return false;
}
retrieve(route: ActivatedRouteSnapshot): any {
return null;
}
shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot) {
return false;
}
}
2018-04-04 04:14:54 +02:00
@NgModule({
imports: [RouterModule.forRoot(routes, {
useHash: true,
2019-08-19 15:17:40 +02:00
onSameUrlNavigation: 'reload',
2018-04-04 04:14:54 +02:00
/*enableTracing: true,*/
})],
exports: [RouterModule],
providers: [
{ provide: RouteReuseStrategy, useClass: NoRouteReuseStrategy },
],
2018-04-04 04:14:54 +02:00
})
export class AppRoutingModule { }