aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/package.json1
-rw-r--r--client/src/app/+about/about-routing.module.ts8
-rw-r--r--client/src/app/+accounts/accounts-routing.module.ts2
-rw-r--r--client/src/app/+admin/admin-routing.module.ts3
-rw-r--r--client/src/app/+login/login-routing.module.ts4
-rw-r--r--client/src/app/+my-account/my-account-routing.module.ts5
-rw-r--r--client/src/app/+my-library/my-library-routing.module.ts3
-rw-r--r--client/src/app/+reset-password/reset-password-routing.module.ts4
-rw-r--r--client/src/app/+search/search-routing.module.ts4
-rw-r--r--client/src/app/+search/search.component.ts8
-rw-r--r--client/src/app/+signup/+register/register-routing.module.ts3
-rw-r--r--client/src/app/+signup/+verify-account/verify-account-routing.module.ts4
-rw-r--r--client/src/app/+video-channels/video-channels-routing.module.ts2
-rw-r--r--client/src/app/+videos/+video-edit/video-add-routing.module.ts3
-rw-r--r--client/src/app/+videos/+video-edit/video-update-routing.module.ts3
-rw-r--r--client/src/app/+videos/+video-watch/video-watch-routing.module.ts7
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.ts2
-rw-r--r--client/src/app/+videos/videos-routing.module.ts2
-rw-r--r--client/src/app/app-routing.module.ts41
-rw-r--r--client/src/app/app.module.ts20
-rw-r--r--client/src/app/core/core.module.ts7
-rw-r--r--client/src/app/core/routing/index.ts2
-rw-r--r--client/src/app/core/routing/meta-guard.service.ts23
-rw-r--r--client/src/app/core/routing/meta.service.ts40
-rw-r--r--client/src/root-helpers/peertube-web-storage.ts13
-rw-r--r--client/tsconfig.base.json1
-rw-r--r--client/yarn.lock5
27 files changed, 125 insertions, 95 deletions
diff --git a/client/package.json b/client/package.json
index 8c164ae0e..1b9863308 100644
--- a/client/package.json
+++ b/client/package.json
@@ -51,7 +51,6 @@
51 "@ngx-loading-bar/core": "^5.0.0", 51 "@ngx-loading-bar/core": "^5.0.0",
52 "@ngx-loading-bar/http-client": "^5.0.0", 52 "@ngx-loading-bar/http-client": "^5.0.0",
53 "@ngx-loading-bar/router": "^5.0.0", 53 "@ngx-loading-bar/router": "^5.0.0",
54 "@ngx-meta/core": "^9.0.0",
55 "@types/chart.js": "^2.9.16", 54 "@types/chart.js": "^2.9.16",
56 "@types/core-js": "^2.5.2", 55 "@types/core-js": "^2.5.2",
57 "@types/debug": "^4.1.5", 56 "@types/debug": "^4.1.5",
diff --git a/client/src/app/+about/about-routing.module.ts b/client/src/app/+about/about-routing.module.ts
index 96a737555..880bf4a39 100644
--- a/client/src/app/+about/about-routing.module.ts
+++ b/client/src/app/+about/about-routing.module.ts
@@ -1,17 +1,15 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { MetaGuard } from '@ngx-meta/core'
4import { AboutComponent } from './about.component'
5import { AboutInstanceComponent } from '@app/+about/about-instance/about-instance.component'
6import { AboutPeertubeComponent } from '@app/+about/about-peertube/about-peertube.component'
7import { AboutFollowsComponent } from '@app/+about/about-follows/about-follows.component' 3import { AboutFollowsComponent } from '@app/+about/about-follows/about-follows.component'
4import { AboutInstanceComponent } from '@app/+about/about-instance/about-instance.component'
8import { AboutInstanceResolver } from '@app/+about/about-instance/about-instance.resolver' 5import { AboutInstanceResolver } from '@app/+about/about-instance/about-instance.resolver'
6import { AboutPeertubeComponent } from '@app/+about/about-peertube/about-peertube.component'
7import { AboutComponent } from './about.component'
9 8
10const aboutRoutes: Routes = [ 9const aboutRoutes: Routes = [
11 { 10 {
12 path: '', 11 path: '',
13 component: AboutComponent, 12 component: AboutComponent,
14 canActivateChild: [ MetaGuard ],
15 children: [ 13 children: [
16 { 14 {
17 path: '', 15 path: '',
diff --git a/client/src/app/+accounts/accounts-routing.module.ts b/client/src/app/+accounts/accounts-routing.module.ts
index 3bf0f7185..2f3792a8d 100644
--- a/client/src/app/+accounts/accounts-routing.module.ts
+++ b/client/src/app/+accounts/accounts-routing.module.ts
@@ -1,6 +1,5 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { MetaGuard } from '@ngx-meta/core'
4import { AccountSearchComponent } from './account-search/account-search.component' 3import { AccountSearchComponent } from './account-search/account-search.component'
5import { AccountVideoChannelsComponent } from './account-video-channels/account-video-channels.component' 4import { AccountVideoChannelsComponent } from './account-video-channels/account-video-channels.component'
6import { AccountVideosComponent } from './account-videos/account-videos.component' 5import { AccountVideosComponent } from './account-videos/account-videos.component'
@@ -14,7 +13,6 @@ const accountsRoutes: Routes = [
14 { 13 {
15 path: ':accountId', 14 path: ':accountId',
16 component: AccountsComponent, 15 component: AccountsComponent,
17 canActivateChild: [ MetaGuard ],
18 children: [ 16 children: [
19 { 17 {
20 path: '', 18 path: '',
diff --git a/client/src/app/+admin/admin-routing.module.ts b/client/src/app/+admin/admin-routing.module.ts
index 986dae8eb..d029661d3 100644
--- a/client/src/app/+admin/admin-routing.module.ts
+++ b/client/src/app/+admin/admin-routing.module.ts
@@ -4,7 +4,6 @@ import { ConfigRoutes } from '@app/+admin/config'
4import { ModerationRoutes } from '@app/+admin/moderation/moderation.routes' 4import { ModerationRoutes } from '@app/+admin/moderation/moderation.routes'
5import { PluginsRoutes } from '@app/+admin/plugins/plugins.routes' 5import { PluginsRoutes } from '@app/+admin/plugins/plugins.routes'
6import { SystemRoutes } from '@app/+admin/system' 6import { SystemRoutes } from '@app/+admin/system'
7import { MetaGuard } from '@ngx-meta/core'
8import { AdminComponent } from './admin.component' 7import { AdminComponent } from './admin.component'
9import { FollowsRoutes } from './follows' 8import { FollowsRoutes } from './follows'
10import { UsersRoutes } from './users' 9import { UsersRoutes } from './users'
@@ -13,8 +12,6 @@ const adminRoutes: Routes = [
13 { 12 {
14 path: '', 13 path: '',
15 component: AdminComponent, 14 component: AdminComponent,
16 canActivate: [ MetaGuard ],
17 canActivateChild: [ MetaGuard ],
18 children: [ 15 children: [
19 { 16 {
20 path: '', 17 path: '',
diff --git a/client/src/app/+login/login-routing.module.ts b/client/src/app/+login/login-routing.module.ts
index 258ddc5c1..c5f0f23c2 100644
--- a/client/src/app/+login/login-routing.module.ts
+++ b/client/src/app/+login/login-routing.module.ts
@@ -1,14 +1,12 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { MetaGuard } from '@ngx-meta/core'
4import { LoginComponent } from './login.component'
5import { ServerConfigResolver } from '@app/core/routing/server-config-resolver.service' 3import { ServerConfigResolver } from '@app/core/routing/server-config-resolver.service'
4import { LoginComponent } from './login.component'
6 5
7const loginRoutes: Routes = [ 6const loginRoutes: Routes = [
8 { 7 {
9 path: '', 8 path: '',
10 component: LoginComponent, 9 component: LoginComponent,
11 canActivate: [ MetaGuard ],
12 data: { 10 data: {
13 meta: { 11 meta: {
14 title: $localize`Login` 12 title: $localize`Login`
diff --git a/client/src/app/+my-account/my-account-routing.module.ts b/client/src/app/+my-account/my-account-routing.module.ts
index e2f8660fb..ef39c1a36 100644
--- a/client/src/app/+my-account/my-account-routing.module.ts
+++ b/client/src/app/+my-account/my-account-routing.module.ts
@@ -1,20 +1,19 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { MetaGuard } from '@ngx-meta/core'
4import { LoginGuard } from '../core' 3import { LoginGuard } from '../core'
5import { MyAccountAbusesListComponent } from './my-account-abuses/my-account-abuses-list.component' 4import { MyAccountAbusesListComponent } from './my-account-abuses/my-account-abuses-list.component'
5import { MyAccountApplicationsComponent } from './my-account-applications/my-account-applications.component'
6import { MyAccountBlocklistComponent } from './my-account-blocklist/my-account-blocklist.component' 6import { MyAccountBlocklistComponent } from './my-account-blocklist/my-account-blocklist.component'
7import { MyAccountServerBlocklistComponent } from './my-account-blocklist/my-account-server-blocklist.component' 7import { MyAccountServerBlocklistComponent } from './my-account-blocklist/my-account-server-blocklist.component'
8import { MyAccountNotificationsComponent } from './my-account-notifications/my-account-notifications.component' 8import { MyAccountNotificationsComponent } from './my-account-notifications/my-account-notifications.component'
9import { MyAccountSettingsComponent } from './my-account-settings/my-account-settings.component' 9import { MyAccountSettingsComponent } from './my-account-settings/my-account-settings.component'
10import { MyAccountComponent } from './my-account.component' 10import { MyAccountComponent } from './my-account.component'
11import { MyAccountApplicationsComponent } from './my-account-applications/my-account-applications.component'
12 11
13const myAccountRoutes: Routes = [ 12const myAccountRoutes: Routes = [
14 { 13 {
15 path: '', 14 path: '',
16 component: MyAccountComponent, 15 component: MyAccountComponent,
17 canActivateChild: [ MetaGuard, LoginGuard ], 16 canActivateChild: [ LoginGuard ],
18 children: [ 17 children: [
19 { 18 {
20 path: '', 19 path: '',
diff --git a/client/src/app/+my-library/my-library-routing.module.ts b/client/src/app/+my-library/my-library-routing.module.ts
index d8e5aa562..76894bed8 100644
--- a/client/src/app/+my-library/my-library-routing.module.ts
+++ b/client/src/app/+my-library/my-library-routing.module.ts
@@ -1,6 +1,5 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { MetaGuard } from '@ngx-meta/core'
4import { LoginGuard } from '../core' 3import { LoginGuard } from '../core'
5import { MyHistoryComponent } from './my-history/my-history.component' 4import { MyHistoryComponent } from './my-history/my-history.component'
6import { MyLibraryComponent } from './my-library.component' 5import { MyLibraryComponent } from './my-library.component'
@@ -17,7 +16,7 @@ const myLibraryRoutes: Routes = [
17 { 16 {
18 path: '', 17 path: '',
19 component: MyLibraryComponent, 18 component: MyLibraryComponent,
20 canActivateChild: [ MetaGuard, LoginGuard ], 19 canActivateChild: [ LoginGuard ],
21 children: [ 20 children: [
22 { 21 {
23 path: '', 22 path: '',
diff --git a/client/src/app/+reset-password/reset-password-routing.module.ts b/client/src/app/+reset-password/reset-password-routing.module.ts
index 7f1ba2f68..3532cdbc1 100644
--- a/client/src/app/+reset-password/reset-password-routing.module.ts
+++ b/client/src/app/+reset-password/reset-password-routing.module.ts
@@ -1,16 +1,14 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { MetaGuard } from '@ngx-meta/core'
4import { ResetPasswordComponent } from './reset-password.component' 3import { ResetPasswordComponent } from './reset-password.component'
5 4
6const resetPasswordRoutes: Routes = [ 5const resetPasswordRoutes: Routes = [
7 { 6 {
8 path: '', 7 path: '',
9 component: ResetPasswordComponent, 8 component: ResetPasswordComponent,
10 canActivate: [ MetaGuard ],
11 data: { 9 data: {
12 meta: { 10 meta: {
13 title: `Reset password` 11 title: $localize`Reset password`
14 } 12 }
15 } 13 }
16 } 14 }
diff --git a/client/src/app/+search/search-routing.module.ts b/client/src/app/+search/search-routing.module.ts
index e5d7d1ede..0d778af0d 100644
--- a/client/src/app/+search/search-routing.module.ts
+++ b/client/src/app/+search/search-routing.module.ts
@@ -1,6 +1,5 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { MetaGuard } from '@ngx-meta/core'
4import { ChannelLazyLoadResolver } from './channel-lazy-load.resolver' 3import { ChannelLazyLoadResolver } from './channel-lazy-load.resolver'
5import { SearchComponent } from './search.component' 4import { SearchComponent } from './search.component'
6import { VideoLazyLoadResolver } from './video-lazy-load.resolver' 5import { VideoLazyLoadResolver } from './video-lazy-load.resolver'
@@ -9,7 +8,6 @@ const searchRoutes: Routes = [
9 { 8 {
10 path: '', 9 path: '',
11 component: SearchComponent, 10 component: SearchComponent,
12 canActivate: [ MetaGuard ],
13 data: { 11 data: {
14 meta: { 12 meta: {
15 title: $localize`Search` 13 title: $localize`Search`
@@ -19,7 +17,6 @@ const searchRoutes: Routes = [
19 { 17 {
20 path: 'lazy-load-video', 18 path: 'lazy-load-video',
21 component: SearchComponent, 19 component: SearchComponent,
22 canActivate: [ MetaGuard ],
23 resolve: { 20 resolve: {
24 data: VideoLazyLoadResolver 21 data: VideoLazyLoadResolver
25 } 22 }
@@ -27,7 +24,6 @@ const searchRoutes: Routes = [
27 { 24 {
28 path: 'lazy-load-channel', 25 path: 'lazy-load-channel',
29 component: SearchComponent, 26 component: SearchComponent,
30 canActivate: [ MetaGuard ],
31 resolve: { 27 resolve: {
32 data: ChannelLazyLoadResolver 28 data: ChannelLazyLoadResolver
33 } 29 }
diff --git a/client/src/app/+search/search.component.ts b/client/src/app/+search/search.component.ts
index ecede19a3..dcf654b7a 100644
--- a/client/src/app/+search/search.component.ts
+++ b/client/src/app/+search/search.component.ts
@@ -1,12 +1,11 @@
1import { forkJoin, of, Subscription } from 'rxjs' 1import { forkJoin, of, Subscription } from 'rxjs'
2import { Component, OnDestroy, OnInit } from '@angular/core' 2import { Component, OnDestroy, OnInit } from '@angular/core'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { AuthService, ComponentPagination, HooksService, Notifier, ServerService, User, UserService } from '@app/core' 4import { AuthService, ComponentPagination, HooksService, MetaService, Notifier, ServerService, User, UserService } from '@app/core'
5import { immutableAssign } from '@app/helpers' 5import { immutableAssign } from '@app/helpers'
6import { Video, VideoChannel } from '@app/shared/shared-main' 6import { Video, VideoChannel } from '@app/shared/shared-main'
7import { AdvancedSearch, SearchService } from '@app/shared/shared-search' 7import { AdvancedSearch, SearchService } from '@app/shared/shared-search'
8import { MiniatureDisplayOptions, VideoLinkType } from '@app/shared/shared-video-miniature' 8import { MiniatureDisplayOptions, VideoLinkType } from '@app/shared/shared-video-miniature'
9import { MetaService } from '@ngx-meta/core'
10import { SearchTargetType, ServerConfig } from '@shared/models' 9import { SearchTargetType, ServerConfig } from '@shared/models'
11 10
12@Component({ 11@Component({
@@ -238,7 +237,10 @@ export class SearchComponent implements OnInit, OnDestroy {
238 } 237 }
239 238
240 private updateTitle () { 239 private updateTitle () {
241 const suffix = this.currentSearch ? ' ' + this.currentSearch : '' 240 const suffix = this.currentSearch
241 ? ' ' + this.currentSearch
242 : ''
243
242 this.metaService.setTitle($localize`Search` + suffix) 244 this.metaService.setTitle($localize`Search` + suffix)
243 } 245 }
244 246
diff --git a/client/src/app/+signup/+register/register-routing.module.ts b/client/src/app/+signup/+register/register-routing.module.ts
index 61a2fa42d..dabe79fa5 100644
--- a/client/src/app/+signup/+register/register-routing.module.ts
+++ b/client/src/app/+signup/+register/register-routing.module.ts
@@ -1,14 +1,13 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { ServerConfigResolver, UnloggedGuard } from '@app/core' 3import { ServerConfigResolver, UnloggedGuard } from '@app/core'
4import { MetaGuard } from '@ngx-meta/core'
5import { RegisterComponent } from './register.component' 4import { RegisterComponent } from './register.component'
6 5
7const registerRoutes: Routes = [ 6const registerRoutes: Routes = [
8 { 7 {
9 path: '', 8 path: '',
10 component: RegisterComponent, 9 component: RegisterComponent,
11 canActivate: [ MetaGuard, UnloggedGuard ], 10 canActivate: [ UnloggedGuard ],
12 data: { 11 data: {
13 meta: { 12 meta: {
14 title: $localize`Register` 13 title: $localize`Register`
diff --git a/client/src/app/+signup/+verify-account/verify-account-routing.module.ts b/client/src/app/+signup/+verify-account/verify-account-routing.module.ts
index 67c80ae93..1bc636345 100644
--- a/client/src/app/+signup/+verify-account/verify-account-routing.module.ts
+++ b/client/src/app/+signup/+verify-account/verify-account-routing.module.ts
@@ -1,13 +1,11 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { MetaGuard } from '@ngx-meta/core'
4import { VerifyAccountEmailComponent } from './verify-account-email/verify-account-email.component'
5import { VerifyAccountAskSendEmailComponent } from './verify-account-ask-send-email/verify-account-ask-send-email.component' 3import { VerifyAccountAskSendEmailComponent } from './verify-account-ask-send-email/verify-account-ask-send-email.component'
4import { VerifyAccountEmailComponent } from './verify-account-email/verify-account-email.component'
6 5
7const verifyAccountRoutes: Routes = [ 6const verifyAccountRoutes: Routes = [
8 { 7 {
9 path: '', 8 path: '',
10 canActivateChild: [ MetaGuard ],
11 children: [ 9 children: [
12 { 10 {
13 path: 'email', 11 path: 'email',
diff --git a/client/src/app/+video-channels/video-channels-routing.module.ts b/client/src/app/+video-channels/video-channels-routing.module.ts
index fcaad8934..4ee052873 100644
--- a/client/src/app/+video-channels/video-channels-routing.module.ts
+++ b/client/src/app/+video-channels/video-channels-routing.module.ts
@@ -1,6 +1,5 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { MetaGuard } from '@ngx-meta/core'
4import { VideoChannelPlaylistsComponent } from './video-channel-playlists/video-channel-playlists.component' 3import { VideoChannelPlaylistsComponent } from './video-channel-playlists/video-channel-playlists.component'
5import { VideoChannelVideosComponent } from './video-channel-videos/video-channel-videos.component' 4import { VideoChannelVideosComponent } from './video-channel-videos/video-channel-videos.component'
6import { VideoChannelsComponent } from './video-channels.component' 5import { VideoChannelsComponent } from './video-channels.component'
@@ -9,7 +8,6 @@ const videoChannelsRoutes: Routes = [
9 { 8 {
10 path: ':videoChannelName', 9 path: ':videoChannelName',
11 component: VideoChannelsComponent, 10 component: VideoChannelsComponent,
12 canActivateChild: [ MetaGuard ],
13 children: [ 11 children: [
14 { 12 {
15 path: '', 13 path: '',
diff --git a/client/src/app/+videos/+video-edit/video-add-routing.module.ts b/client/src/app/+videos/+video-edit/video-add-routing.module.ts
index 9ff66bea0..3b9a5ab3a 100644
--- a/client/src/app/+videos/+video-edit/video-add-routing.module.ts
+++ b/client/src/app/+videos/+video-edit/video-add-routing.module.ts
@@ -1,14 +1,13 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { CanDeactivateGuard, LoginGuard } from '@app/core' 3import { CanDeactivateGuard, LoginGuard } from '@app/core'
4import { MetaGuard } from '@ngx-meta/core'
5import { VideoAddComponent } from './video-add.component' 4import { VideoAddComponent } from './video-add.component'
6 5
7const videoAddRoutes: Routes = [ 6const videoAddRoutes: Routes = [
8 { 7 {
9 path: '', 8 path: '',
10 component: VideoAddComponent, 9 component: VideoAddComponent,
11 canActivate: [ MetaGuard, LoginGuard ], 10 canActivate: [ LoginGuard ],
12 canDeactivate: [ CanDeactivateGuard ] 11 canDeactivate: [ CanDeactivateGuard ]
13 } 12 }
14] 13]
diff --git a/client/src/app/+videos/+video-edit/video-update-routing.module.ts b/client/src/app/+videos/+video-edit/video-update-routing.module.ts
index a04351b05..ba9167dd0 100644
--- a/client/src/app/+videos/+video-edit/video-update-routing.module.ts
+++ b/client/src/app/+videos/+video-edit/video-update-routing.module.ts
@@ -1,7 +1,6 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { CanDeactivateGuard, LoginGuard } from '@app/core' 3import { CanDeactivateGuard, LoginGuard } from '@app/core'
4import { MetaGuard } from '@ngx-meta/core'
5import { VideoUpdateComponent } from './video-update.component' 4import { VideoUpdateComponent } from './video-update.component'
6import { VideoUpdateResolver } from './video-update.resolver' 5import { VideoUpdateResolver } from './video-update.resolver'
7 6
@@ -9,7 +8,7 @@ const videoUpdateRoutes: Routes = [
9 { 8 {
10 path: '', 9 path: '',
11 component: VideoUpdateComponent, 10 component: VideoUpdateComponent,
12 canActivate: [ MetaGuard, LoginGuard ], 11 canActivate: [ LoginGuard ],
13 canDeactivate: [ CanDeactivateGuard ], 12 canDeactivate: [ CanDeactivateGuard ],
14 resolve: { 13 resolve: {
15 videoData: VideoUpdateResolver 14 videoData: VideoUpdateResolver
diff --git a/client/src/app/+videos/+video-watch/video-watch-routing.module.ts b/client/src/app/+videos/+video-watch/video-watch-routing.module.ts
index d8fecb87d..cb77685c0 100644
--- a/client/src/app/+videos/+video-watch/video-watch-routing.module.ts
+++ b/client/src/app/+videos/+video-watch/video-watch-routing.module.ts
@@ -1,13 +1,11 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { MetaGuard } from '@ngx-meta/core'
4import { VideoWatchComponent } from './video-watch.component' 3import { VideoWatchComponent } from './video-watch.component'
5 4
6const videoWatchRoutes: Routes = [ 5const videoWatchRoutes: Routes = [
7 { 6 {
8 path: 'playlist/:playlistId', 7 path: 'playlist/:playlistId',
9 component: VideoWatchComponent, 8 component: VideoWatchComponent
10 canActivate: [ MetaGuard ]
11 }, 9 },
12 { 10 {
13 path: ':videoId/comments/:commentId', 11 path: ':videoId/comments/:commentId',
@@ -15,8 +13,7 @@ const videoWatchRoutes: Routes = [
15 }, 13 },
16 { 14 {
17 path: ':videoId', 15 path: ':videoId',
18 component: VideoWatchComponent, 16 component: VideoWatchComponent
19 canActivate: [ MetaGuard ]
20 } 17 }
21] 18]
22 19
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts
index 77405d149..88c5cef52 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts
@@ -9,6 +9,7 @@ import {
9 AuthUser, 9 AuthUser,
10 ConfirmService, 10 ConfirmService,
11 MarkdownService, 11 MarkdownService,
12 MetaService,
12 Notifier, 13 Notifier,
13 PeerTubeSocket, 14 PeerTubeSocket,
14 RestExtractor, 15 RestExtractor,
@@ -25,7 +26,6 @@ import { SupportModalComponent } from '@app/shared/shared-support-modal'
25import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' 26import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription'
26import { VideoActionsDisplayType, VideoDownloadComponent } from '@app/shared/shared-video-miniature' 27import { VideoActionsDisplayType, VideoDownloadComponent } from '@app/shared/shared-video-miniature'
27import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' 28import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'
28import { MetaService } from '@ngx-meta/core'
29import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' 29import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
30import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' 30import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
31import { ServerConfig, ServerErrorCode, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models' 31import { ServerConfig, ServerErrorCode, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models'
diff --git a/client/src/app/+videos/videos-routing.module.ts b/client/src/app/+videos/videos-routing.module.ts
index 16e3b9bb2..f9f476b18 100644
--- a/client/src/app/+videos/videos-routing.module.ts
+++ b/client/src/app/+videos/videos-routing.module.ts
@@ -1,7 +1,6 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { LoginGuard } from '@app/core' 3import { LoginGuard } from '@app/core'
4import { MetaGuard } from '@ngx-meta/core'
5import { VideoTrendingComponent } from './video-list' 4import { VideoTrendingComponent } from './video-list'
6import { VideoOverviewComponent } from './video-list/overview/video-overview.component' 5import { VideoOverviewComponent } from './video-list/overview/video-overview.component'
7import { VideoLocalComponent } from './video-list/video-local.component' 6import { VideoLocalComponent } from './video-list/video-local.component'
@@ -13,7 +12,6 @@ const videosRoutes: Routes = [
13 { 12 {
14 path: '', 13 path: '',
15 component: VideosComponent, 14 component: VideosComponent,
16 canActivateChild: [ MetaGuard ],
17 children: [ 15 children: [
18 { 16 {
19 path: 'overview', 17 path: 'overview',
diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts
index 57e485e8e..4e3cce590 100644
--- a/client/src/app/app-routing.module.ts
+++ b/client/src/app/app-routing.module.ts
@@ -3,7 +3,7 @@ import { RouteReuseStrategy, RouterModule, Routes } 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 { PreloadSelectedModulesList } from './core' 6import { MetaGuard, PreloadSelectedModulesList } from './core'
7import { EmptyComponent } from './empty.component' 7import { EmptyComponent } from './empty.component'
8 8
9const routes: Routes = [ 9const routes: Routes = [
@@ -11,7 +11,8 @@ const routes: Routes = [
11 path: 'admin', 11 path: 'admin',
12 canActivate: [ MenuGuards.close() ], 12 canActivate: [ MenuGuards.close() ],
13 canDeactivate: [ MenuGuards.open() ], 13 canDeactivate: [ MenuGuards.open() ],
14 loadChildren: () => import('./+admin/admin.module').then(m => m.AdminModule) 14 loadChildren: () => import('./+admin/admin.module').then(m => m.AdminModule),
15 canActivateChild: [ MetaGuard ]
15 }, 16 },
16 { 17 {
17 path: 'home', 18 path: 'home',
@@ -19,51 +20,63 @@ const routes: Routes = [
19 }, 20 },
20 { 21 {
21 path: 'my-account', 22 path: 'my-account',
22 loadChildren: () => import('./+my-account/my-account.module').then(m => m.MyAccountModule) 23 loadChildren: () => import('./+my-account/my-account.module').then(m => m.MyAccountModule),
24 canActivateChild: [ MetaGuard ]
23 }, 25 },
24 { 26 {
25 path: 'my-library', 27 path: 'my-library',
26 loadChildren: () => import('./+my-library/my-library.module').then(m => m.MyLibraryModule) 28 loadChildren: () => import('./+my-library/my-library.module').then(m => m.MyLibraryModule),
29 canActivateChild: [ MetaGuard ]
27 }, 30 },
28 { 31 {
29 path: 'verify-account', 32 path: 'verify-account',
30 loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule) 33 loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule),
34 canActivateChild: [ MetaGuard ]
31 }, 35 },
32 { 36 {
33 path: 'accounts', 37 path: 'accounts',
34 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule) 38 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule),
39 canActivateChild: [ MetaGuard ]
35 }, 40 },
36 { 41 {
37 path: 'video-channels', 42 path: 'video-channels',
38 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule) 43 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule),
44 canActivateChild: [ MetaGuard ]
39 }, 45 },
40 { 46 {
41 path: 'about', 47 path: 'about',
42 loadChildren: () => import('./+about/about.module').then(m => m.AboutModule) 48 loadChildren: () => import('./+about/about.module').then(m => m.AboutModule),
49 canActivateChild: [ MetaGuard ]
43 }, 50 },
44 { 51 {
45 path: 'signup', 52 path: 'signup',
46 loadChildren: () => import('./+signup/+register/register.module').then(m => m.RegisterModule) 53 loadChildren: () => import('./+signup/+register/register.module').then(m => m.RegisterModule),
54 canActivateChild: [ MetaGuard ]
47 }, 55 },
48 { 56 {
49 path: 'reset-password', 57 path: 'reset-password',
50 loadChildren: () => import('./+reset-password/reset-password.module').then(m => m.ResetPasswordModule) 58 loadChildren: () => import('./+reset-password/reset-password.module').then(m => m.ResetPasswordModule),
59 canActivateChild: [ MetaGuard ]
51 }, 60 },
52 { 61 {
53 path: 'login', 62 path: 'login',
54 loadChildren: () => import('./+login/login.module').then(m => m.LoginModule) 63 loadChildren: () => import('./+login/login.module').then(m => m.LoginModule),
64 canActivateChild: [ MetaGuard ]
55 }, 65 },
56 { 66 {
57 path: 'search', 67 path: 'search',
58 loadChildren: () => import('./+search/search.module').then(m => m.SearchModule) 68 loadChildren: () => import('./+search/search.module').then(m => m.SearchModule),
69 canActivateChild: [ MetaGuard ]
59 }, 70 },
60 { 71 {
61 path: 'videos', 72 path: 'videos',
62 loadChildren: () => import('./+videos/videos.module').then(m => m.VideosModule) 73 loadChildren: () => import('./+videos/videos.module').then(m => m.VideosModule),
74 canActivateChild: [ MetaGuard ]
63 }, 75 },
64 { 76 {
65 path: 'remote-interaction', 77 path: 'remote-interaction',
66 loadChildren: () => import('./+remote-interaction/remote-interaction.module').then(m => m.RemoteInteractionModule) 78 loadChildren: () => import('./+remote-interaction/remote-interaction.module').then(m => m.RemoteInteractionModule),
79 canActivateChild: [ MetaGuard ]
67 }, 80 },
68 { 81 {
69 path: 'video-playlists/watch', 82 path: 'video-playlists/watch',
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts
index 3cec6d739..9f46d49a2 100644
--- a/client/src/app/app.module.ts
+++ b/client/src/app/app.module.ts
@@ -4,9 +4,7 @@ import { APP_BASE_HREF, registerLocaleData } from '@angular/common'
4import { NgModule } from '@angular/core' 4import { NgModule } from '@angular/core'
5import { BrowserModule } from '@angular/platform-browser' 5import { BrowserModule } from '@angular/platform-browser'
6import { ServiceWorkerModule } from '@angular/service-worker' 6import { ServiceWorkerModule } from '@angular/service-worker'
7import { ServerService } from '@app/core'
8import localeOc from '@app/helpers/locales/oc' 7import localeOc from '@app/helpers/locales/oc'
9import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core'
10import { AppRoutingModule } from './app-routing.module' 8import { AppRoutingModule } from './app-routing.module'
11import { AppComponent } from './app.component' 9import { AppComponent } from './app.component'
12import { CoreModule } from './core' 10import { CoreModule } from './core'
@@ -19,12 +17,12 @@ import { CustomModalComponent } from './modal/custom-modal.component'
19import { InstanceConfigWarningModalComponent } from './modal/instance-config-warning-modal.component' 17import { InstanceConfigWarningModalComponent } from './modal/instance-config-warning-modal.component'
20import { QuickSettingsModalComponent } from './modal/quick-settings-modal.component' 18import { QuickSettingsModalComponent } from './modal/quick-settings-modal.component'
21import { WelcomeModalComponent } from './modal/welcome-modal.component' 19import { WelcomeModalComponent } from './modal/welcome-modal.component'
20import { SharedActorImageModule } from './shared/shared-actor-image/shared-actor-image.module'
22import { SharedFormModule } from './shared/shared-forms' 21import { SharedFormModule } from './shared/shared-forms'
23import { SharedGlobalIconModule } from './shared/shared-icons' 22import { SharedGlobalIconModule } from './shared/shared-icons'
24import { SharedInstanceModule } from './shared/shared-instance' 23import { SharedInstanceModule } from './shared/shared-instance'
25import { SharedMainModule } from './shared/shared-main' 24import { SharedMainModule } from './shared/shared-main'
26import { SharedUserInterfaceSettingsModule } from './shared/shared-user-settings' 25import { SharedUserInterfaceSettingsModule } from './shared/shared-user-settings'
27import { SharedActorImageModule } from './shared/shared-actor-image/shared-actor-image.module'
28 26
29registerLocaleData(localeOc, 'oc') 27registerLocaleData(localeOc, 'oc')
30 28
@@ -62,22 +60,6 @@ registerLocaleData(localeOc, 'oc')
62 SharedInstanceModule, 60 SharedInstanceModule,
63 SharedActorImageModule, 61 SharedActorImageModule,
64 62
65 MetaModule.forRoot({
66 provide: MetaLoader,
67 useFactory: (serverService: ServerService) => {
68 return new MetaStaticLoader({
69 pageTitlePositioning: PageTitlePositioning.PrependPageTitle,
70 pageTitleSeparator: ' - ',
71 get applicationName () { return serverService.getTmpConfig().instance.name },
72 defaults: {
73 get title () { return serverService.getTmpConfig().instance.name },
74 get description () { return serverService.getTmpConfig().instance.shortDescription }
75 }
76 })
77 },
78 deps: [ ServerService ]
79 }),
80
81 AppRoutingModule // Put it after all the module because it has the 404 route 63 AppRoutingModule // Put it after all the module because it has the 404 route
82 ], 64 ],
83 65
diff --git a/client/src/app/core/core.module.ts b/client/src/app/core/core.module.ts
index 3152a7003..de3274544 100644
--- a/client/src/app/core/core.module.ts
+++ b/client/src/app/core/core.module.ts
@@ -14,7 +14,7 @@ import { throwIfAlreadyLoaded } from './module-import-guard'
14import { Notifier } from './notification' 14import { Notifier } from './notification'
15import { HtmlRendererService, LinkifierService, MarkdownService } from './renderer' 15import { HtmlRendererService, LinkifierService, MarkdownService } from './renderer'
16import { RestExtractor, RestService } from './rest' 16import { RestExtractor, RestService } from './rest'
17import { LoginGuard, RedirectService, UnloggedGuard, UserRightGuard } from './routing' 17import { LoginGuard, MetaGuard, MetaService, RedirectService, UnloggedGuard, UserRightGuard } from './routing'
18import { CanDeactivateGuard } from './routing/can-deactivate-guard.service' 18import { CanDeactivateGuard } from './routing/can-deactivate-guard.service'
19import { ServerConfigResolver } from './routing/server-config-resolver.service' 19import { ServerConfigResolver } from './routing/server-config-resolver.service'
20import { ScopedTokensService } from './scoped-tokens' 20import { ScopedTokensService } from './scoped-tokens'
@@ -77,7 +77,10 @@ import { LocalStorageService, ScreenService, SessionStorageService } from './wra
77 MessageService, 77 MessageService,
78 PeerTubeSocket, 78 PeerTubeSocket,
79 ServerConfigResolver, 79 ServerConfigResolver,
80 CanDeactivateGuard 80 CanDeactivateGuard,
81
82 MetaService,
83 MetaGuard
81 ] 84 ]
82}) 85})
83export class CoreModule { 86export class CoreModule {
diff --git a/client/src/app/core/routing/index.ts b/client/src/app/core/routing/index.ts
index 239c27caf..4314ea475 100644
--- a/client/src/app/core/routing/index.ts
+++ b/client/src/app/core/routing/index.ts
@@ -3,6 +3,8 @@ export * from './custom-reuse-strategy'
3export * from './disable-for-reuse-hook' 3export * from './disable-for-reuse-hook'
4export * from './login-guard.service' 4export * from './login-guard.service'
5export * from './menu-guard.service' 5export * from './menu-guard.service'
6export * from './meta-guard.service'
7export * from './meta.service'
6export * from './preload-selected-modules-list' 8export * from './preload-selected-modules-list'
7export * from './redirect.service' 9export * from './redirect.service'
8export * from './server-config-resolver.service' 10export * from './server-config-resolver.service'
diff --git a/client/src/app/core/routing/meta-guard.service.ts b/client/src/app/core/routing/meta-guard.service.ts
new file mode 100644
index 000000000..bedb3450e
--- /dev/null
+++ b/client/src/app/core/routing/meta-guard.service.ts
@@ -0,0 +1,23 @@
1import { Injectable } from '@angular/core'
2import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, RouterStateSnapshot } from '@angular/router'
3import { MetaService } from './meta.service'
4
5@Injectable()
6export class MetaGuard implements CanActivate, CanActivateChild {
7
8 constructor (private meta: MetaService) { }
9
10 canActivate (route: ActivatedRouteSnapshot): boolean {
11 const metaSettings = route.data?.meta
12
13 if (metaSettings) {
14 this.meta.update(metaSettings)
15 }
16
17 return true
18 }
19
20 canActivateChild (route: ActivatedRouteSnapshot): boolean {
21 return this.canActivate(route)
22 }
23}
diff --git a/client/src/app/core/routing/meta.service.ts b/client/src/app/core/routing/meta.service.ts
new file mode 100644
index 000000000..a5ac778dc
--- /dev/null
+++ b/client/src/app/core/routing/meta.service.ts
@@ -0,0 +1,40 @@
1import { Injectable } from '@angular/core'
2import { Meta, Title } from '@angular/platform-browser'
3import { HTMLServerConfig } from '@shared/models/server'
4import { ServerService } from '../server'
5
6export interface MetaSettings {
7 title?: string
8}
9
10@Injectable()
11export class MetaService {
12 private config: HTMLServerConfig
13
14 constructor (
15 private titleService: Title,
16 private meta: Meta,
17 private server: ServerService
18 ) {
19 this.config = this.server.getTmpConfig()
20 this.server.getConfig()
21 .subscribe(config => this.config = config)
22 }
23
24 setTitle (subTitle?: string) {
25 let title = ''
26 if (subTitle) title += `${subTitle} - `
27
28 title += this.config.instance.name
29
30 this.titleService.setTitle(title)
31 }
32
33 setTag (name: string, value: string) {
34 this.meta.addTag({ name, content: value })
35 }
36
37 update (meta: MetaSettings) {
38 this.setTitle(meta.title)
39 }
40}
diff --git a/client/src/root-helpers/peertube-web-storage.ts b/client/src/root-helpers/peertube-web-storage.ts
index f29845443..d4cad8a20 100644
--- a/client/src/root-helpers/peertube-web-storage.ts
+++ b/client/src/root-helpers/peertube-web-storage.ts
@@ -4,17 +4,19 @@ const valuesMap = new Map()
4 4
5function proxify (instance: MemoryStorage) { 5function proxify (instance: MemoryStorage) {
6 return new Proxy(instance, { 6 return new Proxy(instance, {
7 set: function (obj, prop: string | number, value) { 7 set: function (obj, prop: string | symbol, value) {
8 if (MemoryStorage.prototype.hasOwnProperty(prop)) { 8 if (MemoryStorage.prototype.hasOwnProperty(prop)) {
9 instance[prop] = value 9 // FIXME: symbol typing issue https://github.com/microsoft/TypeScript/issues/1863
10 instance[prop as any] = value
10 } else { 11 } else {
11 instance.setItem(prop, value) 12 instance.setItem(prop, value)
12 } 13 }
13 return true 14 return true
14 }, 15 },
15 get: function (target, name: string | number) { 16 get: function (target, name: string | symbol | number) {
16 if (MemoryStorage.prototype.hasOwnProperty(name)) { 17 if (MemoryStorage.prototype.hasOwnProperty(name)) {
17 return instance[name] 18 // FIXME: symbol typing issue https://github.com/microsoft/TypeScript/issues/1863
19 return instance[name as any]
18 } 20 }
19 if (valuesMap.has(name)) { 21 if (valuesMap.has(name)) {
20 return instance.getItem(name) 22 return instance.getItem(name)
@@ -23,9 +25,8 @@ function proxify (instance: MemoryStorage) {
23 }) 25 })
24} 26}
25 27
26class MemoryStorage { 28class MemoryStorage implements Storage {
27 [key: string]: any 29 [key: string]: any
28 [index: number]: string
29 30
30 getItem (key: any) { 31 getItem (key: any) {
31 const stringKey = String(key) 32 const stringKey = String(key)
diff --git a/client/tsconfig.base.json b/client/tsconfig.base.json
index 9f63ac11a..68e902d26 100644
--- a/client/tsconfig.base.json
+++ b/client/tsconfig.base.json
@@ -7,7 +7,6 @@
7 "declaration": false, 7 "declaration": false,
8 "moduleResolution": "node", 8 "moduleResolution": "node",
9 "module": "esnext", 9 "module": "esnext",
10 "emitDecoratorMetadata": true,
11 "experimentalDecorators": true, 10 "experimentalDecorators": true,
12 "noImplicitAny": true, 11 "noImplicitAny": true,
13 "noImplicitThis": true, 12 "noImplicitThis": true,
diff --git a/client/yarn.lock b/client/yarn.lock
index aeafe81a2..beeedefdb 100644
--- a/client/yarn.lock
+++ b/client/yarn.lock
@@ -1468,11 +1468,6 @@
1468 dependencies: 1468 dependencies:
1469 tslib "^1.10.0" 1469 tslib "^1.10.0"
1470 1470
1471"@ngx-meta/core@^9.0.0":
1472 version "9.0.0"
1473 resolved "https://registry.yarnpkg.com/@ngx-meta/core/-/core-9.0.0.tgz#2c3b27bd32d41f7aaf0712d4007e0afed8e5dd3f"
1474 integrity sha512-WL/HyKM+4gJPS3TNTO0M+46LlIvGTSyofL//8hxoozAyRPsiMyR0xrwUvPBJkVqFyD6j0iI5FaNcQ9d0JCVJhg==
1475
1476"@nodelib/fs.scandir@2.1.4": 1471"@nodelib/fs.scandir@2.1.4":
1477 version "2.1.4" 1472 version "2.1.4"
1478 resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz#d4b3549a5db5de2683e0c1071ab4f140904bbf69" 1473 resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz#d4b3549a5db5de2683e0c1071ab4f140904bbf69"