aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-10 10:33:36 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-03-10 10:33:36 +0100
commit758b996dc6effcab6031b32c0bd0b81f234c1a63 (patch)
tree8a40c0882bd00932bd9003077d4c0d3db456bf24
parent86e83939869976e9b4dfa6dc9d3785a284bd598c (diff)
downloadPeerTube-758b996dc6effcab6031b32c0bd0b81f234c1a63.tar.gz
PeerTube-758b996dc6effcab6031b32c0bd0b81f234c1a63.tar.zst
PeerTube-758b996dc6effcab6031b32c0bd0b81f234c1a63.zip
Client: switch to @nglibs/meta
-rw-r--r--client/package.json2
-rw-r--r--client/src/app/app.component.ts3
-rw-r--r--client/src/app/app.module.ts26
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.ts4
-rw-r--r--client/src/index.html1
5 files changed, 21 insertions, 15 deletions
diff --git a/client/package.json b/client/package.json
index 41189231f..f882e157f 100644
--- a/client/package.json
+++ b/client/package.json
@@ -29,6 +29,7 @@
29 "@angular/router": "~3.4.1", 29 "@angular/router": "~3.4.1",
30 "@angularclass/hmr": "^1.2.0", 30 "@angularclass/hmr": "^1.2.0",
31 "@angularclass/hmr-loader": "^3.0.2", 31 "@angularclass/hmr-loader": "^3.0.2",
32 "@nglibs/meta": "^0.2.0-rc.3",
32 "@types/core-js": "^0.9.28", 33 "@types/core-js": "^0.9.28",
33 "@types/node": "^6.0.38", 34 "@types/node": "^6.0.38",
34 "@types/source-map": "^0.1.26", 35 "@types/source-map": "^0.1.26",
@@ -56,7 +57,6 @@
56 "ng-router-loader": "^1.0.2", 57 "ng-router-loader": "^1.0.2",
57 "ng2-bootstrap": "1.1.16-10", 58 "ng2-bootstrap": "1.1.16-10",
58 "ng2-file-upload": "^1.1.4-2", 59 "ng2-file-upload": "^1.1.4-2",
59 "ng2-meta": "https://github.com/chocobozzz/ng2-meta#build",
60 "ng2-smart-table": "0.5.2-1", 60 "ng2-smart-table": "0.5.2-1",
61 "ngc-webpack": "1.1.0", 61 "ngc-webpack": "1.1.0",
62 "node-sass": "^4.1.1", 62 "node-sass": "^4.1.1",
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index 47d2bfdd2..8b4b4118b 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -1,8 +1,6 @@
1import { Component, OnInit, ViewContainerRef } from '@angular/core'; 1import { Component, OnInit, ViewContainerRef } from '@angular/core';
2import { Router } from '@angular/router'; 2import { Router } from '@angular/router';
3 3
4import { MetaService } from 'ng2-meta';
5
6import { AuthService } from './core'; 4import { AuthService } from './core';
7import { UserService } from './shared'; 5import { UserService } from './shared';
8 6
@@ -27,7 +25,6 @@ export class AppComponent implements OnInit {
27 25
28 constructor( 26 constructor(
29 private router: Router, 27 private router: Router,
30 private metaService: MetaService,
31 private authService: AuthService, 28 private authService: AuthService,
32 private userService: UserService, 29 private userService: UserService,
33 viewContainerRef: ViewContainerRef 30 viewContainerRef: ViewContainerRef
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts
index 482a9b5b7..02da38b38 100644
--- a/client/src/app/app.module.ts
+++ b/client/src/app/app.module.ts
@@ -2,7 +2,7 @@ import { ApplicationRef, NgModule } from '@angular/core';
2import { BrowserModule } from '@angular/platform-browser'; 2import { BrowserModule } from '@angular/platform-browser';
3import { removeNgStyles, createNewHosts } from '@angularclass/hmr'; 3import { removeNgStyles, createNewHosts } from '@angularclass/hmr';
4 4
5import { MetaModule, MetaConfig } from 'ng2-meta'; 5import { MetaModule, MetaLoader, MetaStaticLoader, PageTitlePositioning } from '@nglibs/meta';
6import 'bootstrap-loader'; 6import 'bootstrap-loader';
7 7
8import { ENV_PROVIDERS } from './environment'; 8import { ENV_PROVIDERS } from './environment';
@@ -16,14 +16,17 @@ import { LoginModule } from './login';
16import { SharedModule } from './shared'; 16import { SharedModule } from './shared';
17import { VideosModule } from './videos'; 17import { VideosModule } from './videos';
18 18
19const metaConfig: MetaConfig = { 19export function metaFactory(): MetaLoader {
20 //Append a title suffix such as a site name to all titles 20 return new MetaStaticLoader({
21 //Defaults to false 21 pageTitlePositioning: PageTitlePositioning.PrependPageTitle,
22 useTitleSuffix: true, 22 pageTitleSeparator: ' - ',
23 defaults: { 23 applicationName: 'PeerTube',
24 title: 'PeerTube' 24 defaults: {
25 } 25 title: 'PeerTube',
26}; 26 description: 'PeerTube, a decentralized video streaming platform using P2P (BitTorrent) directly in the web browser'
27 }
28 });
29}
27 30
28// Application wide providers 31// Application wide providers
29const APP_PROVIDERS = [ 32const APP_PROVIDERS = [
@@ -43,7 +46,10 @@ const APP_PROVIDERS = [
43 46
44 AppRoutingModule, 47 AppRoutingModule,
45 48
46 MetaModule.forRoot(metaConfig), 49 MetaModule.forRoot({
50 provide: MetaLoader,
51 useFactory: (metaFactory)
52 }),
47 53
48 AccountModule, 54 AccountModule,
49 CoreModule, 55 CoreModule,
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 ed6b30102..5678f6df8 100644
--- a/client/src/app/videos/video-watch/video-watch.component.ts
+++ b/client/src/app/videos/video-watch/video-watch.component.ts
@@ -3,7 +3,7 @@ import { ActivatedRoute } from '@angular/router';
3import { Subscription } from 'rxjs/Subscription'; 3import { Subscription } from 'rxjs/Subscription';
4 4
5import * as videojs from 'video.js'; 5import * as videojs from 'video.js';
6import { MetaService } from 'ng2-meta'; 6import { MetaService } from '@nglibs/meta';
7import { NotificationsService } from 'angular2-notifications'; 7import { NotificationsService } from 'angular2-notifications';
8 8
9import { AuthService } from '../../core'; 9import { AuthService } from '../../core';
@@ -228,6 +228,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
228 } 228 }
229 229
230 private setOpenGraphTags() { 230 private setOpenGraphTags() {
231 this.metaService.setTitle(this.video.name);
232
231 this.metaService.setTag('og:type', 'video'); 233 this.metaService.setTag('og:type', 'video');
232 234
233 this.metaService.setTag('og:title', this.video.name); 235 this.metaService.setTag('og:title', this.video.name);
diff --git a/client/src/index.html b/client/src/index.html
index aa7a6035d..07658bbb7 100644
--- a/client/src/index.html
+++ b/client/src/index.html
@@ -5,6 +5,7 @@
5 5
6 <meta charset="UTF-8"> 6 <meta charset="UTF-8">
7 <meta name="viewport" content="width=device-width, initial-scale=1"> 7 <meta name="viewport" content="width=device-width, initial-scale=1">
8 <meta name="description" content="PeerTube, a decentralized video streaming platform using P2P (BitTorrent) directly in the web browser" />
8 9
9 <!-- The following comment is used by the server to prerender OpenGraph tags --> 10 <!-- The following comment is used by the server to prerender OpenGraph tags -->
10 <!-- opengraph tags --> 11 <!-- opengraph tags -->