diff options
author | Chocobozzz <me@florianbigard.com> | 2018-10-18 14:35:31 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-10-18 14:35:31 +0200 |
commit | c199c427d4ae586339822320f20f512a7a19dc3f (patch) | |
tree | 9cbe8bebc25e97d2e8086c41bcd7180dd752dbac /client/src/app | |
parent | cdf4cb9eaf5f6bc71f7c1e1963c07575f1d2593d (diff) | |
download | PeerTube-c199c427d4ae586339822320f20f512a7a19dc3f.tar.gz PeerTube-c199c427d4ae586339822320f20f512a7a19dc3f.tar.zst PeerTube-c199c427d4ae586339822320f20f512a7a19dc3f.zip |
Better typings
Diffstat (limited to 'client/src/app')
42 files changed, 102 insertions, 90 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index 9a9298825..f48b6fc1a 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |||
@@ -62,7 +62,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
62 | } | 62 | } |
63 | 63 | ||
64 | ngOnInit () { | 64 | ngOnInit () { |
65 | const formGroupData: any = { | 65 | const formGroupData: { [key: string]: any } = { |
66 | instanceName: this.customConfigValidatorsService.INSTANCE_NAME, | 66 | instanceName: this.customConfigValidatorsService.INSTANCE_NAME, |
67 | instanceShortDescription: this.customConfigValidatorsService.INSTANCE_SHORT_DESCRIPTION, | 67 | instanceShortDescription: this.customConfigValidatorsService.INSTANCE_SHORT_DESCRIPTION, |
68 | instanceDescription: null, | 68 | instanceDescription: null, |
@@ -202,7 +202,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
202 | } | 202 | } |
203 | 203 | ||
204 | private updateForm () { | 204 | private updateForm () { |
205 | const data: any = { | 205 | const data: { [key: string]: any } = { |
206 | instanceName: this.customConfig.instance.name, | 206 | instanceName: this.customConfig.instance.name, |
207 | instanceShortDescription: this.customConfig.instance.shortDescription, | 207 | instanceShortDescription: this.customConfig.instance.shortDescription, |
208 | instanceDescription: this.customConfig.instance.description, | 208 | instanceDescription: this.customConfig.instance.description, |
diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts index a4d696e69..99ce5804b 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts | |||
@@ -7,7 +7,7 @@ export abstract class UserEdit extends FormReactive { | |||
7 | 7 | ||
8 | videoQuotaOptions: { value: string, label: string }[] = [] | 8 | videoQuotaOptions: { value: string, label: string }[] = [] |
9 | videoQuotaDailyOptions: { value: string, label: string }[] = [] | 9 | videoQuotaDailyOptions: { value: string, label: string }[] = [] |
10 | roles = Object.keys(USER_ROLE_LABELS).map((key: any) => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) | 10 | roles = Object.keys(USER_ROLE_LABELS).map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) |
11 | 11 | ||
12 | protected abstract serverService: ServerService | 12 | protected abstract serverService: ServerService |
13 | protected abstract configService: ConfigService | 13 | protected abstract configService: ConfigService |
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index 0d7f88d2b..3859af9ff 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts | |||
@@ -23,7 +23,7 @@ export class UserListComponent extends RestTable implements OnInit { | |||
23 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 23 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
24 | 24 | ||
25 | selectedUsers: User[] = [] | 25 | selectedUsers: User[] = [] |
26 | bulkUserActions: DropdownAction<User>[] = [] | 26 | bulkUserActions: DropdownAction<User[]>[] = [] |
27 | 27 | ||
28 | constructor ( | 28 | constructor ( |
29 | private notificationsService: NotificationsService, | 29 | private notificationsService: NotificationsService, |
@@ -45,12 +45,12 @@ export class UserListComponent extends RestTable implements OnInit { | |||
45 | { | 45 | { |
46 | label: this.i18n('Ban'), | 46 | label: this.i18n('Ban'), |
47 | handler: users => this.openBanUserModal(users), | 47 | handler: users => this.openBanUserModal(users), |
48 | isDisplayed: users => users.every((u: any) => u.blocked === false) | 48 | isDisplayed: users => users.every(u => u.blocked === false) |
49 | }, | 49 | }, |
50 | { | 50 | { |
51 | label: this.i18n('Unban'), | 51 | label: this.i18n('Unban'), |
52 | handler: users => this.unbanUsers(users), | 52 | handler: users => this.unbanUsers(users), |
53 | isDisplayed: users => users.every((u: any) => u.blocked === true) | 53 | isDisplayed: users => users.every(u => u.blocked === true) |
54 | } | 54 | } |
55 | ] | 55 | ] |
56 | } | 56 | } |
diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts index f2b8a4e26..5d43956f2 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts +++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' | 4 | import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' |
@@ -17,11 +17,9 @@ import { VideoChannelValidatorsService } from '@app/shared/forms/form-validators | |||
17 | styleUrls: [ './my-account-video-channel-edit.component.scss' ] | 17 | styleUrls: [ './my-account-video-channel-edit.component.scss' ] |
18 | }) | 18 | }) |
19 | export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelEdit implements OnInit, OnDestroy { | 19 | export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelEdit implements OnInit, OnDestroy { |
20 | @ViewChild('avatarfileInput') avatarfileInput: any | ||
21 | |||
22 | error: string | 20 | error: string |
23 | |||
24 | videoChannelToUpdate: VideoChannel | 21 | videoChannelToUpdate: VideoChannel |
22 | |||
25 | private paramsSub: Subscription | 23 | private paramsSub: Subscription |
26 | 24 | ||
27 | constructor ( | 25 | constructor ( |
diff --git a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts index 52307f09e..2d88ac760 100644 --- a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts +++ b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts | |||
@@ -66,7 +66,7 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni | |||
66 | } | 66 | } |
67 | 67 | ||
68 | isInSelectionMode () { | 68 | isInSelectionMode () { |
69 | return Object.keys(this.checkedVideos).some((k: any) => this.checkedVideos[ k ] === true) | 69 | return Object.keys(this.checkedVideos).some(k => this.checkedVideos[ k ] === true) |
70 | } | 70 | } |
71 | 71 | ||
72 | getVideosObservable (page: number) { | 72 | getVideosObservable (page: number) { |
@@ -81,7 +81,7 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni | |||
81 | 81 | ||
82 | async deleteSelectedVideos () { | 82 | async deleteSelectedVideos () { |
83 | const toDeleteVideosIds = Object.keys(this.checkedVideos) | 83 | const toDeleteVideosIds = Object.keys(this.checkedVideos) |
84 | .filter((k: any) => this.checkedVideos[ k ] === true) | 84 | .filter(k => this.checkedVideos[ k ] === true) |
85 | .map(k => parseInt(k, 10)) | 85 | .map(k => parseInt(k, 10)) |
86 | 86 | ||
87 | const res = await this.confirmService.confirm( | 87 | const res = await this.confirmService.confirm( |
@@ -168,10 +168,9 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni | |||
168 | } | 168 | } |
169 | 169 | ||
170 | private spliceVideosById (id: number) { | 170 | private spliceVideosById (id: number) { |
171 | let key: any | 171 | for (const key of Object.keys(this.loadedPages)) { |
172 | for (key of Object.keys(this.loadedPages)) { | 172 | const videos: Video[] = this.loadedPages[ key ] |
173 | const videos = this.loadedPages[ key ] | 173 | const index = videos.findIndex(v => v.id === id) |
174 | const index = videos.findIndex((v: any) => v.id === id) | ||
175 | 174 | ||
176 | if (index !== -1) { | 175 | if (index !== -1) { |
177 | videos.splice(index, 1) | 176 | videos.splice(index, 1) |
diff --git a/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts b/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts index eb3f9404f..9f94f3c13 100644 --- a/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts +++ b/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts | |||
@@ -49,8 +49,7 @@ export class VideoChangeOwnershipComponent extends FormReactive implements OnIni | |||
49 | .catch((_) => _) // Called when closing (cancel) the modal without validating, do nothing | 49 | .catch((_) => _) // Called when closing (cancel) the modal without validating, do nothing |
50 | } | 50 | } |
51 | 51 | ||
52 | // TODO: typing | 52 | search (event: { query: string }) { |
53 | search (event: any) { | ||
54 | const query = event.query | 53 | const query = event.query |
55 | this.userService.autocomplete(query) | 54 | this.userService.autocomplete(query) |
56 | .subscribe( | 55 | .subscribe( |
diff --git a/client/src/app/+my-account/shared/actor-avatar-info.component.ts b/client/src/app/+my-account/shared/actor-avatar-info.component.ts index b4505a7f2..54bacc212 100644 --- a/client/src/app/+my-account/shared/actor-avatar-info.component.ts +++ b/client/src/app/+my-account/shared/actor-avatar-info.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core' |
2 | import { ServerService } from '../../core/server' | 2 | import { ServerService } from '../../core/server' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 4 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
@@ -10,7 +10,7 @@ import { Account } from '@app/shared/account/account.model' | |||
10 | styleUrls: [ './actor-avatar-info.component.scss' ] | 10 | styleUrls: [ './actor-avatar-info.component.scss' ] |
11 | }) | 11 | }) |
12 | export class ActorAvatarInfoComponent { | 12 | export class ActorAvatarInfoComponent { |
13 | @ViewChild('avatarfileInput') avatarfileInput: any | 13 | @ViewChild('avatarfileInput') avatarfileInput: ElementRef<HTMLInputElement> |
14 | 14 | ||
15 | @Input() actor: VideoChannel | Account | 15 | @Input() actor: VideoChannel | Account |
16 | 16 | ||
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index 5315c8b1d..443772c9e 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts | |||
@@ -221,7 +221,7 @@ export class AuthService { | |||
221 | } | 221 | } |
222 | 222 | ||
223 | refreshUserInformation () { | 223 | refreshUserInformation () { |
224 | const obj: any = { | 224 | const obj: UserLoginWithUsername = { |
225 | access_token: this.user.getAccessToken(), | 225 | access_token: this.user.getAccessToken(), |
226 | refresh_token: null, | 226 | refresh_token: null, |
227 | token_type: this.user.getTokenType(), | 227 | token_type: this.user.getTokenType(), |
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index 1663a052c..da8bd26db 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts | |||
@@ -154,8 +154,8 @@ export class ServerService { | |||
154 | this.localeObservable | 154 | this.localeObservable |
155 | .pipe( | 155 | .pipe( |
156 | switchMap(translations => { | 156 | switchMap(translations => { |
157 | return this.http.get(ServerService.BASE_VIDEO_URL + attributeName) | 157 | return this.http.get<{ [id: string]: string }>(ServerService.BASE_VIDEO_URL + attributeName) |
158 | .pipe(map((data: any) => ({ data, translations }))) | 158 | .pipe(map(data => ({ data, translations }))) |
159 | }) | 159 | }) |
160 | ) | 160 | ) |
161 | .subscribe(({ data, translations }) => { | 161 | .subscribe(({ data, translations }) => { |
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts index 348700c09..371beb4a5 100644 --- a/client/src/app/menu/menu.component.ts +++ b/client/src/app/menu/menu.component.ts | |||
@@ -18,7 +18,7 @@ export class MenuComponent implements OnInit { | |||
18 | userHasAdminAccess = false | 18 | userHasAdminAccess = false |
19 | helpVisible = false | 19 | helpVisible = false |
20 | 20 | ||
21 | private routesPerRight: any = { | 21 | private routesPerRight: { [ role in UserRight ]?: string } = { |
22 | [UserRight.MANAGE_USERS]: '/admin/users', | 22 | [UserRight.MANAGE_USERS]: '/admin/users', |
23 | [UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends', | 23 | [UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends', |
24 | [UserRight.MANAGE_VIDEO_ABUSES]: '/admin/moderation/video-abuses', | 24 | [UserRight.MANAGE_VIDEO_ABUSES]: '/admin/moderation/video-abuses', |
diff --git a/client/src/app/search/advanced-search.model.ts b/client/src/app/search/advanced-search.model.ts index 1d6c89282..033fa9bba 100644 --- a/client/src/app/search/advanced-search.model.ts +++ b/client/src/app/search/advanced-search.model.ts | |||
@@ -53,7 +53,7 @@ export class AdvancedSearch { | |||
53 | } | 53 | } |
54 | 54 | ||
55 | containsValues () { | 55 | containsValues () { |
56 | const obj: any = this.toUrlObject() | 56 | const obj = this.toUrlObject() |
57 | for (const k of Object.keys(obj)) { | 57 | for (const k of Object.keys(obj)) { |
58 | if (k === 'sort') continue // Exception | 58 | if (k === 'sort') continue // Exception |
59 | 59 | ||
@@ -113,7 +113,7 @@ export class AdvancedSearch { | |||
113 | size () { | 113 | size () { |
114 | let acc = 0 | 114 | let acc = 0 |
115 | 115 | ||
116 | const obj: any = this.toUrlObject() | 116 | const obj = this.toUrlObject() |
117 | for (const k of Object.keys(obj)) { | 117 | for (const k of Object.keys(obj)) { |
118 | if (k === 'sort') continue // Exception | 118 | if (k === 'sort') continue // Exception |
119 | 119 | ||
diff --git a/client/src/app/shared/buttons/action-dropdown.component.ts b/client/src/app/shared/buttons/action-dropdown.component.ts index 9877f639d..d8026ef41 100644 --- a/client/src/app/shared/buttons/action-dropdown.component.ts +++ b/client/src/app/shared/buttons/action-dropdown.component.ts | |||
@@ -2,9 +2,9 @@ import { Component, Input } from '@angular/core' | |||
2 | 2 | ||
3 | export type DropdownAction<T> = { | 3 | export type DropdownAction<T> = { |
4 | label?: string | 4 | label?: string |
5 | handler?: (T: any) => any | 5 | handler?: (a: T) => any |
6 | linkBuilder?: (T: any) => (string | number)[] | 6 | linkBuilder?: (a: T) => (string | number)[] |
7 | isDisplayed?: (T: any) => boolean | 7 | isDisplayed?: (a: T) => boolean |
8 | } | 8 | } |
9 | 9 | ||
10 | @Component({ | 10 | @Component({ |
diff --git a/client/src/app/shared/buttons/button.component.ts b/client/src/app/shared/buttons/button.component.ts index cccf98bc3..1a1162f09 100644 --- a/client/src/app/shared/buttons/button.component.ts +++ b/client/src/app/shared/buttons/button.component.ts | |||
@@ -8,9 +8,9 @@ import { Component, Input } from '@angular/core' | |||
8 | 8 | ||
9 | export class ButtonComponent { | 9 | export class ButtonComponent { |
10 | @Input() label = '' | 10 | @Input() label = '' |
11 | @Input() className: any = undefined | 11 | @Input() className: string = undefined |
12 | @Input() icon: any = undefined | 12 | @Input() icon: string = undefined |
13 | @Input() title: any = undefined | 13 | @Input() title: string = undefined |
14 | 14 | ||
15 | getTitle () { | 15 | getTitle () { |
16 | return this.title || this.label | 16 | return this.title || this.label |
diff --git a/client/src/app/shared/buttons/edit-button.component.ts b/client/src/app/shared/buttons/edit-button.component.ts index ea552663a..1fe4f7b30 100644 --- a/client/src/app/shared/buttons/edit-button.component.ts +++ b/client/src/app/shared/buttons/edit-button.component.ts | |||
@@ -8,5 +8,5 @@ import { Component, Input } from '@angular/core' | |||
8 | 8 | ||
9 | export class EditButtonComponent { | 9 | export class EditButtonComponent { |
10 | @Input() label: string | 10 | @Input() label: string |
11 | @Input() routerLink: any = [] | 11 | @Input() routerLink: string[] = [] |
12 | } | 12 | } |
diff --git a/client/src/app/shared/guards/can-deactivate-guard.service.ts b/client/src/app/shared/guards/can-deactivate-guard.service.ts index e2a79e8c4..3a35fcfb3 100644 --- a/client/src/app/shared/guards/can-deactivate-guard.service.ts +++ b/client/src/app/shared/guards/can-deactivate-guard.service.ts | |||
@@ -4,8 +4,10 @@ import { Observable } from 'rxjs' | |||
4 | import { ConfirmService } from '../../core/index' | 4 | import { ConfirmService } from '../../core/index' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
6 | 6 | ||
7 | export type CanComponentDeactivateResult = { text?: string, canDeactivate: Observable<boolean> | boolean } | ||
8 | |||
7 | export interface CanComponentDeactivate { | 9 | export interface CanComponentDeactivate { |
8 | canDeactivate: () => { text?: string, canDeactivate: Observable<boolean> | boolean } | 10 | canDeactivate: () => CanComponentDeactivateResult |
9 | } | 11 | } |
10 | 12 | ||
11 | @Injectable() | 13 | @Injectable() |
diff --git a/client/src/app/shared/misc/help.component.ts b/client/src/app/shared/misc/help.component.ts index ccce1ccfa..ba0452e77 100644 --- a/client/src/app/shared/misc/help.component.ts +++ b/client/src/app/shared/misc/help.component.ts | |||
@@ -60,7 +60,7 @@ export class HelpComponent implements OnInit, OnChanges { | |||
60 | } | 60 | } |
61 | 61 | ||
62 | private createMarkdownList (rules: string[]) { | 62 | private createMarkdownList (rules: string[]) { |
63 | const rulesToText: any = { | 63 | const rulesToText = { |
64 | 'emphasis': this.i18n('Emphasis'), | 64 | 'emphasis': this.i18n('Emphasis'), |
65 | 'link': this.i18n('Links'), | 65 | 'link': this.i18n('Links'), |
66 | 'newline': this.i18n('New lines'), | 66 | 'newline': this.i18n('New lines'), |
diff --git a/client/src/app/shared/rest/rest-extractor.service.ts b/client/src/app/shared/rest/rest-extractor.service.ts index 934f6c618..f149569ef 100644 --- a/client/src/app/shared/rest/rest-extractor.service.ts +++ b/client/src/app/shared/rest/rest-extractor.service.ts | |||
@@ -33,7 +33,7 @@ export class RestExtractor { | |||
33 | return this.applyToResultListData(result, this.convertDateToHuman, [ fieldsToConvert ]) | 33 | return this.applyToResultListData(result, this.convertDateToHuman, [ fieldsToConvert ]) |
34 | } | 34 | } |
35 | 35 | ||
36 | convertDateToHuman (target: any, fieldsToConvert: string[]) { | 36 | convertDateToHuman (target: { [ id: string ]: string }, fieldsToConvert: string[]) { |
37 | fieldsToConvert.forEach(field => target[field] = dateToHuman(target[field])) | 37 | fieldsToConvert.forEach(field => target[field] = dateToHuman(target[field])) |
38 | 38 | ||
39 | return target | 39 | return target |
@@ -83,7 +83,7 @@ export class RestExtractor { | |||
83 | errorMessage = err | 83 | errorMessage = err |
84 | } | 84 | } |
85 | 85 | ||
86 | const errorObj: any = { | 86 | const errorObj: { message: string, status: string, body: string } = { |
87 | message: errorMessage, | 87 | message: errorMessage, |
88 | status: undefined, | 88 | status: undefined, |
89 | body: undefined | 89 | body: undefined |
diff --git a/client/src/app/shared/rest/rest.service.ts b/client/src/app/shared/rest/rest.service.ts index 41824a18f..e6d4e6e5e 100644 --- a/client/src/app/shared/rest/rest.service.ts +++ b/client/src/app/shared/rest/rest.service.ts | |||
@@ -32,7 +32,7 @@ export class RestService { | |||
32 | return newParams | 32 | return newParams |
33 | } | 33 | } |
34 | 34 | ||
35 | addObjectParams (params: HttpParams, object: any) { | 35 | addObjectParams (params: HttpParams, object: { [ name: string ]: any }) { |
36 | for (const name of Object.keys(object)) { | 36 | for (const name of Object.keys(object)) { |
37 | const value = object[name] | 37 | const value = object[name] |
38 | if (!value) continue | 38 | if (!value) continue |
diff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.ts index 40e05fcc7..0ec2a9b15 100644 --- a/client/src/app/shared/shared.module.ts +++ b/client/src/app/shared/shared.module.ts | |||
@@ -25,7 +25,7 @@ import { VideoAbuseService } from './video-abuse' | |||
25 | import { VideoBlacklistService } from './video-blacklist' | 25 | import { VideoBlacklistService } from './video-blacklist' |
26 | import { VideoOwnershipService } from './video-ownership' | 26 | import { VideoOwnershipService } from './video-ownership' |
27 | import { VideoMiniatureComponent } from './video/video-miniature.component' | 27 | import { VideoMiniatureComponent } from './video/video-miniature.component' |
28 | import { VideoFeedComponent } from './video/video-feed.component' | 28 | import { FeedComponent } from './video/feed.component' |
29 | import { VideoThumbnailComponent } from './video/video-thumbnail.component' | 29 | import { VideoThumbnailComponent } from './video/video-thumbnail.component' |
30 | import { VideoService } from './video/video.service' | 30 | import { VideoService } from './video/video.service' |
31 | import { AccountService } from '@app/shared/account/account.service' | 31 | import { AccountService } from '@app/shared/account/account.service' |
@@ -82,7 +82,7 @@ import { BlocklistService } from '@app/shared/blocklist' | |||
82 | LoaderComponent, | 82 | LoaderComponent, |
83 | VideoThumbnailComponent, | 83 | VideoThumbnailComponent, |
84 | VideoMiniatureComponent, | 84 | VideoMiniatureComponent, |
85 | VideoFeedComponent, | 85 | FeedComponent, |
86 | ButtonComponent, | 86 | ButtonComponent, |
87 | DeleteButtonComponent, | 87 | DeleteButtonComponent, |
88 | EditButtonComponent, | 88 | EditButtonComponent, |
@@ -122,7 +122,7 @@ import { BlocklistService } from '@app/shared/blocklist' | |||
122 | LoaderComponent, | 122 | LoaderComponent, |
123 | VideoThumbnailComponent, | 123 | VideoThumbnailComponent, |
124 | VideoMiniatureComponent, | 124 | VideoMiniatureComponent, |
125 | VideoFeedComponent, | 125 | FeedComponent, |
126 | ButtonComponent, | 126 | ButtonComponent, |
127 | DeleteButtonComponent, | 127 | DeleteButtonComponent, |
128 | EditButtonComponent, | 128 | EditButtonComponent, |
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts index e6b612054..7c840ffa7 100644 --- a/client/src/app/shared/users/user.model.ts +++ b/client/src/app/shared/users/user.model.ts | |||
@@ -43,7 +43,6 @@ export class User implements UserServerModel { | |||
43 | 43 | ||
44 | blocked: boolean | 44 | blocked: boolean |
45 | blockedReason?: string | 45 | blockedReason?: string |
46 | [key: string]: any | ||
47 | 46 | ||
48 | constructor (hash: UserConstructorHash) { | 47 | constructor (hash: UserConstructorHash) { |
49 | this.id = hash.id | 48 | this.id = hash.id |
diff --git a/client/src/app/shared/video/abstract-video-list.html b/client/src/app/shared/video/abstract-video-list.html index 69a619b76..29492351b 100644 --- a/client/src/app/shared/video/abstract-video-list.html +++ b/client/src/app/shared/video/abstract-video-list.html | |||
@@ -3,7 +3,7 @@ | |||
3 | <div *ngIf="titlePage" class="title-page title-page-single"> | 3 | <div *ngIf="titlePage" class="title-page title-page-single"> |
4 | {{ titlePage }} | 4 | {{ titlePage }} |
5 | </div> | 5 | </div> |
6 | <my-video-feed [syndicationItems]="syndicationItems"></my-video-feed> | 6 | <my-feed [syndicationItems]="syndicationItems"></my-feed> |
7 | 7 | ||
8 | <div class="moderation-block" *ngIf="displayModerationBlock"> | 8 | <div class="moderation-block" *ngIf="displayModerationBlock"> |
9 | <my-peertube-checkbox | 9 | <my-peertube-checkbox |
diff --git a/client/src/app/shared/video/abstract-video-list.scss b/client/src/app/shared/video/abstract-video-list.scss index 92998cb44..9fb3fd4d6 100644 --- a/client/src/app/shared/video/abstract-video-list.scss +++ b/client/src/app/shared/video/abstract-video-list.scss | |||
@@ -17,7 +17,7 @@ | |||
17 | margin: 0 5px 0 0; | 17 | margin: 0 5px 0 0; |
18 | } | 18 | } |
19 | 19 | ||
20 | my-video-feed { | 20 | my-feed { |
21 | display: inline-block; | 21 | display: inline-block; |
22 | position: relative; | 22 | position: relative; |
23 | top: 1px; | 23 | top: 1px; |
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts index 87814d4ba..2d32dd6ad 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/video/abstract-video-list.ts | |||
@@ -12,6 +12,7 @@ import { Video } from './video.model' | |||
12 | import { I18n } from '@ngx-translate/i18n-polyfill' | 12 | import { I18n } from '@ngx-translate/i18n-polyfill' |
13 | import { ScreenService } from '@app/shared/misc/screen.service' | 13 | import { ScreenService } from '@app/shared/misc/screen.service' |
14 | import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' | 14 | import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' |
15 | import { Syndication } from '@app/shared/video/syndication.model' | ||
15 | 16 | ||
16 | export abstract class AbstractVideoList implements OnInit, OnDestroy { | 17 | export abstract class AbstractVideoList implements OnInit, OnDestroy { |
17 | private static LINES_PER_PAGE = 4 | 18 | private static LINES_PER_PAGE = 4 |
@@ -27,7 +28,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
27 | sort: VideoSortField = '-publishedAt' | 28 | sort: VideoSortField = '-publishedAt' |
28 | categoryOneOf?: number | 29 | categoryOneOf?: number |
29 | defaultSort: VideoSortField = '-publishedAt' | 30 | defaultSort: VideoSortField = '-publishedAt' |
30 | syndicationItems: any = [] | 31 | syndicationItems: Syndication[] = [] |
31 | 32 | ||
32 | loadOnInit = true | 33 | loadOnInit = true |
33 | marginContent = true | 34 | marginContent = true |
@@ -59,7 +60,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
59 | private resizeSubscription: Subscription | 60 | private resizeSubscription: Subscription |
60 | 61 | ||
61 | abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}> | 62 | abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}> |
62 | abstract generateSyndicationList (): any | 63 | abstract generateSyndicationList (): void |
63 | 64 | ||
64 | get user () { | 65 | get user () { |
65 | return this.authService.getUser() | 66 | return this.authService.getUser() |
@@ -209,9 +210,11 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
209 | } | 210 | } |
210 | 211 | ||
211 | protected setNewRouteParams () { | 212 | protected setNewRouteParams () { |
212 | const paramsObject: any = this.buildRouteParams() | 213 | const paramsObject = this.buildRouteParams() |
213 | 214 | ||
214 | const queryParams = Object.keys(paramsObject).map(p => p + '=' + paramsObject[p]).join('&') | 215 | const queryParams = Object.keys(paramsObject) |
216 | .map(p => p + '=' + paramsObject[p]) | ||
217 | .join('&') | ||
215 | this.location.replaceState(this.currentRoute, queryParams) | 218 | this.location.replaceState(this.currentRoute, queryParams) |
216 | } | 219 | } |
217 | 220 | ||
diff --git a/client/src/app/shared/video/video-feed.component.html b/client/src/app/shared/video/feed.component.html index 16116ba88..16116ba88 100644 --- a/client/src/app/shared/video/video-feed.component.html +++ b/client/src/app/shared/video/feed.component.html | |||
diff --git a/client/src/app/shared/video/video-feed.component.scss b/client/src/app/shared/video/feed.component.scss index 385764be0..385764be0 100644 --- a/client/src/app/shared/video/video-feed.component.scss +++ b/client/src/app/shared/video/feed.component.scss | |||
diff --git a/client/src/app/shared/video/feed.component.ts b/client/src/app/shared/video/feed.component.ts new file mode 100644 index 000000000..12507458f --- /dev/null +++ b/client/src/app/shared/video/feed.component.ts | |||
@@ -0,0 +1,11 @@ | |||
1 | import { Component, Input } from '@angular/core' | ||
2 | import { Syndication } from '@app/shared/video/syndication.model' | ||
3 | |||
4 | @Component({ | ||
5 | selector: 'my-feed', | ||
6 | styleUrls: [ './feed.component.scss' ], | ||
7 | templateUrl: './feed.component.html' | ||
8 | }) | ||
9 | export class FeedComponent { | ||
10 | @Input() syndicationItems: Syndication[] | ||
11 | } | ||
diff --git a/client/src/app/shared/video/syndication.model.ts b/client/src/app/shared/video/syndication.model.ts new file mode 100644 index 000000000..a52b5771b --- /dev/null +++ b/client/src/app/shared/video/syndication.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' | ||
2 | |||
3 | export interface Syndication { | ||
4 | format: FeedFormat, | ||
5 | label: string, | ||
6 | url: string | ||
7 | } \ No newline at end of file | ||
diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts index a62277e04..fc772a3cf 100644 --- a/client/src/app/shared/video/video-edit.model.ts +++ b/client/src/app/shared/video/video-edit.model.ts | |||
@@ -25,7 +25,6 @@ export class VideoEdit implements VideoUpdate { | |||
25 | uuid?: string | 25 | uuid?: string |
26 | id?: number | 26 | id?: number |
27 | scheduleUpdate?: VideoScheduleUpdate | 27 | scheduleUpdate?: VideoScheduleUpdate |
28 | [key: string]: any | ||
29 | 28 | ||
30 | constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) { | 29 | constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) { |
31 | if (video) { | 30 | if (video) { |
@@ -50,14 +49,14 @@ export class VideoEdit implements VideoUpdate { | |||
50 | } | 49 | } |
51 | } | 50 | } |
52 | 51 | ||
53 | patch (values: any) { | 52 | patch (values: { [ id: string ]: string }) { |
54 | Object.keys(values).forEach((key) => { | 53 | Object.keys(values).forEach((key) => { |
55 | this[ key ] = values[ key ] | 54 | this[ key ] = values[ key ] |
56 | }) | 55 | }) |
57 | 56 | ||
58 | // If schedule publication, the video is private and will be changed to public privacy | 57 | // If schedule publication, the video is private and will be changed to public privacy |
59 | if (parseInt(values['privacy'], 10) === VideoEdit.SPECIAL_SCHEDULED_PRIVACY) { | 58 | if (parseInt(values['privacy'], 10) === VideoEdit.SPECIAL_SCHEDULED_PRIVACY) { |
60 | const updateAt = (values['schedulePublicationAt'] as Date) | 59 | const updateAt = new Date(values['schedulePublicationAt']) |
61 | updateAt.setSeconds(0) | 60 | updateAt.setSeconds(0) |
62 | 61 | ||
63 | this.privacy = VideoPrivacy.PRIVATE | 62 | this.privacy = VideoPrivacy.PRIVATE |
diff --git a/client/src/app/shared/video/video-feed.component.ts b/client/src/app/shared/video/video-feed.component.ts deleted file mode 100644 index be6c80c3f..000000000 --- a/client/src/app/shared/video/video-feed.component.ts +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | import { Component, Input } from '@angular/core' | ||
2 | |||
3 | @Component({ | ||
4 | selector: 'my-video-feed', | ||
5 | styleUrls: [ './video-feed.component.scss' ], | ||
6 | templateUrl: './video-feed.component.html' | ||
7 | }) | ||
8 | export class VideoFeedComponent { | ||
9 | @Input() syndicationItems: any | ||
10 | } | ||
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index 6283cf84d..65297d7a1 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts | |||
@@ -274,9 +274,9 @@ export class VideoService implements VideosProvider { | |||
274 | 274 | ||
275 | loadCompleteDescription (descriptionPath: string) { | 275 | loadCompleteDescription (descriptionPath: string) { |
276 | return this.authHttp | 276 | return this.authHttp |
277 | .get(environment.apiUrl + descriptionPath) | 277 | .get<{ description: string }>(environment.apiUrl + descriptionPath) |
278 | .pipe( | 278 | .pipe( |
279 | map((res: any) => res[ 'description' ]), | 279 | map(res => res.description), |
280 | catchError(err => this.restExtractor.handleError(err)) | 280 | catchError(err => this.restExtractor.handleError(err)) |
281 | ) | 281 | ) |
282 | } | 282 | } |
diff --git a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts index a2c9237ad..796fbe531 100644 --- a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts +++ b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts | |||
@@ -5,6 +5,7 @@ import { VideoCaptionsValidatorsService } from '@app/shared/forms/form-validator | |||
5 | import { ServerService } from '@app/core' | 5 | import { ServerService } from '@app/core' |
6 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' | 6 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' |
7 | import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' | 7 | import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' |
8 | import { VideoConstant } from '../../../../../../shared' | ||
8 | 9 | ||
9 | @Component({ | 10 | @Component({ |
10 | selector: 'my-video-caption-add-modal', | 11 | selector: 'my-video-caption-add-modal', |
@@ -19,7 +20,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni | |||
19 | 20 | ||
20 | @ViewChild('modal') modal: ElementRef | 21 | @ViewChild('modal') modal: ElementRef |
21 | 22 | ||
22 | videoCaptionLanguages: any = [] | 23 | videoCaptionLanguages: VideoConstant<string>[] = [] |
23 | 24 | ||
24 | private openedModal: NgbModalRef | 25 | private openedModal: NgbModalRef |
25 | private closingModal = false | 26 | private closingModal = false |
@@ -73,7 +74,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni | |||
73 | this.hide() | 74 | this.hide() |
74 | 75 | ||
75 | const languageId = this.form.value[ 'language' ] | 76 | const languageId = this.form.value[ 'language' ] |
76 | const languageObject = this.videoCaptionLanguages.find((l: any) => l.id === languageId) | 77 | const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId) |
77 | 78 | ||
78 | this.captionAdded.emit({ | 79 | this.captionAdded.emit({ |
79 | language: languageObject, | 80 | language: languageObject, |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index 9a50e2ab2..e13c06ce9 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' | 4 | import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' |
@@ -23,7 +23,7 @@ import { VideoImportService } from '@app/shared/video-import' | |||
23 | }) | 23 | }) |
24 | export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { | 24 | export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { |
25 | @Output() firstStepDone = new EventEmitter<string>() | 25 | @Output() firstStepDone = new EventEmitter<string>() |
26 | @ViewChild('torrentfileInput') torrentfileInput: any | 26 | @ViewChild('torrentfileInput') torrentfileInput: ElementRef<HTMLInputElement> |
27 | 27 | ||
28 | videoFileName: string | 28 | videoFileName: string |
29 | magnetUri = '' | 29 | magnetUri = '' |
@@ -64,7 +64,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
64 | } | 64 | } |
65 | 65 | ||
66 | fileChange () { | 66 | fileChange () { |
67 | const torrentfile = this.torrentfileInput.nativeElement.files[0] as File | 67 | const torrentfile = this.torrentfileInput.nativeElement.files[0] |
68 | if (!torrentfile) return | 68 | if (!torrentfile) return |
69 | 69 | ||
70 | this.importVideo(torrentfile) | 70 | this.importVideo(torrentfile) |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.ts b/client/src/app/videos/+video-edit/video-add-components/video-send.ts index cf9d47cbe..1bf22e1a9 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-send.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-send.ts | |||
@@ -3,7 +3,6 @@ import { LoadingBarService } from '@ngx-loading-bar/core' | |||
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | import { catchError, switchMap, tap } from 'rxjs/operators' | 4 | import { catchError, switchMap, tap } from 'rxjs/operators' |
5 | import { FormReactive } from '@app/shared' | 5 | import { FormReactive } from '@app/shared' |
6 | import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' | ||
7 | import { VideoConstant, VideoPrivacy } from '../../../../../../shared' | 6 | import { VideoConstant, VideoPrivacy } from '../../../../../../shared' |
8 | import { AuthService, ServerService } from '@app/core' | 7 | import { AuthService, ServerService } from '@app/core' |
9 | import { VideoService } from '@app/shared/video/video.service' | 8 | import { VideoService } from '@app/shared/video/video.service' |
@@ -11,8 +10,9 @@ import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.m | |||
11 | import { VideoCaptionService } from '@app/shared/video-caption' | 10 | import { VideoCaptionService } from '@app/shared/video-caption' |
12 | import { VideoEdit } from '@app/shared/video/video-edit.model' | 11 | import { VideoEdit } from '@app/shared/video/video-edit.model' |
13 | import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' | 12 | import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' |
13 | import { CanComponentDeactivateResult } from '@app/shared/guards/can-deactivate-guard.service' | ||
14 | 14 | ||
15 | export abstract class VideoSend extends FormReactive implements OnInit, CanComponentDeactivate { | 15 | export abstract class VideoSend extends FormReactive implements OnInit { |
16 | userVideoChannels: { id: number, label: string, support: string }[] = [] | 16 | userVideoChannels: { id: number, label: string, support: string }[] = [] |
17 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] | 17 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] |
18 | videoCaptions: VideoCaptionEdit[] = [] | 18 | videoCaptions: VideoCaptionEdit[] = [] |
@@ -30,7 +30,7 @@ export abstract class VideoSend extends FormReactive implements OnInit, CanCompo | |||
30 | protected videoService: VideoService | 30 | protected videoService: VideoService |
31 | protected videoCaptionService: VideoCaptionService | 31 | protected videoCaptionService: VideoCaptionService |
32 | 32 | ||
33 | abstract canDeactivate (): any | 33 | abstract canDeactivate (): CanComponentDeactivateResult |
34 | 34 | ||
35 | ngOnInit () { | 35 | ngOnInit () { |
36 | this.buildForm({}) | 36 | this.buildForm({}) |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts index fa6ee0c23..8e2d0deaf 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { HttpEventType, HttpResponse } from '@angular/common/http' | 1 | import { HttpEventType, HttpResponse } from '@angular/common/http' |
2 | import { Component, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' | 2 | import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' |
3 | import { Router } from '@angular/router' | 3 | import { Router } from '@angular/router' |
4 | import { LoadingBarService } from '@ngx-loading-bar/core' | 4 | import { LoadingBarService } from '@ngx-loading-bar/core' |
5 | import { NotificationsService } from 'angular2-notifications' | 5 | import { NotificationsService } from 'angular2-notifications' |
@@ -25,7 +25,7 @@ import { VideoCaptionService } from '@app/shared/video-caption' | |||
25 | }) | 25 | }) |
26 | export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate { | 26 | export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate { |
27 | @Output() firstStepDone = new EventEmitter<string>() | 27 | @Output() firstStepDone = new EventEmitter<string>() |
28 | @ViewChild('videofileInput') videofileInput: any | 28 | @ViewChild('videofileInput') videofileInput: ElementRef<HTMLInputElement> |
29 | 29 | ||
30 | // So that it can be accessed in the template | 30 | // So that it can be accessed in the template |
31 | readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY | 31 | readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY |
@@ -110,7 +110,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
110 | } | 110 | } |
111 | 111 | ||
112 | uploadFirstStep () { | 112 | uploadFirstStep () { |
113 | const videofile = this.videofileInput.nativeElement.files[0] as File | 113 | const videofile = this.videofileInput.nativeElement.files[0] |
114 | if (!videofile) return | 114 | if (!videofile) return |
115 | 115 | ||
116 | // Cannot upload videos > 8GB for now | 116 | // Cannot upload videos > 8GB for now |
diff --git a/client/src/app/videos/+video-watch/comment/linkifier.service.ts b/client/src/app/videos/+video-watch/comment/linkifier.service.ts index 9ad419a69..4f4ec1e5d 100644 --- a/client/src/app/videos/+video-watch/comment/linkifier.service.ts +++ b/client/src/app/videos/+video-watch/comment/linkifier.service.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { Injectable } from '@angular/core' | 1 | import { Injectable } from '@angular/core' |
2 | import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' | 2 | import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' |
3 | // FIXME: use @types/linkify when https://github.com/DefinitelyTyped/DefinitelyTyped/pull/29682/files is merged? | ||
3 | const linkify = require('linkifyjs') | 4 | const linkify = require('linkifyjs') |
4 | const linkifyHtml = require('linkifyjs/html') | 5 | const linkifyHtml = require('linkifyjs/html') |
5 | 6 | ||
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.ts b/client/src/app/videos/+video-watch/comment/video-comment.component.ts index 982470786..00f0460a1 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.component.ts | |||
@@ -26,7 +26,7 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
26 | @Output() resetReply = new EventEmitter() | 26 | @Output() resetReply = new EventEmitter() |
27 | 27 | ||
28 | sanitizedCommentHTML = '' | 28 | sanitizedCommentHTML = '' |
29 | newParentComments: any = [] | 29 | newParentComments: VideoComment[] = [] |
30 | 30 | ||
31 | constructor ( | 31 | constructor ( |
32 | private linkifierService: LinkifierService, | 32 | private linkifierService: LinkifierService, |
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.service.ts b/client/src/app/videos/+video-watch/comment/video-comment.service.ts index 7d9c2d0ad..921447d5b 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.service.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.service.ts | |||
@@ -30,9 +30,9 @@ export class VideoCommentService { | |||
30 | const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads' | 30 | const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads' |
31 | const normalizedComment = lineFeedToHtml(comment, 'text') | 31 | const normalizedComment = lineFeedToHtml(comment, 'text') |
32 | 32 | ||
33 | return this.authHttp.post(url, normalizedComment) | 33 | return this.authHttp.post<{ comment: VideoCommentServerModel }>(url, normalizedComment) |
34 | .pipe( | 34 | .pipe( |
35 | map((data: any) => this.extractVideoComment(data['comment'])), | 35 | map(data => this.extractVideoComment(data.comment)), |
36 | catchError(err => this.restExtractor.handleError(err)) | 36 | catchError(err => this.restExtractor.handleError(err)) |
37 | ) | 37 | ) |
38 | } | 38 | } |
@@ -41,9 +41,9 @@ export class VideoCommentService { | |||
41 | const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comments/' + inReplyToCommentId | 41 | const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comments/' + inReplyToCommentId |
42 | const normalizedComment = lineFeedToHtml(comment, 'text') | 42 | const normalizedComment = lineFeedToHtml(comment, 'text') |
43 | 43 | ||
44 | return this.authHttp.post(url, normalizedComment) | 44 | return this.authHttp.post<{ comment: VideoCommentServerModel }>(url, normalizedComment) |
45 | .pipe( | 45 | .pipe( |
46 | map((data: any) => this.extractVideoComment(data[ 'comment' ])), | 46 | map(data => this.extractVideoComment(data.comment)), |
47 | catchError(err => this.restExtractor.handleError(err)) | 47 | catchError(err => this.restExtractor.handleError(err)) |
48 | ) | 48 | ) |
49 | } | 49 | } |
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.html b/client/src/app/videos/+video-watch/comment/video-comments.component.html index 42e129d65..44016d8ad 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.html +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.html | |||
@@ -4,7 +4,7 @@ | |||
4 | Comments | 4 | Comments |
5 | </div> | 5 | </div> |
6 | 6 | ||
7 | <my-video-feed [syndicationItems]="syndicationItems"></my-video-feed> | 7 | <my-feed [syndicationItems]="syndicationItems"></my-feed> |
8 | </div> | 8 | </div> |
9 | 9 | ||
10 | <ng-template [ngIf]="video.commentsEnabled === true"> | 10 | <ng-template [ngIf]="video.commentsEnabled === true"> |
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.scss b/client/src/app/videos/+video-watch/comment/video-comments.component.scss index dbb44c66c..575e331e4 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.scss +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.scss | |||
@@ -23,7 +23,7 @@ | |||
23 | margin-right: 0; | 23 | margin-right: 0; |
24 | } | 24 | } |
25 | 25 | ||
26 | my-video-feed { | 26 | my-feed { |
27 | display: inline-block; | 27 | display: inline-block; |
28 | margin-left: 5px; | 28 | margin-left: 5px; |
29 | } | 29 | } |
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 4c1bdf2dd..8850eccd8 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 | |||
@@ -12,6 +12,7 @@ import { VideoDetails } from '../../../shared/video/video-details.model' | |||
12 | import { VideoComment } from './video-comment.model' | 12 | import { VideoComment } from './video-comment.model' |
13 | import { VideoCommentService } from './video-comment.service' | 13 | import { VideoCommentService } from './video-comment.service' |
14 | import { I18n } from '@ngx-translate/i18n-polyfill' | 14 | import { I18n } from '@ngx-translate/i18n-polyfill' |
15 | import { Syndication } from '@app/shared/video/syndication.model' | ||
15 | 16 | ||
16 | @Component({ | 17 | @Component({ |
17 | selector: 'my-video-comments', | 18 | selector: 'my-video-comments', |
@@ -35,7 +36,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
35 | threadComments: { [ id: number ]: VideoCommentThreadTree } = {} | 36 | threadComments: { [ id: number ]: VideoCommentThreadTree } = {} |
36 | threadLoading: { [ id: number ]: boolean } = {} | 37 | threadLoading: { [ id: number ]: boolean } = {} |
37 | 38 | ||
38 | syndicationItems: any = [] | 39 | syndicationItems: Syndication[] = [] |
39 | 40 | ||
40 | private sub: Subscription | 41 | private sub: Subscription |
41 | 42 | ||
diff --git a/client/src/app/videos/+video-watch/video-watch.component.scss b/client/src/app/videos/+video-watch/video-watch.component.scss index f31e4694a..2586a2204 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.scss +++ b/client/src/app/videos/+video-watch/video-watch.component.scss | |||
@@ -162,7 +162,7 @@ $other-videos-width: 260px; | |||
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | my-video-feed { | 165 | my-feed { |
166 | margin-left: 5px; | 166 | margin-left: 5px; |
167 | margin-top: 1px; | 167 | margin-top: 1px; |
168 | } | 168 | } |
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 ed5e723c9..65b974037 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -7,7 +7,9 @@ import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-supp | |||
7 | import { MetaService } from '@ngx-meta/core' | 7 | import { MetaService } from '@ngx-meta/core' |
8 | import { NotificationsService } from 'angular2-notifications' | 8 | import { NotificationsService } from 'angular2-notifications' |
9 | import { forkJoin, Subscription } from 'rxjs' | 9 | import { forkJoin, Subscription } from 'rxjs' |
10 | const videojs = require('video.js') | 10 | // FIXME: something weird with our path definition in tsconfig and typings |
11 | // @ts-ignore | ||
12 | import videojs from 'video.js' | ||
11 | import 'videojs-hotkeys' | 13 | import 'videojs-hotkeys' |
12 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' | 14 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' |
13 | import * as WebTorrent from 'webtorrent' | 15 | import * as WebTorrent from 'webtorrent' |
@@ -45,7 +47,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
45 | @ViewChild('videoBlacklistModal') videoBlacklistModal: VideoBlacklistComponent | 47 | @ViewChild('videoBlacklistModal') videoBlacklistModal: VideoBlacklistComponent |
46 | @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent | 48 | @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent |
47 | 49 | ||
48 | player: any | 50 | player: videojs.Player |
49 | playerElement: HTMLVideoElement | 51 | playerElement: HTMLVideoElement |
50 | userRating: UserVideoRateType = null | 52 | userRating: UserVideoRateType = null |
51 | video: VideoDetails = null | 53 | video: VideoDetails = null |
@@ -435,7 +437,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
435 | this.zone.runOutsideAngular(async () => { | 437 | this.zone.runOutsideAngular(async () => { |
436 | videojs(this.playerElement, videojsOptions, function () { | 438 | videojs(this.playerElement, videojsOptions, function () { |
437 | self.player = this | 439 | self.player = this |
438 | this.on('customError', (data: any) => self.handleError(data.err)) | 440 | this.on('customError', ({ err }: { err: any }) => self.handleError(err)) |
439 | 441 | ||
440 | addContextMenu(self.player, self.video.embedUrl) | 442 | addContextMenu(self.player, self.video.embedUrl) |
441 | }) | 443 | }) |
@@ -448,7 +450,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
448 | this.checkUserRating() | 450 | this.checkUserRating() |
449 | } | 451 | } |
450 | 452 | ||
451 | private setRating (nextRating: string) { | 453 | private setRating (nextRating: VideoRateType) { |
452 | let method | 454 | let method |
453 | switch (nextRating) { | 455 | switch (nextRating) { |
454 | case 'like': | 456 | case 'like': |
@@ -466,11 +468,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
466 | .subscribe( | 468 | .subscribe( |
467 | () => { | 469 | () => { |
468 | // Update the video like attribute | 470 | // Update the video like attribute |
469 | this.updateVideoRating(this.userRating, nextRating as VideoRateType) | 471 | this.updateVideoRating(this.userRating, nextRating) |
470 | this.userRating = nextRating as UserVideoRateType | 472 | this.userRating = nextRating |
471 | }, | 473 | }, |
472 | 474 | ||
473 | (err: any) => this.notificationsService.error(this.i18n('Error'), err.message) | 475 | (err: { message: string }) => this.notificationsService.error(this.i18n('Error'), err.message) |
474 | ) | 476 | ) |
475 | } | 477 | } |
476 | 478 | ||