aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app-routing.module.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-28 10:21:39 +0200
committerChocobozzz <me@florianbigard.com>2021-05-28 10:22:50 +0200
commit012580d98f489e599d44a9a2a0bdc892b9455a90 (patch)
treecd6d4abdbf43f4cd1c051ac49682b97c7b6dca92 /client/src/app/app-routing.module.ts
parentd6d96bed80700830063c6055969d2d2ff46c63c6 (diff)
downloadPeerTube-012580d98f489e599d44a9a2a0bdc892b9455a90.tar.gz
PeerTube-012580d98f489e599d44a9a2a0bdc892b9455a90.tar.zst
PeerTube-012580d98f489e599d44a9a2a0bdc892b9455a90.zip
Cleanup
We must not expose private actor objects to clients Just make 2 GET requests on channel/accounts instead
Diffstat (limited to 'client/src/app/app-routing.module.ts')
-rw-r--r--client/src/app/app-routing.module.ts28
1 files changed, 17 insertions, 11 deletions
diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts
index 4619c4046..444b6f134 100644
--- a/client/src/app/app-routing.module.ts
+++ b/client/src/app/app-routing.module.ts
@@ -5,7 +5,8 @@ import { 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' 8import { USER_USERNAME_REGEX_CHARACTERS } from './shared/form-validators/user-validators'
9import { ActorRedirectGuard } from './shared/shared-main'
9 10
10const routes: Routes = [ 11const routes: Routes = [
11 { 12 {
@@ -17,7 +18,8 @@ const routes: Routes = [
17 }, 18 },
18 { 19 {
19 path: 'home', 20 path: 'home',
20 loadChildren: () => import('./+home/home.module').then(m => m.HomeModule) 21 loadChildren: () => import('./+home/home.module').then(m => m.HomeModule),
22 canActivateChild: [ MetaGuard ]
21 }, 23 },
22 { 24 {
23 path: 'my-account', 25 path: 'my-account',
@@ -94,18 +96,22 @@ const routes: Routes = [
94 { 96 {
95 matcher: (url): UrlMatchResult => { 97 matcher: (url): UrlMatchResult => {
96 // Matches /@:actorName 98 // Matches /@:actorName
97 if (url.length === 1 && url[0].path.match(/^@[\w]+$/gm)) { 99 const regex = new RegExp(`^@(${USER_USERNAME_REGEX_CHARACTERS}+)$`)
98 return { 100 if (url.length !== 1) return null
99 consumed: url, 101
100 posParams: { 102 const matchResult = url[0].path.match(regex)
101 actorName: new UrlSegment(url[0].path.substr(1), {}) 103 if (!matchResult) return null
102 } 104
105 return {
106 consumed: url,
107 posParams: {
108 actorName: new UrlSegment(matchResult[1], {})
103 } 109 }
104 } 110 }
105
106 return null
107 }, 111 },
108 component: RootComponent 112 pathMatch: 'full',
113 canActivate: [ ActorRedirectGuard ],
114 component: EmptyComponent
109 }, 115 },
110 { 116 {
111 path: '', 117 path: '',