diff options
-rw-r--r-- | client/src/app/videos/+video-watch/comment/video-comments.component.ts | 27 | ||||
-rw-r--r-- | client/src/app/videos/+video-watch/video-watch.component.ts | 2 | ||||
-rw-r--r-- | client/src/assets/player/peertube-videojs-plugin.ts | 20 | ||||
-rw-r--r-- | support/doc/development/client/code.md (renamed from support/doc/client/code.md) | 11 | ||||
-rw-r--r-- | support/doc/development/client/components-tree.png (renamed from support/doc/client/components-tree.png) | bin | 47396 -> 47396 bytes | |||
-rw-r--r-- | support/doc/development/server/code.md (renamed from support/doc/server/code.md) | 2 | ||||
-rw-r--r-- | support/doc/development/server/upload-video.png (renamed from support/doc/server/upload-video.png) | bin | 56458 -> 56458 bytes |
7 files changed, 42 insertions, 20 deletions
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts index 030dee9af..6025256de 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { Component, Input, OnChanges, SimpleChanges } from '@angular/core' |
2 | import { ConfirmService } from '@app/core' | 2 | import { ConfirmService } from '@app/core' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | import { VideoComment as VideoCommentInterface, VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' | 4 | import { VideoComment as VideoCommentInterface, VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' |
@@ -15,7 +15,7 @@ import { VideoCommentService } from './video-comment.service' | |||
15 | templateUrl: './video-comments.component.html', | 15 | templateUrl: './video-comments.component.html', |
16 | styleUrls: ['./video-comments.component.scss'] | 16 | styleUrls: ['./video-comments.component.scss'] |
17 | }) | 17 | }) |
18 | export class VideoCommentsComponent implements OnInit { | 18 | export class VideoCommentsComponent implements OnChanges { |
19 | @Input() video: VideoDetails | 19 | @Input() video: VideoDetails |
20 | @Input() user: User | 20 | @Input() user: User |
21 | 21 | ||
@@ -37,9 +37,9 @@ export class VideoCommentsComponent implements OnInit { | |||
37 | private videoCommentService: VideoCommentService | 37 | private videoCommentService: VideoCommentService |
38 | ) {} | 38 | ) {} |
39 | 39 | ||
40 | ngOnInit () { | 40 | ngOnChanges (changes: SimpleChanges) { |
41 | if (this.video.commentsEnabled === true) { | 41 | if (changes['video']) { |
42 | this.loadMoreComments() | 42 | this.loadVideoComments() |
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
@@ -152,4 +152,21 @@ export class VideoCommentsComponent implements OnInit { | |||
152 | this.deleteLocalCommentThread(commentChild, commentToDelete) | 152 | this.deleteLocalCommentThread(commentChild, commentToDelete) |
153 | } | 153 | } |
154 | } | 154 | } |
155 | |||
156 | private loadVideoComments () { | ||
157 | if (this.video.commentsEnabled === true) { | ||
158 | // Reset all our fields | ||
159 | this.comments = [] | ||
160 | this.threadComments = {} | ||
161 | this.threadLoading = {} | ||
162 | this.inReplyToCommentId = undefined | ||
163 | this.componentPagination = { | ||
164 | currentPage: 1, | ||
165 | itemsPerPage: 10, | ||
166 | totalItems: null | ||
167 | } | ||
168 | |||
169 | this.loadMoreComments() | ||
170 | } | ||
171 | } | ||
155 | } | 172 | } |
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 1c2317c52..c9bdd4dfc 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -347,7 +347,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
347 | }) | 347 | }) |
348 | }) | 348 | }) |
349 | } else { | 349 | } else { |
350 | (this.player as any).setVideoFiles(this.video.files) | 350 | this.player.peertube().setVideoFiles(this.video.files) |
351 | } | 351 | } |
352 | 352 | ||
353 | this.setVideoDescriptionHTML() | 353 | this.setVideoDescriptionHTML() |
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts index 34c993f3c..0a7651a81 100644 --- a/client/src/assets/player/peertube-videojs-plugin.ts +++ b/client/src/assets/player/peertube-videojs-plugin.ts | |||
@@ -5,18 +5,20 @@ import * as WebTorrent from 'webtorrent' | |||
5 | import { VideoFile } from '../../../../shared/models/videos/video.model' | 5 | import { VideoFile } from '../../../../shared/models/videos/video.model' |
6 | import { renderVideo } from './video-renderer' | 6 | import { renderVideo } from './video-renderer' |
7 | 7 | ||
8 | declare module 'video.js' { | ||
9 | interface Player { | ||
10 | peertube (): PeerTubePlugin | ||
11 | } | ||
12 | } | ||
13 | |||
8 | interface VideoJSComponentInterface { | 14 | interface VideoJSComponentInterface { |
9 | _player: VideoJSPlayer | 15 | _player: videojs.Player |
10 | 16 | ||
11 | new (player: VideoJSPlayer, options?: any) | 17 | new (player: videojs.Player, options?: any) |
12 | 18 | ||
13 | registerComponent (name: string, obj: any) | 19 | registerComponent (name: string, obj: any) |
14 | } | 20 | } |
15 | 21 | ||
16 | interface VideoJSPlayer extends videojs.Player { | ||
17 | peertube (): PeerTubePlugin | ||
18 | } | ||
19 | |||
20 | type PeertubePluginOptions = { | 22 | type PeertubePluginOptions = { |
21 | videoFiles: VideoFile[] | 23 | videoFiles: VideoFile[] |
22 | playerElement: HTMLVideoElement | 24 | playerElement: HTMLVideoElement |
@@ -45,7 +47,7 @@ const webtorrent = new WebTorrent({ dht: false }) | |||
45 | const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem') | 47 | const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem') |
46 | class ResolutionMenuItem extends MenuItem { | 48 | class ResolutionMenuItem extends MenuItem { |
47 | 49 | ||
48 | constructor (player: VideoJSPlayer, options) { | 50 | constructor (player: videojs.Player, options) { |
49 | options.selectable = true | 51 | options.selectable = true |
50 | super(player, options) | 52 | super(player, options) |
51 | 53 | ||
@@ -64,7 +66,7 @@ const MenuButton: VideoJSComponentInterface = videojsUntyped.getComponent('MenuB | |||
64 | class ResolutionMenuButton extends MenuButton { | 66 | class ResolutionMenuButton extends MenuButton { |
65 | label: HTMLElement | 67 | label: HTMLElement |
66 | 68 | ||
67 | constructor (player: VideoJSPlayer, options) { | 69 | constructor (player: videojs.Player, options) { |
68 | options.label = 'Quality' | 70 | options.label = 'Quality' |
69 | super(player, options) | 71 | super(player, options) |
70 | 72 | ||
@@ -215,7 +217,7 @@ class PeerTubePlugin extends Plugin { | |||
215 | private videoFiles: VideoFile[] | 217 | private videoFiles: VideoFile[] |
216 | private torrent: WebTorrent.Torrent | 218 | private torrent: WebTorrent.Torrent |
217 | 219 | ||
218 | constructor (player: VideoJSPlayer, options: PeertubePluginOptions) { | 220 | constructor (player: videojs.Player, options: PeertubePluginOptions) { |
219 | super(player, options) | 221 | super(player, options) |
220 | 222 | ||
221 | this.videoFiles = options.videoFiles | 223 | this.videoFiles = options.videoFiles |
diff --git a/support/doc/client/code.md b/support/doc/development/client/code.md index 99298f21e..ddd277e54 100644 --- a/support/doc/client/code.md +++ b/support/doc/development/client/code.md | |||
@@ -32,18 +32,21 @@ Here is the description of the useful `client` files directory: | |||
32 | |__ index.html -> root HTML file for our Angular application | 32 | |__ index.html -> root HTML file for our Angular application |
33 | |__ main.ts -> Main TypeScript file that boostraps our Angular application | 33 | |__ main.ts -> Main TypeScript file that boostraps our Angular application |
34 | |__ polyfills.ts -> Polyfills imports (ES 2015...) | 34 | |__ polyfills.ts -> Polyfills imports (ES 2015...) |
35 | |__ vendor.ts -> Vendor imports (Angular, Bootstrap...) | ||
36 | 35 | ||
37 | Details of the Angular application file structure. It tries to follow [the official Angular styleguide](https://angular.io/docs/ts/latest/guide/style-guide.html). | 36 | Details of the Angular application file structure. It tries to follow [the official Angular styleguide](https://angular.io/docs/ts/latest/guide/style-guide.html). |
38 | 37 | ||
39 | app | 38 | app |
39 | |__ +admin -> Admin components (followers, users...) | ||
40 | |__ account -> Account components (password change...) | 40 | |__ account -> Account components (password change...) |
41 | |__ admin -> Admin components (friends, users...) | ||
42 | |__ core -> Core components/services | 41 | |__ core -> Core components/services |
42 | |__ header -> Header components (logo, search...) | ||
43 | |__ login -> Login component | 43 | |__ login -> Login component |
44 | |__ menu -> Menu component (on the left) | ||
44 | |__ shared -> Shared components/services (search component, REST services...) | 45 | |__ shared -> Shared components/services (search component, REST services...) |
46 | |__ signup -> Signup form | ||
45 | |__ videos -> Video components (list, watch, upload...) | 47 | |__ videos -> Video components (list, watch, upload...) |
46 | |__ app.component.{html,scss,ts} -> Main application component | 48 | |__ app.component.{html,scss,ts} -> Main application component |
49 | |__ app-routing.module.ts -> Main Angular routes | ||
47 | |__ app.module.ts -> Angular root module that imports all submodules we need | 50 | |__ app.module.ts -> Angular root module that imports all submodules we need |
48 | 51 | ||
49 | ## Conventions | 52 | ## Conventions |
@@ -53,11 +56,11 @@ Uses [TSLint](https://palantir.github.io/tslint/) for TypeScript linting and [An | |||
53 | ## Developing | 56 | ## Developing |
54 | 57 | ||
55 | * Install [the dependencies](https://github.com/Chocobozzz/PeerTube#dependencies) | 58 | * Install [the dependencies](https://github.com/Chocobozzz/PeerTube#dependencies) |
56 | * Run `yarn install` at the root directory to install all the dependencies | 59 | * Run `yarn install --pure-lockfile` at the root directory to install all the dependencies |
57 | * Run PostgreSQL and create the database `peertube_dev`. | 60 | * Run PostgreSQL and create the database `peertube_dev`. |
58 | * Run `npm run dev:client` to compile the client, run the server, watch client files modifications and reload modules on the fly (you don't need to refresh manually the web browser). The API listen on `localhost:9000` and the client on `localhost:3000`. | 61 | * Run `npm run dev:client` to compile the client, run the server, watch client files modifications and reload modules on the fly (you don't need to refresh manually the web browser). The API listen on `localhost:9000` and the client on `localhost:3000`. |
59 | 62 | ||
60 | In a Angular application, we create components that we put together. Each component is defined by an HTML structure, a TypeScript file and optionnaly a SASS file. | 63 | In a Angular application, we create components that we put together. Each component is defined by an HTML structure, a TypeScript file and optionally a SASS file. |
61 | If you are not familiar with Angular I recommend you to read the [quickstart guide](https://angular.io/docs/ts/latest/quickstart.html). | 64 | If you are not familiar with Angular I recommend you to read the [quickstart guide](https://angular.io/docs/ts/latest/quickstart.html). |
62 | 65 | ||
63 | ## Components tree | 66 | ## Components tree |
diff --git a/support/doc/client/components-tree.png b/support/doc/development/client/components-tree.png index cd89aa02b..cd89aa02b 100644 --- a/support/doc/client/components-tree.png +++ b/support/doc/development/client/components-tree.png | |||
Binary files differ | |||
diff --git a/support/doc/server/code.md b/support/doc/development/server/code.md index 7233eaf5b..d909b0c3d 100644 --- a/support/doc/server/code.md +++ b/support/doc/development/server/code.md | |||
@@ -26,7 +26,7 @@ All other server files are in the [server](https://github.com/Chocobozzz/PeerTub | |||
26 | |__ controllers -> API routes/controllers files | 26 | |__ controllers -> API routes/controllers files |
27 | |__ helpers -> functions used by different part of the project (logger, utils...) | 27 | |__ helpers -> functions used by different part of the project (logger, utils...) |
28 | |__ initializers -> functions used at the server startup (installer, database, constants...) | 28 | |__ initializers -> functions used at the server startup (installer, database, constants...) |
29 | |__ lib -> library function (WebTorrent, OAuth2, friends logic...) | 29 | |__ lib -> library function (WebTorrent, OAuth2, ActivityPub...) |
30 | |__ middlewares -> middlewares for controllers (requests validators, requests pagination...) | 30 | |__ middlewares -> middlewares for controllers (requests validators, requests pagination...) |
31 | |__ models -> Sequelize models for each SQL tables (videos, users, accounts...) | 31 | |__ models -> Sequelize models for each SQL tables (videos, users, accounts...) |
32 | |__ tests -> API tests and real world simulations (to test the decentralized feature...) | 32 | |__ tests -> API tests and real world simulations (to test the decentralized feature...) |
diff --git a/support/doc/server/upload-video.png b/support/doc/development/server/upload-video.png index 730e68cc4..730e68cc4 100644 --- a/support/doc/server/upload-video.png +++ b/support/doc/development/server/upload-video.png | |||
Binary files differ | |||