aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app-routing.module.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/app-routing.module.ts')
-rw-r--r--client/src/app/app-routing.module.ts31
1 files changed, 28 insertions, 3 deletions
diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts
index 4e3cce590..4619c4046 100644
--- a/client/src/app/app-routing.module.ts
+++ b/client/src/app/app-routing.module.ts
@@ -1,10 +1,11 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouteReuseStrategy, RouterModule, Routes } from '@angular/router' 2import { RouteReuseStrategy, RouterModule, Routes, UrlMatchResult, UrlSegment } from '@angular/router'
3import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy' 3import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy'
4import { MenuGuards } from '@app/core/routing/menu-guard.service' 4import { MenuGuards } from '@app/core/routing/menu-guard.service'
5import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n' 5import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n'
6import { MetaGuard, PreloadSelectedModulesList } from './core' 6import { MetaGuard, PreloadSelectedModulesList } from './core'
7import { EmptyComponent } from './empty.component' 7import { EmptyComponent } from './empty.component'
8import { RootComponent } from './root.component'
8 9
9const routes: Routes = [ 10const routes: Routes = [
10 { 11 {
@@ -34,12 +35,12 @@ const routes: Routes = [
34 canActivateChild: [ MetaGuard ] 35 canActivateChild: [ MetaGuard ]
35 }, 36 },
36 { 37 {
37 path: 'accounts', 38 path: 'a',
38 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule), 39 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule),
39 canActivateChild: [ MetaGuard ] 40 canActivateChild: [ MetaGuard ]
40 }, 41 },
41 { 42 {
42 path: 'video-channels', 43 path: 'c',
43 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule), 44 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule),
44 canActivateChild: [ MetaGuard ] 45 canActivateChild: [ MetaGuard ]
45 }, 46 },
@@ -83,6 +84,30 @@ const routes: Routes = [
83 redirectTo: 'videos/watch/playlist' 84 redirectTo: 'videos/watch/playlist'
84 }, 85 },
85 { 86 {
87 path: 'accounts',
88 redirectTo: 'a'
89 },
90 {
91 path: 'video-channels',
92 redirectTo: 'c'
93 },
94 {
95 matcher: (url): UrlMatchResult => {
96 // Matches /@:actorName
97 if (url.length === 1 && url[0].path.match(/^@[\w]+$/gm)) {
98 return {
99 consumed: url,
100 posParams: {
101 actorName: new UrlSegment(url[0].path.substr(1), {})
102 }
103 }
104 }
105
106 return null
107 },
108 component: RootComponent
109 },
110 {
86 path: '', 111 path: '',
87 component: EmptyComponent // Avoid 404, app component will redirect dynamically 112 component: EmptyComponent // Avoid 404, app component will redirect dynamically
88 } 113 }