2018-04-04 04:14:54 +02:00
|
|
|
import { NgModule } from '@angular/core';
|
|
|
|
import {
|
2018-10-26 18:37:55 +02:00
|
|
|
ActivatedRouteSnapshot,
|
|
|
|
RouteReuseStrategy,
|
2018-04-04 04:14:54 +02:00
|
|
|
RouterModule,
|
|
|
|
Routes,
|
|
|
|
} from '@angular/router';
|
|
|
|
|
2018-04-05 04:59:42 +02:00
|
|
|
import { AuthGuardService } from 'jslib/angular/services/auth-guard.service';
|
|
|
|
|
2018-04-10 23:14:10 +02:00
|
|
|
import { LaunchGuardService } from './services/launch-guard.service';
|
|
|
|
|
2018-04-04 16:08:30 +02:00
|
|
|
import { EnvironmentComponent } from './accounts/environment.component';
|
|
|
|
import { HintComponent } from './accounts/hint.component';
|
2018-04-04 20:19:44 +02:00
|
|
|
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';
|
2018-04-04 16:08:30 +02:00
|
|
|
import { RegisterComponent } from './accounts/register.component';
|
|
|
|
import { TwoFactorOptionsComponent } from './accounts/two-factor-options.component';
|
|
|
|
import { TwoFactorComponent } from './accounts/two-factor.component';
|
2018-04-13 06:06:48 +02:00
|
|
|
import { PasswordGeneratorHistoryComponent } from './generator/password-generator-history.component';
|
|
|
|
import { PasswordGeneratorComponent } from './generator/password-generator.component';
|
2018-04-14 04:08:24 +02:00
|
|
|
import { PrivateModeComponent } from './private-mode.component';
|
2018-04-13 06:06:48 +02:00
|
|
|
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-05 04:59:42 +02:00
|
|
|
import { TabsComponent } from './tabs.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';
|
2018-04-05 21:35:56 +02:00
|
|
|
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';
|
2018-10-23 16:29:05 +02:00
|
|
|
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
|
|
|
|
|
|
|
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: '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' },
|
|
|
|
},
|
2018-10-23 15:25:44 +02:00
|
|
|
{
|
2018-10-23 16:29:05 +02:00
|
|
|
path: 'share-cipher',
|
2018-10-23 15:25:44 +02:00
|
|
|
component: ShareComponent,
|
|
|
|
canActivate: [AuthGuardService],
|
2018-10-23 16:29:05 +02:00
|
|
|
data: { state: 'share-cipher' },
|
2018-10-23 15:25:44 +02:00
|
|
|
},
|
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' },
|
|
|
|
},
|
2018-04-13 06:06:48 +02:00
|
|
|
{
|
|
|
|
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' },
|
|
|
|
},
|
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' },
|
|
|
|
},
|
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' },
|
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' },
|
|
|
|
},
|
2018-04-11 05:49:46 +02:00
|
|
|
],
|
|
|
|
},
|
2018-04-04 04:14:54 +02:00
|
|
|
];
|
|
|
|
|
2018-10-26 18:37:55 +02:00
|
|
|
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,
|
|
|
|
/*enableTracing: true,*/
|
|
|
|
})],
|
|
|
|
exports: [RouterModule],
|
2018-10-26 18:37:55 +02:00
|
|
|
providers: [
|
|
|
|
{ provide: RouteReuseStrategy, useClass: NoRouteReuseStrategy },
|
|
|
|
],
|
2018-04-04 04:14:54 +02:00
|
|
|
})
|
|
|
|
export class AppRoutingModule { }
|