diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-28 11:36:33 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-28 11:38:08 +0200 |
commit | a1eda903a497857017495f37a1fd3593ba7ab23c (patch) | |
tree | a109f34af8b18c087caf6d5a7264267550f0416d /client/src/app/app-routing.module.ts | |
parent | 012580d98f489e599d44a9a2a0bdc892b9455a90 (diff) | |
download | PeerTube-a1eda903a497857017495f37a1fd3593ba7ab23c.tar.gz PeerTube-a1eda903a497857017495f37a1fd3593ba7ab23c.tar.zst PeerTube-a1eda903a497857017495f37a1fd3593ba7ab23c.zip |
Support '/w/' and '/w/p/' for watch page
And use them as default in client
Diffstat (limited to 'client/src/app/app-routing.module.ts')
-rw-r--r-- | client/src/app/app-routing.module.ts | 65 |
1 files changed, 53 insertions, 12 deletions
diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts index 444b6f134..e35f540be 100644 --- a/client/src/app/app-routing.module.ts +++ b/client/src/app/app-routing.module.ts | |||
@@ -36,16 +36,27 @@ const routes: Routes = [ | |||
36 | loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule), | 36 | loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule), |
37 | canActivateChild: [ MetaGuard ] | 37 | canActivateChild: [ MetaGuard ] |
38 | }, | 38 | }, |
39 | |||
40 | { | ||
41 | path: 'accounts', | ||
42 | redirectTo: 'a' | ||
43 | }, | ||
39 | { | 44 | { |
40 | path: 'a', | 45 | path: 'a', |
41 | loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule), | 46 | loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule), |
42 | canActivateChild: [ MetaGuard ] | 47 | canActivateChild: [ MetaGuard ] |
43 | }, | 48 | }, |
49 | |||
50 | { | ||
51 | path: 'video-channels', | ||
52 | redirectTo: 'c' | ||
53 | }, | ||
44 | { | 54 | { |
45 | path: 'c', | 55 | path: 'c', |
46 | loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule), | 56 | loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule), |
47 | canActivateChild: [ MetaGuard ] | 57 | canActivateChild: [ MetaGuard ] |
48 | }, | 58 | }, |
59 | |||
49 | { | 60 | { |
50 | path: 'about', | 61 | path: 'about', |
51 | loadChildren: () => import('./+about/about.module').then(m => m.AboutModule), | 62 | loadChildren: () => import('./+about/about.module').then(m => m.AboutModule), |
@@ -71,31 +82,60 @@ const routes: Routes = [ | |||
71 | loadChildren: () => import('./+search/search.module').then(m => m.SearchModule), | 82 | loadChildren: () => import('./+search/search.module').then(m => m.SearchModule), |
72 | canActivateChild: [ MetaGuard ] | 83 | canActivateChild: [ MetaGuard ] |
73 | }, | 84 | }, |
85 | |||
74 | { | 86 | { |
75 | path: 'videos', | 87 | path: 'videos/upload', |
76 | loadChildren: () => import('./+videos/videos.module').then(m => m.VideosModule), | 88 | loadChildren: () => import('@app/+videos/+video-edit/video-add.module').then(m => m.VideoAddModule), |
77 | canActivateChild: [ MetaGuard ] | 89 | data: { |
90 | meta: { | ||
91 | title: $localize`Upload a video` | ||
92 | } | ||
93 | } | ||
78 | }, | 94 | }, |
79 | { | 95 | { |
80 | path: 'remote-interaction', | 96 | path: 'videos/update/:uuid', |
81 | loadChildren: () => import('./+remote-interaction/remote-interaction.module').then(m => m.RemoteInteractionModule), | 97 | loadChildren: () => import('@app/+videos/+video-edit/video-update.module').then(m => m.VideoUpdateModule), |
98 | data: { | ||
99 | meta: { | ||
100 | title: $localize`Edit a video` | ||
101 | } | ||
102 | } | ||
103 | }, | ||
104 | |||
105 | { | ||
106 | path: 'videos/watch/playlist', | ||
107 | redirectTo: 'w/p' | ||
108 | }, | ||
109 | { | ||
110 | path: 'videos/watch', | ||
111 | redirectTo: 'w' | ||
112 | }, | ||
113 | { | ||
114 | path: 'w', | ||
115 | loadChildren: () => import('@app/+videos/+video-watch/video-watch.module').then(m => m.VideoWatchModule), | ||
116 | data: { | ||
117 | preload: 3000 | ||
118 | } | ||
119 | }, | ||
120 | { | ||
121 | path: 'videos', | ||
122 | loadChildren: () => import('./+videos/videos.module').then(m => m.VideosModule), | ||
82 | canActivateChild: [ MetaGuard ] | 123 | canActivateChild: [ MetaGuard ] |
83 | }, | 124 | }, |
84 | { | 125 | { |
85 | path: 'video-playlists/watch', | 126 | path: 'video-playlists/watch', |
86 | redirectTo: 'videos/watch/playlist' | 127 | redirectTo: 'videos/watch/playlist' |
87 | }, | 128 | }, |
129 | |||
88 | { | 130 | { |
89 | path: 'accounts', | 131 | path: 'remote-interaction', |
90 | redirectTo: 'a' | 132 | loadChildren: () => import('./+remote-interaction/remote-interaction.module').then(m => m.RemoteInteractionModule), |
91 | }, | 133 | canActivateChild: [ MetaGuard ] |
92 | { | ||
93 | path: 'video-channels', | ||
94 | redirectTo: 'c' | ||
95 | }, | 134 | }, |
135 | |||
136 | // Matches /@:actorName | ||
96 | { | 137 | { |
97 | matcher: (url): UrlMatchResult => { | 138 | matcher: (url): UrlMatchResult => { |
98 | // Matches /@:actorName | ||
99 | const regex = new RegExp(`^@(${USER_USERNAME_REGEX_CHARACTERS}+)$`) | 139 | const regex = new RegExp(`^@(${USER_USERNAME_REGEX_CHARACTERS}+)$`) |
100 | if (url.length !== 1) return null | 140 | if (url.length !== 1) return null |
101 | 141 | ||
@@ -113,6 +153,7 @@ const routes: Routes = [ | |||
113 | canActivate: [ ActorRedirectGuard ], | 153 | canActivate: [ ActorRedirectGuard ], |
114 | component: EmptyComponent | 154 | component: EmptyComponent |
115 | }, | 155 | }, |
156 | |||
116 | { | 157 | { |
117 | path: '', | 158 | path: '', |
118 | component: EmptyComponent // Avoid 404, app component will redirect dynamically | 159 | component: EmptyComponent // Avoid 404, app component will redirect dynamically |