aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorBO41 <lukasw41@gmail.com>2018-10-18 09:08:59 +0200
committerRigel Kent <par@rigelk.eu>2018-10-18 09:08:59 +0200
commit244b4ae3973bc1511464a08158a123767f83179c (patch)
tree24f4399489167bc92921e3fe0c1c04a87d7c1161 /client/src
parent28e51e831bd121f063600a597d7b02f8fd846de9 (diff)
downloadPeerTube-244b4ae3973bc1511464a08158a123767f83179c.tar.gz
PeerTube-244b4ae3973bc1511464a08158a123767f83179c.tar.zst
PeerTube-244b4ae3973bc1511464a08158a123767f83179c.zip
NoImplicitAny flag true (#1157)
this enables the `noImplicitAny` flag in the Typescript compiler > When the noImplicitAny flag is true and the TypeScript compiler cannot infer the type, it still generates the JavaScript files, but it also reports an error. Many seasoned developers prefer this stricter setting because type checking catches more unintentional errors at compile time. closes: #1131 replaces #1137
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts4
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.ts2
-rw-r--r--client/src/app/+admin/users/user-list/user-list.component.ts4
-rw-r--r--client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts2
-rw-r--r--client/src/app/+my-account/my-account-videos/my-account-videos.component.ts9
-rw-r--r--client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts3
-rw-r--r--client/src/app/+my-account/shared/actor-avatar-info.component.ts2
-rw-r--r--client/src/app/app.module.ts2
-rw-r--r--client/src/app/core/auth/auth.service.ts2
-rw-r--r--client/src/app/core/server/server.service.ts2
-rw-r--r--client/src/app/core/theme/theme.service.ts4
-rw-r--r--client/src/app/menu/menu.component.ts2
-rw-r--r--client/src/app/search/advanced-search.model.ts4
-rw-r--r--client/src/app/shared/buttons/action-dropdown.component.ts6
-rw-r--r--client/src/app/shared/buttons/button.component.ts6
-rw-r--r--client/src/app/shared/buttons/edit-button.component.ts2
-rw-r--r--client/src/app/shared/misc/help.component.ts2
-rw-r--r--client/src/app/shared/misc/peertube-local-storage.ts6
-rw-r--r--client/src/app/shared/misc/utils.ts2
-rw-r--r--client/src/app/shared/overview/videos-overview.model.ts1
-rw-r--r--client/src/app/shared/rest/rest-extractor.service.ts4
-rw-r--r--client/src/app/shared/rest/rest.service.ts2
-rw-r--r--client/src/app/shared/users/user.model.ts1
-rw-r--r--client/src/app/shared/video/abstract-video-list.ts6
-rw-r--r--client/src/app/shared/video/video-edit.model.ts3
-rw-r--r--client/src/app/shared/video/video-feed.component.ts2
-rw-r--r--client/src/app/shared/video/video.service.ts2
-rw-r--r--client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts4
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.ts6
-rw-r--r--client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts2
-rw-r--r--client/src/app/videos/+video-edit/video-add-components/video-send.ts2
-rw-r--r--client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts2
-rw-r--r--client/src/app/videos/+video-watch/comment/linkifier.service.ts6
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment-add.component.ts2
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.component.ts2
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.model.ts2
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.service.ts4
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.ts2
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts14
-rw-r--r--client/src/assets/player/peertube-chunk-store.ts16
-rw-r--r--client/src/assets/player/peertube-link-button.ts3
-rw-r--r--client/src/assets/player/peertube-load-progress-bar.ts2
-rw-r--r--client/src/assets/player/peertube-player.ts16
-rw-r--r--client/src/assets/player/peertube-videojs-plugin.ts40
-rw-r--r--client/src/assets/player/peertube-videojs-typings.ts6
-rw-r--r--client/src/assets/player/resolution-menu-button.ts3
-rw-r--r--client/src/assets/player/resolution-menu-item.ts5
-rw-r--r--client/src/assets/player/settings-menu-button.ts18
-rw-r--r--client/src/assets/player/settings-menu-item.ts11
-rw-r--r--client/src/assets/player/theater-button.ts2
-rw-r--r--client/src/assets/player/utils.ts2
-rw-r--r--client/src/assets/player/video-renderer.ts18
-rw-r--r--client/src/assets/player/webtorrent-info-button.ts2
-rw-r--r--client/src/main.ts2
-rw-r--r--client/src/polyfills.ts51
-rw-r--r--client/src/shims/noop.ts2
-rw-r--r--client/src/standalone/videos/embed.ts4
-rw-r--r--client/src/standalone/videos/test-embed.ts6
-rw-r--r--client/src/typings.d.ts1
59 files changed, 174 insertions, 171 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 25b303f44..9a9298825 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 = { 65 const formGroupData: 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 = { 205 const data: 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 99ce5804b..a4d696e69 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 => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) 10 roles = Object.keys(USER_ROLE_LABELS).map((key: any) => ({ 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 ab2250722..0d7f88d2b 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
@@ -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 => u.blocked === false) 48 isDisplayed: users => users.every((u: any) => 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 => u.blocked === true) 53 isDisplayed: users => users.every((u: any) => 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 56697030b..f2b8a4e26 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
@@ -17,7 +17,7 @@ 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})
19export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelEdit implements OnInit, OnDestroy { 19export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelEdit implements OnInit, OnDestroy {
20 @ViewChild('avatarfileInput') avatarfileInput 20 @ViewChild('avatarfileInput') avatarfileInput: any
21 21
22 error: string 22 error: string
23 23
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 7560f0128..52307f09e 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 => this.checkedVideos[ k ] === true) 69 return Object.keys(this.checkedVideos).some((k: any) => 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 => this.checkedVideos[ k ] === true) 84 .filter((k: any) => 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,9 +168,10 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni
168 } 168 }
169 169
170 private spliceVideosById (id: number) { 170 private spliceVideosById (id: number) {
171 for (const key of Object.keys(this.loadedPages)) { 171 let key: any
172 for (key of Object.keys(this.loadedPages)) {
172 const videos = 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)
174 175
175 if (index !== -1) { 176 if (index !== -1) {
176 videos.splice(index, 1) 177 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 7437b939a..eb3f9404f 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,7 +49,8 @@ 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 search (event) { 52 // TODO: typing
53 search (event: any) {
53 const query = event.query 54 const query = event.query
54 this.userService.autocomplete(query) 55 this.userService.autocomplete(query)
55 .subscribe( 56 .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 7b80b1ed4..b4505a7f2 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
@@ -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})
12export class ActorAvatarInfoComponent { 12export class ActorAvatarInfoComponent {
13 @ViewChild('avatarfileInput') avatarfileInput 13 @ViewChild('avatarfileInput') avatarfileInput: any
14 14
15 @Input() actor: VideoChannel | Account 15 @Input() actor: VideoChannel | Account
16 16
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts
index 34e890b40..371199442 100644
--- a/client/src/app/app.module.ts
+++ b/client/src/app/app.module.ts
@@ -69,7 +69,7 @@ export function metaFactory (serverService: ServerService): MetaLoader {
69 providers: [ 69 providers: [
70 { 70 {
71 provide: TRANSLATIONS, 71 provide: TRANSLATIONS,
72 useFactory: (locale) => { 72 useFactory: (locale: string) => {
73 // On dev mode, test localization 73 // On dev mode, test localization
74 if (isOnDevLocale()) { 74 if (isOnDevLocale()) {
75 locale = buildFileLocale(getDevLocale()) 75 locale = buildFileLocale(getDevLocale())
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index 9c36b946e..5315c8b1d 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 = { 224 const obj: any = {
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 2f1ef1fc2..1663a052c 100644
--- a/client/src/app/core/server/server.service.ts
+++ b/client/src/app/core/server/server.service.ts
@@ -155,7 +155,7 @@ export class ServerService {
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(ServerService.BASE_VIDEO_URL + attributeName)
158 .pipe(map(data => ({ data, translations }))) 158 .pipe(map((data: any) => ({ data, translations })))
159 }) 159 })
160 ) 160 )
161 .subscribe(({ data, translations }) => { 161 .subscribe(({ data, translations }) => {
diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.ts
index a6eef0898..50c19ecac 100644
--- a/client/src/app/core/theme/theme.service.ts
+++ b/client/src/app/core/theme/theme.service.ts
@@ -5,7 +5,7 @@ import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage'
5export class ThemeService { 5export class ThemeService {
6 private theme = document.querySelector('body') 6 private theme = document.querySelector('body')
7 private darkTheme = false 7 private darkTheme = false
8 private previousTheme = {} 8 private previousTheme: { [ id: string ]: string } = {}
9 9
10 constructor () { 10 constructor () {
11 // initialise the alternative theme with dark theme colors 11 // initialise the alternative theme with dark theme colors
@@ -33,7 +33,7 @@ export class ThemeService {
33 } 33 }
34 } 34 }
35 35
36 private switchProperty (property, newValue?) { 36 private switchProperty (property: string, newValue?: string) {
37 const propertyOldvalue = window.getComputedStyle(this.theme).getPropertyValue('--' + property) 37 const propertyOldvalue = window.getComputedStyle(this.theme).getPropertyValue('--' + property)
38 this.theme.style.setProperty('--' + property, (newValue) ? newValue : this.previousTheme[property]) 38 this.theme.style.setProperty('--' + property, (newValue) ? newValue : this.previousTheme[property])
39 this.previousTheme[property] = propertyOldvalue 39 this.previousTheme[property] = propertyOldvalue
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts
index 95926f5f0..348700c09 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 = { 21 private routesPerRight: any = {
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 033fa9bba..1d6c89282 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 = this.toUrlObject() 56 const obj: any = 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 = this.toUrlObject() 116 const obj: any = 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 022ab5ee8..9877f639d 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
3export type DropdownAction<T> = { 3export type DropdownAction<T> = {
4 label?: string 4 label?: string
5 handler?: (T) => any 5 handler?: (T: any) => any
6 linkBuilder?: (T) => (string | number)[] 6 linkBuilder?: (T: any) => (string | number)[]
7 isDisplayed?: (T) => boolean 7 isDisplayed?: (T: any) => 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 967cb1409..cccf98bc3 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
9export class ButtonComponent { 9export class ButtonComponent {
10 @Input() label = '' 10 @Input() label = ''
11 @Input() className = undefined 11 @Input() className: any = undefined
12 @Input() icon = undefined 12 @Input() icon: any = undefined
13 @Input() title = undefined 13 @Input() title: any = 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 7abaacc26..ea552663a 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
9export class EditButtonComponent { 9export class EditButtonComponent {
10 @Input() label: string 10 @Input() label: string
11 @Input() routerLink = [] 11 @Input() routerLink: any = []
12} 12}
diff --git a/client/src/app/shared/misc/help.component.ts b/client/src/app/shared/misc/help.component.ts
index ba0452e77..ccce1ccfa 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 = { 63 const rulesToText: any = {
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/misc/peertube-local-storage.ts b/client/src/app/shared/misc/peertube-local-storage.ts
index 260f994b6..fb5c45acf 100644
--- a/client/src/app/shared/misc/peertube-local-storage.ts
+++ b/client/src/app/shared/misc/peertube-local-storage.ts
@@ -6,7 +6,7 @@ class MemoryStorage {
6 [key: string]: any 6 [key: string]: any
7 [index: number]: string 7 [index: number]: string
8 8
9 getItem (key) { 9 getItem (key: any) {
10 const stringKey = String(key) 10 const stringKey = String(key)
11 if (valuesMap.has(key)) { 11 if (valuesMap.has(key)) {
12 return String(valuesMap.get(stringKey)) 12 return String(valuesMap.get(stringKey))
@@ -15,11 +15,11 @@ class MemoryStorage {
15 return null 15 return null
16 } 16 }
17 17
18 setItem (key, val) { 18 setItem (key: any, val: any) {
19 valuesMap.set(String(key), String(val)) 19 valuesMap.set(String(key), String(val))
20 } 20 }
21 21
22 removeItem (key) { 22 removeItem (key: any) {
23 valuesMap.delete(key) 23 valuesMap.delete(key)
24 } 24 }
25 25
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts
index c8b7ebc67..78be2e5dd 100644
--- a/client/src/app/shared/misc/utils.ts
+++ b/client/src/app/shared/misc/utils.ts
@@ -102,7 +102,7 @@ function objectToFormData (obj: any, form?: FormData, namespace?: string) {
102 return fd 102 return fd
103} 103}
104 104
105function lineFeedToHtml (obj: object, keyToNormalize: string) { 105function lineFeedToHtml (obj: any, keyToNormalize: string) {
106 return immutableAssign(obj, { 106 return immutableAssign(obj, {
107 [keyToNormalize]: obj[keyToNormalize].replace(/\r?\n|\r/g, '<br />') 107 [keyToNormalize]: obj[keyToNormalize].replace(/\r?\n|\r/g, '<br />')
108 }) 108 })
diff --git a/client/src/app/shared/overview/videos-overview.model.ts b/client/src/app/shared/overview/videos-overview.model.ts
index cf02bdb3d..c8eafc8e8 100644
--- a/client/src/app/shared/overview/videos-overview.model.ts
+++ b/client/src/app/shared/overview/videos-overview.model.ts
@@ -16,4 +16,5 @@ export class VideosOverview implements VideosOverviewServer {
16 tag: string 16 tag: string
17 videos: Video[] 17 videos: Video[]
18 }[] 18 }[]
19 [key: string]: any
19} 20}
diff --git a/client/src/app/shared/rest/rest-extractor.service.ts b/client/src/app/shared/rest/rest-extractor.service.ts
index 6492aa66d..934f6c618 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: object, fieldsToConvert: string[]) { 36 convertDateToHuman (target: any, 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 = { 86 const errorObj: any = {
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 4560c2024..41824a18f 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: object) { 35 addObjectParams (params: HttpParams, object: 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/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index 7c840ffa7..e6b612054 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -43,6 +43,7 @@ export class User implements UserServerModel {
43 43
44 blocked: boolean 44 blocked: boolean
45 blockedReason?: string 45 blockedReason?: string
46 [key: string]: any
46 47
47 constructor (hash: UserConstructorHash) { 48 constructor (hash: UserConstructorHash) {
48 this.id = hash.id 49 this.id = hash.id
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts
index 1f43f974c..87814d4ba 100644
--- a/client/src/app/shared/video/abstract-video-list.ts
+++ b/client/src/app/shared/video/abstract-video-list.ts
@@ -27,7 +27,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
27 sort: VideoSortField = '-publishedAt' 27 sort: VideoSortField = '-publishedAt'
28 categoryOneOf?: number 28 categoryOneOf?: number
29 defaultSort: VideoSortField = '-publishedAt' 29 defaultSort: VideoSortField = '-publishedAt'
30 syndicationItems = [] 30 syndicationItems: any = []
31 31
32 loadOnInit = true 32 loadOnInit = true
33 marginContent = true 33 marginContent = true
@@ -59,7 +59,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
59 private resizeSubscription: Subscription 59 private resizeSubscription: Subscription
60 60
61 abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}> 61 abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}>
62 abstract generateSyndicationList () 62 abstract generateSyndicationList (): any
63 63
64 get user () { 64 get user () {
65 return this.authService.getUser() 65 return this.authService.getUser()
@@ -209,7 +209,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
209 } 209 }
210 210
211 protected setNewRouteParams () { 211 protected setNewRouteParams () {
212 const paramsObject = this.buildRouteParams() 212 const paramsObject: any = this.buildRouteParams()
213 213
214 const queryParams = Object.keys(paramsObject).map(p => p + '=' + paramsObject[p]).join('&') 214 const queryParams = Object.keys(paramsObject).map(p => p + '=' + paramsObject[p]).join('&')
215 this.location.replaceState(this.currentRoute, queryParams) 215 this.location.replaceState(this.currentRoute, queryParams)
diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts
index 0046be964..a62277e04 100644
--- a/client/src/app/shared/video/video-edit.model.ts
+++ b/client/src/app/shared/video/video-edit.model.ts
@@ -25,6 +25,7 @@ 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
28 29
29 constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) { 30 constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) {
30 if (video) { 31 if (video) {
@@ -49,7 +50,7 @@ export class VideoEdit implements VideoUpdate {
49 } 50 }
50 } 51 }
51 52
52 patch (values: Object) { 53 patch (values: any) {
53 Object.keys(values).forEach((key) => { 54 Object.keys(values).forEach((key) => {
54 this[ key ] = values[ key ] 55 this[ key ] = values[ key ]
55 }) 56 })
diff --git a/client/src/app/shared/video/video-feed.component.ts b/client/src/app/shared/video/video-feed.component.ts
index 6922153c0..be6c80c3f 100644
--- a/client/src/app/shared/video/video-feed.component.ts
+++ b/client/src/app/shared/video/video-feed.component.ts
@@ -6,5 +6,5 @@ import { Component, Input } from '@angular/core'
6 templateUrl: './video-feed.component.html' 6 templateUrl: './video-feed.component.html'
7}) 7})
8export class VideoFeedComponent { 8export class VideoFeedComponent {
9 @Input() syndicationItems 9 @Input() syndicationItems: any
10} 10}
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index 724a0bde9..6283cf84d 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -276,7 +276,7 @@ export class VideoService implements VideosProvider {
276 return this.authHttp 276 return this.authHttp
277 .get(environment.apiUrl + descriptionPath) 277 .get(environment.apiUrl + descriptionPath)
278 .pipe( 278 .pipe(
279 map(res => res[ 'description' ]), 279 map((res: any) => 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 07c33030a..a2c9237ad 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
@@ -19,7 +19,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni
19 19
20 @ViewChild('modal') modal: ElementRef 20 @ViewChild('modal') modal: ElementRef
21 21
22 videoCaptionLanguages = [] 22 videoCaptionLanguages: any = []
23 23
24 private openedModal: NgbModalRef 24 private openedModal: NgbModalRef
25 private closingModal = false 25 private closingModal = false
@@ -73,7 +73,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni
73 this.hide() 73 this.hide()
74 74
75 const languageId = this.form.value[ 'language' ] 75 const languageId = this.form.value[ 'language' ]
76 const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId) 76 const languageObject = this.videoCaptionLanguages.find((l: any) => l.id === languageId)
77 77
78 this.captionAdded.emit({ 78 this.captionAdded.emit({
79 language: languageObject, 79 language: languageObject,
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.ts b/client/src/app/videos/+video-edit/shared/video-edit.component.ts
index eb9396d70..a56733e57 100644
--- a/client/src/app/videos/+video-edit/shared/video-edit.component.ts
+++ b/client/src/app/videos/+video-edit/shared/video-edit.component.ts
@@ -48,7 +48,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
48 calendarTimezone: string 48 calendarTimezone: string
49 calendarDateFormat: string 49 calendarDateFormat: string
50 50
51 private schedulerInterval 51 private schedulerInterval: any
52 private firstPatchDone = false 52 private firstPatchDone = false
53 private initialVideoCaptions: string[] = [] 53 private initialVideoCaptions: string[] = []
54 54
@@ -77,13 +77,13 @@ export class VideoEditComponent implements OnInit, OnDestroy {
77 } 77 }
78 78
79 updateForm () { 79 updateForm () {
80 const defaultValues = { 80 const defaultValues: any = {
81 nsfw: 'false', 81 nsfw: 'false',
82 commentsEnabled: 'true', 82 commentsEnabled: 'true',
83 waitTranscoding: 'true', 83 waitTranscoding: 'true',
84 tags: [] 84 tags: []
85 } 85 }
86 const obj = { 86 const obj: any = {
87 name: this.videoValidatorsService.VIDEO_NAME, 87 name: this.videoValidatorsService.VIDEO_NAME,
88 privacy: this.videoValidatorsService.VIDEO_PRIVACY, 88 privacy: this.videoValidatorsService.VIDEO_PRIVACY,
89 channelId: this.videoValidatorsService.VIDEO_CHANNEL, 89 channelId: this.videoValidatorsService.VIDEO_CHANNEL,
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 0f7184ff8..9a50e2ab2 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
@@ -23,7 +23,7 @@ import { VideoImportService } from '@app/shared/video-import'
23}) 23})
24export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { 24export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate {
25 @Output() firstStepDone = new EventEmitter<string>() 25 @Output() firstStepDone = new EventEmitter<string>()
26 @ViewChild('torrentfileInput') torrentfileInput 26 @ViewChild('torrentfileInput') torrentfileInput: any
27 27
28 videoFileName: string 28 videoFileName: string
29 magnetUri = '' 29 magnetUri = ''
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 6d1bac3f2..cf9d47cbe 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
@@ -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 () 33 abstract canDeactivate (): any
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 941dc5441..fa6ee0c23 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
@@ -25,7 +25,7 @@ import { VideoCaptionService } from '@app/shared/video-caption'
25}) 25})
26export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate { 26export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate {
27 @Output() firstStepDone = new EventEmitter<string>() 27 @Output() firstStepDone = new EventEmitter<string>()
28 @ViewChild('videofileInput') videofileInput 28 @ViewChild('videofileInput') videofileInput: any
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
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 3f4072efd..9ad419a69 100644
--- a/client/src/app/videos/+video-watch/comment/linkifier.service.ts
+++ b/client/src/app/videos/+video-watch/comment/linkifier.service.ts
@@ -1,7 +1,7 @@
1import { Injectable } from '@angular/core' 1import { Injectable } from '@angular/core'
2import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' 2import { getAbsoluteAPIUrl } from '@app/shared/misc/utils'
3import * as linkify from 'linkifyjs' 3const linkify = require('linkifyjs')
4import * as linkifyHtml from 'linkifyjs/html' 4const linkifyHtml = require('linkifyjs/html')
5 5
6@Injectable() 6@Injectable()
7export class LinkifierService { 7export class LinkifierService {
@@ -40,7 +40,7 @@ export class LinkifierService {
40 const TT_UNDERSCORE = TT.UNDERSCORE 40 const TT_UNDERSCORE = TT.UNDERSCORE
41 const TT_DOT = TT.DOT 41 const TT_DOT = TT.DOT
42 42
43 function MENTION (value) { 43 function MENTION (value: any) {
44 this.v = value 44 this.v = value
45 } 45 }
46 46
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
index fb7de0e04..ba3c0398e 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
@@ -76,7 +76,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {
76 this.formValidated() 76 this.formValidated()
77 } 77 }
78 78
79 openVisitorModal (event) { 79 openVisitorModal (event: any) {
80 if (this.user === null) { // we only open it for visitors 80 if (this.user === null) { // we only open it for visitors
81 // fixing ng-bootstrap ModalService and the "Expression Changed After It Has Been Checked" Error 81 // fixing ng-bootstrap ModalService and the "Expression Changed After It Has Been Checked" Error
82 event.srcElement.blur() 82 event.srcElement.blur()
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 e90008de9..982470786 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 = [] 29 newParentComments: any = []
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.model.ts b/client/src/app/videos/+video-watch/comment/video-comment.model.ts
index fe591811e..824fb24c3 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment.model.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment.model.ts
@@ -14,7 +14,7 @@ export class VideoComment implements VideoCommentServerModel {
14 account: AccountInterface 14 account: AccountInterface
15 totalReplies: number 15 totalReplies: number
16 by: string 16 by: string
17 accountAvatarUrl 17 accountAvatarUrl: string
18 18
19 constructor (hash: VideoCommentServerModel) { 19 constructor (hash: VideoCommentServerModel) {
20 this.id = hash.id 20 this.id = hash.id
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 9bcb4b7de..7d9c2d0ad 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
@@ -32,7 +32,7 @@ export class VideoCommentService {
32 32
33 return this.authHttp.post(url, normalizedComment) 33 return this.authHttp.post(url, normalizedComment)
34 .pipe( 34 .pipe(
35 map(data => this.extractVideoComment(data['comment'])), 35 map((data: any) => this.extractVideoComment(data['comment'])),
36 catchError(err => this.restExtractor.handleError(err)) 36 catchError(err => this.restExtractor.handleError(err))
37 ) 37 )
38 } 38 }
@@ -43,7 +43,7 @@ export class VideoCommentService {
43 43
44 return this.authHttp.post(url, normalizedComment) 44 return this.authHttp.post(url, normalizedComment)
45 .pipe( 45 .pipe(
46 map(data => this.extractVideoComment(data[ 'comment' ])), 46 map((data: any) => 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.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
index c864d82b7..4c1bdf2dd 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
@@ -35,7 +35,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
35 threadComments: { [ id: number ]: VideoCommentThreadTree } = {} 35 threadComments: { [ id: number ]: VideoCommentThreadTree } = {}
36 threadLoading: { [ id: number ]: boolean } = {} 36 threadLoading: { [ id: number ]: boolean } = {}
37 37
38 syndicationItems = [] 38 syndicationItems: any = []
39 39
40 private sub: Subscription 40 private sub: Subscription
41 41
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 c5deddf05..ed5e723c9 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,7 @@ import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-supp
7import { MetaService } from '@ngx-meta/core' 7import { MetaService } from '@ngx-meta/core'
8import { NotificationsService } from 'angular2-notifications' 8import { NotificationsService } from 'angular2-notifications'
9import { forkJoin, Subscription } from 'rxjs' 9import { forkJoin, Subscription } from 'rxjs'
10import * as videojs from 'video.js' 10const videojs = require('video.js')
11import 'videojs-hotkeys' 11import 'videojs-hotkeys'
12import { Hotkey, HotkeysService } from 'angular2-hotkeys' 12import { Hotkey, HotkeysService } from 'angular2-hotkeys'
13import * as WebTorrent from 'webtorrent' 13import * as WebTorrent from 'webtorrent'
@@ -45,7 +45,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
45 @ViewChild('videoBlacklistModal') videoBlacklistModal: VideoBlacklistComponent 45 @ViewChild('videoBlacklistModal') videoBlacklistModal: VideoBlacklistComponent
46 @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent 46 @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent
47 47
48 player: videojs.Player 48 player: any
49 playerElement: HTMLVideoElement 49 playerElement: HTMLVideoElement
50 userRating: UserVideoRateType = null 50 userRating: UserVideoRateType = null
51 video: VideoDetails = null 51 video: VideoDetails = null
@@ -435,7 +435,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
435 this.zone.runOutsideAngular(async () => { 435 this.zone.runOutsideAngular(async () => {
436 videojs(this.playerElement, videojsOptions, function () { 436 videojs(this.playerElement, videojsOptions, function () {
437 self.player = this 437 self.player = this
438 this.on('customError', (event, data) => self.handleError(data.err)) 438 this.on('customError', (data: any) => self.handleError(data.err))
439 439
440 addContextMenu(self.player, self.video.embedUrl) 440 addContextMenu(self.player, self.video.embedUrl)
441 }) 441 })
@@ -448,7 +448,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
448 this.checkUserRating() 448 this.checkUserRating()
449 } 449 }
450 450
451 private setRating (nextRating) { 451 private setRating (nextRating: string) {
452 let method 452 let method
453 switch (nextRating) { 453 switch (nextRating) {
454 case 'like': 454 case 'like':
@@ -466,11 +466,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
466 .subscribe( 466 .subscribe(
467 () => { 467 () => {
468 // Update the video like attribute 468 // Update the video like attribute
469 this.updateVideoRating(this.userRating, nextRating) 469 this.updateVideoRating(this.userRating, nextRating as VideoRateType)
470 this.userRating = nextRating 470 this.userRating = nextRating as UserVideoRateType
471 }, 471 },
472 472
473 err => this.notificationsService.error(this.i18n('Error'), err.message) 473 (err: any) => this.notificationsService.error(this.i18n('Error'), err.message)
474 ) 474 )
475 } 475 }
476 476
diff --git a/client/src/assets/player/peertube-chunk-store.ts b/client/src/assets/player/peertube-chunk-store.ts
index 767e46821..ac3f9e654 100644
--- a/client/src/assets/player/peertube-chunk-store.ts
+++ b/client/src/assets/player/peertube-chunk-store.ts
@@ -40,15 +40,15 @@ export class PeertubeChunkStore extends EventEmitter {
40 // If the store is full 40 // If the store is full
41 private memoryChunks: { [ id: number ]: Buffer | true } = {} 41 private memoryChunks: { [ id: number ]: Buffer | true } = {}
42 private databaseName: string 42 private databaseName: string
43 private putBulkTimeout 43 private putBulkTimeout: any
44 private cleanerInterval 44 private cleanerInterval: any
45 private db: ChunkDatabase 45 private db: ChunkDatabase
46 private expirationDB: ExpirationDatabase 46 private expirationDB: ExpirationDatabase
47 private readonly length: number 47 private readonly length: number
48 private readonly lastChunkLength: number 48 private readonly lastChunkLength: number
49 private readonly lastChunkIndex: number 49 private readonly lastChunkIndex: number
50 50
51 constructor (chunkLength: number, opts) { 51 constructor (chunkLength: number, opts: any) {
52 super() 52 super()
53 53
54 this.databaseName = 'webtorrent-chunks-' 54 this.databaseName = 'webtorrent-chunks-'
@@ -113,13 +113,13 @@ export class PeertubeChunkStore extends EventEmitter {
113 }, PeertubeChunkStore.BUFFERING_PUT_MS) 113 }, PeertubeChunkStore.BUFFERING_PUT_MS)
114 } 114 }
115 115
116 get (index: number, opts, cb) { 116 get (index: number, opts: any, cb: any): any {
117 if (typeof opts === 'function') return this.get(index, null, opts) 117 if (typeof opts === 'function') return this.get(index, null, opts)
118 118
119 // IndexDB could be slow, use our memory index first 119 // IndexDB could be slow, use our memory index first
120 const memoryChunk = this.memoryChunks[index] 120 const memoryChunk = this.memoryChunks[index]
121 if (memoryChunk === undefined) { 121 if (memoryChunk === undefined) {
122 const err = new Error('Chunk not found') 122 const err = new Error('Chunk not found') as any
123 err['notFound'] = true 123 err['notFound'] = true
124 124
125 return process.nextTick(() => cb(err)) 125 return process.nextTick(() => cb(err))
@@ -146,11 +146,11 @@ export class PeertubeChunkStore extends EventEmitter {
146 }) 146 })
147 } 147 }
148 148
149 close (db) { 149 close (db: any) {
150 return this.destroy(db) 150 return this.destroy(db)
151 } 151 }
152 152
153 async destroy (cb) { 153 async destroy (cb: any) {
154 try { 154 try {
155 if (this.pendingPut) { 155 if (this.pendingPut) {
156 clearTimeout(this.putBulkTimeout) 156 clearTimeout(this.putBulkTimeout)
@@ -225,7 +225,7 @@ export class PeertubeChunkStore extends EventEmitter {
225 } 225 }
226 } 226 }
227 227
228 private nextTick (cb, err, val?) { 228 private nextTick (cb: any, err: Error, val?: any) {
229 process.nextTick(() => cb(err, val), undefined) 229 process.nextTick(() => cb(err, val), undefined)
230 } 230 }
231} 231}
diff --git a/client/src/assets/player/peertube-link-button.ts b/client/src/assets/player/peertube-link-button.ts
index 715207bc0..b03952b47 100644
--- a/client/src/assets/player/peertube-link-button.ts
+++ b/client/src/assets/player/peertube-link-button.ts
@@ -1,11 +1,10 @@
1import * as videojs from 'video.js'
2import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' 1import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
3import { buildVideoLink } from './utils' 2import { buildVideoLink } from './utils'
4 3
5const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button') 4const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button')
6class PeerTubeLinkButton extends Button { 5class PeerTubeLinkButton extends Button {
7 6
8 constructor (player: videojs.Player, options) { 7 constructor (player: any, options: any) {
9 super(player, options) 8 super(player, options)
10 } 9 }
11 10
diff --git a/client/src/assets/player/peertube-load-progress-bar.ts b/client/src/assets/player/peertube-load-progress-bar.ts
index aedc641e4..ee8a6cd81 100644
--- a/client/src/assets/player/peertube-load-progress-bar.ts
+++ b/client/src/assets/player/peertube-load-progress-bar.ts
@@ -4,7 +4,7 @@ const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Compon
4 4
5class PeerTubeLoadProgressBar extends Component { 5class PeerTubeLoadProgressBar extends Component {
6 6
7 constructor (player, options) { 7 constructor (player: any, options: any) {
8 super(player, options) 8 super(player, options)
9 this.partEls_ = [] 9 this.partEls_ = []
10 this.on(player, 'progress', this.update) 10 this.on(player, 'progress', this.update)
diff --git a/client/src/assets/player/peertube-player.ts b/client/src/assets/player/peertube-player.ts
index 792662b6c..ef9e7fcc0 100644
--- a/client/src/assets/player/peertube-player.ts
+++ b/client/src/assets/player/peertube-player.ts
@@ -75,12 +75,12 @@ function getVideojsOptions (options: {
75 enableVolumeScroll: false, 75 enableVolumeScroll: false,
76 enableModifiersForNumbers: false, 76 enableModifiersForNumbers: false,
77 77
78 fullscreenKey: function (event) { 78 fullscreenKey: function (event: any) {
79 // fullscreen with the f key or Ctrl+Enter 79 // fullscreen with the f key or Ctrl+Enter
80 return event.key === 'f' || (event.ctrlKey && event.key === 'Enter') 80 return event.key === 'f' || (event.ctrlKey && event.key === 'Enter')
81 }, 81 },
82 82
83 seekStep: function (event) { 83 seekStep: function (event: any) {
84 // mimic VLC seek behavior, and default to 5 (original value is 5). 84 // mimic VLC seek behavior, and default to 5 (original value is 5).
85 if (event.ctrlKey && event.altKey) { 85 if (event.ctrlKey && event.altKey) {
86 return 5 * 60 86 return 5 * 60
@@ -95,26 +95,26 @@ function getVideojsOptions (options: {
95 95
96 customKeys: { 96 customKeys: {
97 increasePlaybackRateKey: { 97 increasePlaybackRateKey: {
98 key: function (event) { 98 key: function (event: any) {
99 return event.key === '>' 99 return event.key === '>'
100 }, 100 },
101 handler: function (player) { 101 handler: function (player: any) {
102 player.playbackRate((player.playbackRate() + 0.1).toFixed(2)) 102 player.playbackRate((player.playbackRate() + 0.1).toFixed(2))
103 } 103 }
104 }, 104 },
105 decreasePlaybackRateKey: { 105 decreasePlaybackRateKey: {
106 key: function (event) { 106 key: function (event: any) {
107 return event.key === '<' 107 return event.key === '<'
108 }, 108 },
109 handler: function (player) { 109 handler: function (player: any) {
110 player.playbackRate((player.playbackRate() - 0.1).toFixed(2)) 110 player.playbackRate((player.playbackRate() - 0.1).toFixed(2))
111 } 111 }
112 }, 112 },
113 frameByFrame: { 113 frameByFrame: {
114 key: function (event) { 114 key: function (event: any) {
115 return event.key === '.' 115 return event.key === '.'
116 }, 116 },
117 handler: function (player, options, event) { 117 handler: function (player: any) {
118 player.pause() 118 player.pause()
119 // Calculate movement distance (assuming 30 fps) 119 // Calculate movement distance (assuming 30 fps)
120 const dist = 1 / 30 120 const dist = 1 / 30
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts
index 5cebab6d9..03def186e 100644
--- a/client/src/assets/player/peertube-videojs-plugin.ts
+++ b/client/src/assets/player/peertube-videojs-plugin.ts
@@ -1,11 +1,11 @@
1import * as videojs from 'video.js' 1const videojs = require('video.js')
2import * as WebTorrent from 'webtorrent' 2import * as WebTorrent from 'webtorrent'
3import { VideoFile } from '../../../../shared/models/videos/video.model' 3import { VideoFile } from '../../../../shared/models/videos/video.model'
4import { renderVideo } from './video-renderer' 4import { renderVideo } from './video-renderer'
5import './settings-menu-button' 5import './settings-menu-button'
6import { PeertubePluginOptions, UserWatching, VideoJSCaption, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' 6import { PeertubePluginOptions, UserWatching, VideoJSCaption, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
7import { isMobile, timeToInt, videoFileMaxByResolution, videoFileMinByResolution } from './utils' 7import { isMobile, timeToInt, videoFileMaxByResolution, videoFileMinByResolution } from './utils'
8import * as CacheChunkStore from 'cache-chunk-store' 8const CacheChunkStore = require('cache-chunk-store')
9import { PeertubeChunkStore } from './peertube-chunk-store' 9import { PeertubeChunkStore } from './peertube-chunk-store'
10import { 10import {
11 getAverageBandwidthInStore, 11 getAverageBandwidthInStore,
@@ -61,11 +61,11 @@ class PeerTubePlugin extends Plugin {
61 61
62 private player: any 62 private player: any
63 private currentVideoFile: VideoFile 63 private currentVideoFile: VideoFile
64 private torrent: WebTorrent.Torrent 64 private torrent: any
65 private videoCaptions: VideoJSCaption[] 65 private videoCaptions: VideoJSCaption[]
66 66
67 private renderer 67 private renderer: any
68 private fakeRenderer 68 private fakeRenderer: any
69 private destoyingFakeRenderer = false 69 private destoyingFakeRenderer = false
70 70
71 private autoResolution = true 71 private autoResolution = true
@@ -73,17 +73,17 @@ class PeerTubePlugin extends Plugin {
73 private isAutoResolutionObservation = false 73 private isAutoResolutionObservation = false
74 private playerRefusedP2P = false 74 private playerRefusedP2P = false
75 75
76 private videoViewInterval 76 private videoViewInterval: any
77 private torrentInfoInterval 77 private torrentInfoInterval: any
78 private autoQualityInterval 78 private autoQualityInterval: any
79 private userWatchingVideoInterval 79 private userWatchingVideoInterval: any
80 private addTorrentDelay 80 private addTorrentDelay: any
81 private qualityObservationTimer 81 private qualityObservationTimer: any
82 private runAutoQualitySchedulerTimer 82 private runAutoQualitySchedulerTimer: any
83 83
84 private downloadSpeeds: number[] = [] 84 private downloadSpeeds: number[] = []
85 85
86 constructor (player: videojs.Player, options: PeertubePluginOptions) { 86 constructor (player: any, options: PeertubePluginOptions) {
87 super(player, options) 87 super(player, options)
88 88
89 // Disable auto play on iOS 89 // Disable auto play on iOS
@@ -273,7 +273,7 @@ class PeerTubePlugin extends Plugin {
273 273
274 const oldTorrent = this.torrent 274 const oldTorrent = this.torrent
275 const torrentOptions = { 275 const torrentOptions = {
276 store: (chunkLength, storeOpts) => new CacheChunkStore(new PeertubeChunkStore(chunkLength, storeOpts), { 276 store: (chunkLength: any, storeOpts: any) => new CacheChunkStore(new PeertubeChunkStore(chunkLength, storeOpts), {
277 max: 100 277 max: 100
278 }) 278 })
279 } 279 }
@@ -304,7 +304,7 @@ class PeerTubePlugin extends Plugin {
304 304
305 if (err) return this.fallbackToHttp(options, done) 305 if (err) return this.fallbackToHttp(options, done)
306 306
307 return this.tryToPlay(err => { 307 return this.tryToPlay((err: Error) => {
308 if (err) return done(err) 308 if (err) return done(err)
309 309
310 if (options.seek) this.seek(options.seek) 310 if (options.seek) this.seek(options.seek)
@@ -316,7 +316,7 @@ class PeerTubePlugin extends Plugin {
316 }, options.delay || 0) 316 }, options.delay || 0)
317 }) 317 })
318 318
319 this.torrent.on('error', err => console.error(err)) 319 this.torrent.on('error', (err: any) => console.error(err))
320 320
321 this.torrent.on('warning', (err: any) => { 321 this.torrent.on('warning', (err: any) => {
322 // We don't support HTTP tracker but we don't care -> we use the web socket tracker 322 // We don't support HTTP tracker but we don't care -> we use the web socket tracker
@@ -350,7 +350,7 @@ class PeerTubePlugin extends Plugin {
350 const playPromise = this.player.play() 350 const playPromise = this.player.play()
351 if (playPromise !== undefined) { 351 if (playPromise !== undefined) {
352 return playPromise.then(done) 352 return playPromise.then(done)
353 .catch(err => { 353 .catch((err: Error) => {
354 if (err.message.indexOf('The play() request was interrupted by a call to pause()') !== -1) { 354 if (err.message.indexOf('The play() request was interrupted by a call to pause()') !== -1) {
355 return 355 return
356 } 356 }
@@ -627,7 +627,7 @@ class PeerTubePlugin extends Plugin {
627 this.player.options_.inactivityTimeout = saveInactivityTimeout 627 this.player.options_.inactivityTimeout = saveInactivityTimeout
628 } 628 }
629 629
630 const settingsDialog = this.player.children_.find(c => c.name_ === 'SettingsDialog') 630 const settingsDialog = this.player.children_.find((c: any) => c.name_ === 'SettingsDialog')
631 631
632 this.player.controlBar.on('mouseenter', () => disableInactivity()) 632 this.player.controlBar.on('mouseenter', () => disableInactivity())
633 settingsDialog.on('mouseenter', () => disableInactivity()) 633 settingsDialog.on('mouseenter', () => disableInactivity())
@@ -641,7 +641,7 @@ class PeerTubePlugin extends Plugin {
641 return this.videoFiles[Math.floor(this.videoFiles.length / 2)] 641 return this.videoFiles[Math.floor(this.videoFiles.length / 2)]
642 } 642 }
643 643
644 private stopTorrent (torrent: WebTorrent.Torrent) { 644 private stopTorrent (torrent: any) {
645 torrent.pause() 645 torrent.pause()
646 // Pause does not remove actual peers (in particular the webseed peer) 646 // Pause does not remove actual peers (in particular the webseed peer)
647 torrent.removePeer(torrent[ 'ws' ]) 647 torrent.removePeer(torrent[ 'ws' ])
@@ -703,7 +703,7 @@ class PeerTubePlugin extends Plugin {
703 const percent = time / this.player_.duration() 703 const percent = time / this.player_.duration()
704 return percent >= 1 ? 1 : percent 704 return percent >= 1 ? 1 : percent
705 } 705 }
706 SeekBar.prototype.handleMouseMove = function handleMouseMove (event) { 706 SeekBar.prototype.handleMouseMove = function handleMouseMove (event: any) {
707 let newTime = this.calculateDistance(event) * this.player_.duration() 707 let newTime = this.calculateDistance(event) * this.player_.duration()
708 if (newTime === this.player_.duration()) { 708 if (newTime === this.player_.duration()) {
709 newTime = newTime - 0.1 709 newTime = newTime - 0.1
diff --git a/client/src/assets/player/peertube-videojs-typings.ts b/client/src/assets/player/peertube-videojs-typings.ts
index b117007af..98a33077d 100644
--- a/client/src/assets/player/peertube-videojs-typings.ts
+++ b/client/src/assets/player/peertube-videojs-typings.ts
@@ -1,4 +1,4 @@
1import * as videojs from 'video.js' 1const videojs = require('video.js')
2import { VideoFile } from '../../../../shared/models/videos/video.model' 2import { VideoFile } from '../../../../shared/models/videos/video.model'
3import { PeerTubePlugin } from './peertube-videojs-plugin' 3import { PeerTubePlugin } from './peertube-videojs-plugin'
4 4
@@ -11,9 +11,9 @@ declare namespace videojs {
11interface VideoJSComponentInterface { 11interface VideoJSComponentInterface {
12 _player: videojs.Player 12 _player: videojs.Player
13 13
14 new (player: videojs.Player, options?: any) 14 new (player: videojs.Player, options?: any): any
15 15
16 registerComponent (name: string, obj: any) 16 registerComponent (name: string, obj: any): any
17} 17}
18 18
19type VideoJSCaption = { 19type VideoJSCaption = {
diff --git a/client/src/assets/player/resolution-menu-button.ts b/client/src/assets/player/resolution-menu-button.ts
index d53a24151..91818efc9 100644
--- a/client/src/assets/player/resolution-menu-button.ts
+++ b/client/src/assets/player/resolution-menu-button.ts
@@ -1,4 +1,3 @@
1import * as videojs from 'video.js'
2import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' 1import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
3import { ResolutionMenuItem } from './resolution-menu-item' 2import { ResolutionMenuItem } from './resolution-menu-item'
4 3
@@ -7,7 +6,7 @@ const MenuButton: VideoJSComponentInterface = videojsUntyped.getComponent('MenuB
7class ResolutionMenuButton extends MenuButton { 6class ResolutionMenuButton extends MenuButton {
8 label: HTMLElement 7 label: HTMLElement
9 8
10 constructor (player: videojs.Player, options) { 9 constructor (player: any, options: any) {
11 super(player, options) 10 super(player, options)
12 this.player = player 11 this.player = player
13 12
diff --git a/client/src/assets/player/resolution-menu-item.ts b/client/src/assets/player/resolution-menu-item.ts
index 0ab0f53b5..afe490abb 100644
--- a/client/src/assets/player/resolution-menu-item.ts
+++ b/client/src/assets/player/resolution-menu-item.ts
@@ -1,10 +1,9 @@
1import * as videojs from 'video.js'
2import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' 1import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
3 2
4const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem') 3const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem')
5class ResolutionMenuItem extends MenuItem { 4class ResolutionMenuItem extends MenuItem {
6 5
7 constructor (player: videojs.Player, options) { 6 constructor (player: any, options: any) {
8 const currentResolutionId = player.peertube().getCurrentResolutionId() 7 const currentResolutionId = player.peertube().getCurrentResolutionId()
9 options.selectable = true 8 options.selectable = true
10 options.selected = options.id === currentResolutionId 9 options.selected = options.id === currentResolutionId
@@ -18,7 +17,7 @@ class ResolutionMenuItem extends MenuItem {
18 player.peertube().on('autoResolutionUpdate', () => this.updateSelection()) 17 player.peertube().on('autoResolutionUpdate', () => this.updateSelection())
19 } 18 }
20 19
21 handleClick (event) { 20 handleClick (event: any) {
22 if (this.id === -1 && this.player_.peertube().isAutoResolutionForbidden()) return 21 if (this.id === -1 && this.player_.peertube().isAutoResolutionForbidden()) return
23 22
24 super.handleClick(event) 23 super.handleClick(event)
diff --git a/client/src/assets/player/settings-menu-button.ts b/client/src/assets/player/settings-menu-button.ts
index b51c52506..f0ccb5862 100644
--- a/client/src/assets/player/settings-menu-button.ts
+++ b/client/src/assets/player/settings-menu-button.ts
@@ -1,7 +1,7 @@
1// Author: Yanko Shterev 1// Author: Yanko Shterev
2// Thanks https://github.com/yshterev/videojs-settings-menu 2// Thanks https://github.com/yshterev/videojs-settings-menu
3 3
4import * as videojs from 'video.js' 4const videojs = require('video.js')
5import { SettingsMenuItem } from './settings-menu-item' 5import { SettingsMenuItem } from './settings-menu-item'
6import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' 6import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
7import { toTitleCase } from './utils' 7import { toTitleCase } from './utils'
@@ -11,7 +11,7 @@ const Menu: VideoJSComponentInterface = videojsUntyped.getComponent('Menu')
11const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Component') 11const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Component')
12 12
13class SettingsButton extends Button { 13class SettingsButton extends Button {
14 constructor (player: videojs.Player, options) { 14 constructor (player: any, options: any) {
15 super(player, options) 15 super(player, options)
16 16
17 this.playerComponent = player 17 this.playerComponent = player
@@ -48,7 +48,7 @@ class SettingsButton extends Button {
48 } 48 }
49 } 49 }
50 50
51 onDisposeSettingsItem (event, name: string) { 51 onDisposeSettingsItem (name: string) {
52 if (name === undefined) { 52 if (name === undefined) {
53 let children = this.menu.children() 53 let children = this.menu.children()
54 54
@@ -74,7 +74,7 @@ class SettingsButton extends Button {
74 } 74 }
75 } 75 }
76 76
77 onAddSettingsItem (event, data) { 77 onAddSettingsItem (data: any) {
78 const [ entry, options ] = data 78 const [ entry, options ] = data
79 79
80 this.addMenuItem(entry, options) 80 this.addMenuItem(entry, options)
@@ -120,7 +120,7 @@ class SettingsButton extends Button {
120 this.resetChildren() 120 this.resetChildren()
121 } 121 }
122 122
123 getComponentSize (element) { 123 getComponentSize (element: any) {
124 let width: number = null 124 let width: number = null
125 let height: number = null 125 let height: number = null
126 126
@@ -178,7 +178,7 @@ class SettingsButton extends Button {
178 this.panelChild.addChild(this.menu) 178 this.panelChild.addChild(this.menu)
179 } 179 }
180 180
181 addMenuItem (entry, options) { 181 addMenuItem (entry: any, options: any) {
182 const openSubMenu = function () { 182 const openSubMenu = function () {
183 if (videojsUntyped.dom.hasClass(this.el_, 'open')) { 183 if (videojsUntyped.dom.hasClass(this.el_, 'open')) {
184 videojsUntyped.dom.removeClass(this.el_, 'open') 184 videojsUntyped.dom.removeClass(this.el_, 'open')
@@ -218,7 +218,7 @@ class SettingsButton extends Button {
218} 218}
219 219
220class SettingsPanel extends Component { 220class SettingsPanel extends Component {
221 constructor (player: videojs.Player, options) { 221 constructor (player: any, options: any) {
222 super(player, options) 222 super(player, options)
223 } 223 }
224 224
@@ -232,7 +232,7 @@ class SettingsPanel extends Component {
232} 232}
233 233
234class SettingsPanelChild extends Component { 234class SettingsPanelChild extends Component {
235 constructor (player: videojs.Player, options) { 235 constructor (player: any, options: any) {
236 super(player, options) 236 super(player, options)
237 } 237 }
238 238
@@ -246,7 +246,7 @@ class SettingsPanelChild extends Component {
246} 246}
247 247
248class SettingsDialog extends Component { 248class SettingsDialog extends Component {
249 constructor (player: videojs.Player, options) { 249 constructor (player: any, options: any) {
250 super(player, options) 250 super(player, options)
251 this.hide() 251 this.hide()
252 } 252 }
diff --git a/client/src/assets/player/settings-menu-item.ts b/client/src/assets/player/settings-menu-item.ts
index 665ce6fc2..2d752b62e 100644
--- a/client/src/assets/player/settings-menu-item.ts
+++ b/client/src/assets/player/settings-menu-item.ts
@@ -1,7 +1,6 @@
1// Author: Yanko Shterev 1// Author: Yanko Shterev
2// Thanks https://github.com/yshterev/videojs-settings-menu 2// Thanks https://github.com/yshterev/videojs-settings-menu
3 3
4import * as videojs from 'video.js'
5import { toTitleCase } from './utils' 4import { toTitleCase } from './utils'
6import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' 5import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
7 6
@@ -10,7 +9,7 @@ const component: VideoJSComponentInterface = videojsUntyped.getComponent('Compon
10 9
11class SettingsMenuItem extends MenuItem { 10class SettingsMenuItem extends MenuItem {
12 11
13 constructor (player: videojs.Player, options, entry: string, menuButton: VideoJSComponentInterface) { 12 constructor (player: any, options: any, entry: string, menuButton: VideoJSComponentInterface) {
14 super(player, options) 13 super(player, options)
15 14
16 this.settingsButton = menuButton 15 this.settingsButton = menuButton
@@ -55,7 +54,7 @@ class SettingsMenuItem extends MenuItem {
55 this.transitionEndHandler = this.onTransitionEnd.bind(this) 54 this.transitionEndHandler = this.onTransitionEnd.bind(this)
56 } 55 }
57 56
58 onSubmenuClick (event) { 57 onSubmenuClick (event: any) {
59 let target = null 58 let target = null
60 59
61 if (event.type === 'tap') { 60 if (event.type === 'tap') {
@@ -150,7 +149,7 @@ class SettingsMenuItem extends MenuItem {
150 * 149 *
151 * @method PrefixedEvent 150 * @method PrefixedEvent
152 */ 151 */
153 PrefixedEvent (element, type, callback, action = 'addEvent') { 152 PrefixedEvent (element: any, type: any, callback: any, action = 'addEvent') {
154 let prefix = ['webkit', 'moz', 'MS', 'o', ''] 153 let prefix = ['webkit', 'moz', 'MS', 'o', '']
155 154
156 for (let p = 0; p < prefix.length; p++) { 155 for (let p = 0; p < prefix.length; p++) {
@@ -166,7 +165,7 @@ class SettingsMenuItem extends MenuItem {
166 } 165 }
167 } 166 }
168 167
169 onTransitionEnd (event) { 168 onTransitionEnd (event: any) {
170 if (event.propertyName !== 'margin-right') { 169 if (event.propertyName !== 'margin-right') {
171 return 170 return
172 } 171 }
@@ -229,7 +228,7 @@ class SettingsMenuItem extends MenuItem {
229 ) 228 )
230 } 229 }
231 230
232 update (event?: Event) { 231 update (event?: any) {
233 let target = null 232 let target = null
234 let subMenu = this.subMenu.name() 233 let subMenu = this.subMenu.name()
235 234
diff --git a/client/src/assets/player/theater-button.ts b/client/src/assets/player/theater-button.ts
index 5cf0b6425..b761f6030 100644
--- a/client/src/assets/player/theater-button.ts
+++ b/client/src/assets/player/theater-button.ts
@@ -6,7 +6,7 @@ class TheaterButton extends Button {
6 6
7 private static readonly THEATER_MODE_CLASS = 'vjs-theater-enabled' 7 private static readonly THEATER_MODE_CLASS = 'vjs-theater-enabled'
8 8
9 constructor (player, options) { 9 constructor (player: any, options: any) {
10 super(player, options) 10 super(player, options)
11 11
12 const enabled = getStoredTheater() 12 const enabled = getStoredTheater()
diff --git a/client/src/assets/player/utils.ts b/client/src/assets/player/utils.ts
index cf4f60f55..46081c0d2 100644
--- a/client/src/assets/player/utils.ts
+++ b/client/src/assets/player/utils.ts
@@ -12,7 +12,7 @@ const dictionaryBytes: Array<{max: number, type: string}> = [
12 { max: 1073741824, type: 'MB' }, 12 { max: 1073741824, type: 'MB' },
13 { max: 1.0995116e12, type: 'GB' } 13 { max: 1.0995116e12, type: 'GB' }
14] 14]
15function bytes (value) { 15function bytes (value: any) {
16 const format = dictionaryBytes.find(d => value < d.max) || dictionaryBytes[dictionaryBytes.length - 1] 16 const format = dictionaryBytes.find(d => value < d.max) || dictionaryBytes[dictionaryBytes.length - 1]
17 const calc = Math.floor(value / (format.max / 1024)).toString() 17 const calc = Math.floor(value / (format.max / 1024)).toString()
18 18
diff --git a/client/src/assets/player/video-renderer.ts b/client/src/assets/player/video-renderer.ts
index 2cb05a448..a3415937b 100644
--- a/client/src/assets/player/video-renderer.ts
+++ b/client/src/assets/player/video-renderer.ts
@@ -1,9 +1,9 @@
1// Thanks: https://github.com/feross/render-media 1// Thanks: https://github.com/feross/render-media
2// TODO: use render-media once https://github.com/feross/render-media/issues/32 is fixed 2// TODO: use render-media once https://github.com/feross/render-media/issues/32 is fixed
3 3
4import * as MediaElementWrapper from 'mediasource' 4const MediaElementWrapper = require('mediasource')
5import { extname } from 'path' 5import { extname } from 'path'
6import * as videostream from 'videostream' 6const videostream = require('videostream')
7 7
8const VIDEOSTREAM_EXTS = [ 8const VIDEOSTREAM_EXTS = [
9 '.m4a', 9 '.m4a',
@@ -17,7 +17,7 @@ type RenderMediaOptions = {
17} 17}
18 18
19function renderVideo ( 19function renderVideo (
20 file, 20 file: any,
21 elem: HTMLVideoElement, 21 elem: HTMLVideoElement,
22 opts: RenderMediaOptions, 22 opts: RenderMediaOptions,
23 callback: (err: Error, renderer: any) => void 23 callback: (err: Error, renderer: any) => void
@@ -27,11 +27,11 @@ function renderVideo (
27 return renderMedia(file, elem, opts, callback) 27 return renderMedia(file, elem, opts, callback)
28} 28}
29 29
30function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, callback: (err: Error, renderer?: any) => void) { 30function renderMedia (file: any, elem: HTMLVideoElement, opts: RenderMediaOptions, callback: (err: Error, renderer?: any) => void) {
31 const extension = extname(file.name).toLowerCase() 31 const extension = extname(file.name).toLowerCase()
32 let preparedElem = undefined 32 let preparedElem: any = undefined
33 let currentTime = 0 33 let currentTime = 0
34 let renderer 34 let renderer: any
35 35
36 try { 36 try {
37 if (VIDEOSTREAM_EXTS.indexOf(extension) >= 0) { 37 if (VIDEOSTREAM_EXTS.indexOf(extension) >= 0) {
@@ -45,7 +45,7 @@ function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, ca
45 45
46 function useVideostream () { 46 function useVideostream () {
47 prepareElem() 47 prepareElem()
48 preparedElem.addEventListener('error', function onError (err) { 48 preparedElem.addEventListener('error', function onError (err: Error) {
49 preparedElem.removeEventListener('error', onError) 49 preparedElem.removeEventListener('error', onError)
50 50
51 return callback(err) 51 return callback(err)
@@ -58,7 +58,7 @@ function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, ca
58 const codecs = getCodec(file.name, useVP9) 58 const codecs = getCodec(file.name, useVP9)
59 59
60 prepareElem() 60 prepareElem()
61 preparedElem.addEventListener('error', function onError (err) { 61 preparedElem.addEventListener('error', function onError (err: Error) {
62 preparedElem.removeEventListener('error', onError) 62 preparedElem.removeEventListener('error', onError)
63 63
64 // Try with vp9 before returning an error 64 // Try with vp9 before returning an error
@@ -102,7 +102,7 @@ function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, ca
102 } 102 }
103} 103}
104 104
105function validateFile (file) { 105function validateFile (file: any) {
106 if (file == null) { 106 if (file == null) {
107 throw new Error('file cannot be null or undefined') 107 throw new Error('file cannot be null or undefined')
108 } 108 }
diff --git a/client/src/assets/player/webtorrent-info-button.ts b/client/src/assets/player/webtorrent-info-button.ts
index deef253ce..5b9d0a401 100644
--- a/client/src/assets/player/webtorrent-info-button.ts
+++ b/client/src/assets/player/webtorrent-info-button.ts
@@ -65,7 +65,7 @@ class WebtorrentInfoButton extends Button {
65 subDivHttp.appendChild(subDivHttpText) 65 subDivHttp.appendChild(subDivHttpText)
66 div.appendChild(subDivHttp) 66 div.appendChild(subDivHttp)
67 67
68 this.player_.peertube().on('torrentInfo', (event, data) => { 68 this.player_.peertube().on('torrentInfo', (data: any) => {
69 // We are in HTTP fallback 69 // We are in HTTP fallback
70 if (!data) { 70 if (!data) {
71 subDivHttp.className = 'vjs-peertube-displayed' 71 subDivHttp.className = 'vjs-peertube-displayed'
diff --git a/client/src/main.ts b/client/src/main.ts
index f456e89c5..dee962180 100644
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -8,7 +8,7 @@ import { hmrBootstrap } from './hmr'
8import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils' 8import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils'
9import { buildFileLocale } from '../../shared' 9import { buildFileLocale } from '../../shared'
10 10
11let providers = [] 11let providers: any[] = []
12if (environment.production) { 12if (environment.production) {
13 enableProdMode() 13 enableProdMode()
14} 14}
diff --git a/client/src/polyfills.ts b/client/src/polyfills.ts
index eec30760d..dfe45b591 100644
--- a/client/src/polyfills.ts
+++ b/client/src/polyfills.ts
@@ -18,24 +18,26 @@
18 * BROWSER POLYFILLS 18 * BROWSER POLYFILLS
19 */ 19 */
20 20
21/** IE9, IE10 and IE11 requires all of the following polyfills. **/ 21/**
22 * IE9, IE10 and IE11 requires all of the following polyfills.
23 */
22 24
23// For Google Bot 25// For Google Bot
24import 'core-js/es6/symbol'; 26import 'core-js/es6/symbol'
25import 'core-js/es6/object'; 27import 'core-js/es6/object'
26import 'core-js/es6/function'; 28import 'core-js/es6/function'
27import 'core-js/es6/parse-int'; 29import 'core-js/es6/parse-int'
28import 'core-js/es6/parse-float'; 30import 'core-js/es6/parse-float'
29import 'core-js/es6/number'; 31import 'core-js/es6/number'
30import 'core-js/es6/math'; 32import 'core-js/es6/math'
31import 'core-js/es6/string'; 33import 'core-js/es6/string'
32import 'core-js/es6/date'; 34import 'core-js/es6/date'
33import 'core-js/es6/array'; 35import 'core-js/es6/array'
34import 'core-js/es6/regexp'; 36import 'core-js/es6/regexp'
35import 'core-js/es6/map'; 37import 'core-js/es6/map'
36import 'core-js/es6/weak-map'; 38import 'core-js/es6/weak-map'
37import 'core-js/es6/set'; 39import 'core-js/es6/set'
38import 'core-js/es7/object'; 40import 'core-js/es7/object'
39 41
40/** IE10 and IE11 requires the following for NgClass support on SVG elements */ 42/** IE10 and IE11 requires the following for NgClass support on SVG elements */
41// import 'classlist.js'; // Run `npm install --save classlist.js`. 43// import 'classlist.js'; // Run `npm install --save classlist.js`.
@@ -43,17 +45,18 @@ import 'core-js/es7/object';
43/** IE10 and IE11 requires the following for the Reflect API. */ 45/** IE10 and IE11 requires the following for the Reflect API. */
44 46
45// For Google Bot 47// For Google Bot
46import 'core-js/es6/reflect'; 48import 'core-js/es6/reflect'
47 49
48/** Evergreen browsers require these. **/ 50/**
51 * Evergreen browsers require these.
52 */
49// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. 53// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
50import 'core-js/es7/reflect' 54import 'core-js/es7/reflect'
51 55
52
53/** 56/**
54 * Required to support Web Animations `@angular/platform-browser/animations`. 57 * Required to support Web Animations `@angular/platform-browser/animations`.
55 * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation 58 * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
56 **/ 59 */
57// import 'web-animations-js'; // Run `npm install --save web-animations-js`. 60// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
58 61
59/** 62/**
@@ -70,19 +73,17 @@ import 'core-js/es7/reflect'
70*/ 73*/
71// (window as any).__Zone_enable_cross_context_check = true; 74// (window as any).__Zone_enable_cross_context_check = true;
72 75
73
74/*************************************************************************************************** 76/***************************************************************************************************
75 * Zone JS is required by default for Angular itself. 77 * Zone JS is required by default for Angular itself.
76 */ 78 */
77import 'zone.js/dist/zone' // Included with Angular CLI. 79import 'zone.js/dist/zone' // Included with Angular CLI.
78 80
79
80/*************************************************************************************************** 81/***************************************************************************************************
81 * APPLICATION IMPORTS 82 * APPLICATION IMPORTS
82 */ 83 */
83 84
84// global/process polyfills 85// global/process polyfills
85 86
86;(window as any).global = window; 87;(window as any).global = window
87;(window as any).process = require('process/'); 88;(window as any).process = require('process/')
88;(window as any).Buffer = require('buffer/').Buffer; 89;(window as any).Buffer = require('buffer/').Buffer
diff --git a/client/src/shims/noop.ts b/client/src/shims/noop.ts
index 899b69bf3..086a60e32 100644
--- a/client/src/shims/noop.ts
+++ b/client/src/shims/noop.ts
@@ -1,3 +1,3 @@
1// Does nothing. Used to shim out node.js modules 1// Does nothing. Used to shim out node.js modules
2// which are no-ops in the browser. 2// which are no-ops in the browser.
3export const NOOP = 0 \ No newline at end of file 3export const NOOP = 0
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts
index ea3436c7c..e5a2d208a 100644
--- a/client/src/standalone/videos/embed.ts
+++ b/client/src/standalone/videos/embed.ts
@@ -17,7 +17,7 @@ import 'core-js/es6/set'
17// For google bot that uses Chrome 41 and does not understand fetch 17// For google bot that uses Chrome 41 and does not understand fetch
18import 'whatwg-fetch' 18import 'whatwg-fetch'
19 19
20import * as vjs from 'video.js' 20const vjs = require('video.js')
21import * as Channel from 'jschannel' 21import * as Channel from 'jschannel'
22 22
23import { peertubeTranslate, ResultList, VideoDetails } from '../../../../shared' 23import { peertubeTranslate, ResultList, VideoDetails } from '../../../../shared'
@@ -304,7 +304,7 @@ class PeerTubeEmbed {
304 304
305 this.playerOptions = videojsOptions 305 this.playerOptions = videojsOptions
306 this.player = vjs(this.videoContainerId, videojsOptions, () => { 306 this.player = vjs(this.videoContainerId, videojsOptions, () => {
307 this.player.on('customError', (event, data) => this.handleError(data.err)) 307 this.player.on('customError', (data: any) => this.handleError(data.err))
308 308
309 window[ 'videojsPlayer' ] = this.player 309 window[ 'videojsPlayer' ] = this.player
310 310
diff --git a/client/src/standalone/videos/test-embed.ts b/client/src/standalone/videos/test-embed.ts
index dba331e90..b750c2ee6 100644
--- a/client/src/standalone/videos/test-embed.ts
+++ b/client/src/standalone/videos/test-embed.ts
@@ -66,11 +66,11 @@ window.addEventListener('load', async () => {
66 updateRates() 66 updateRates()
67 }) 67 })
68 68
69 let updateResolutions = resolutions => { 69 let updateResolutions = ((resolutions: any) => {
70 let resolutionListEl = document.querySelector('#resolution-list') 70 let resolutionListEl = document.querySelector('#resolution-list')
71 resolutionListEl.innerHTML = '' 71 resolutionListEl.innerHTML = ''
72 72
73 resolutions.forEach(resolution => { 73 resolutions.forEach((resolution: any) => {
74 if (resolution.active) { 74 if (resolution.active) {
75 let itemEl = document.createElement('strong') 75 let itemEl = document.createElement('strong')
76 itemEl.innerText = `${resolution.label} (active)` 76 itemEl.innerText = `${resolution.label} (active)`
@@ -87,7 +87,7 @@ window.addEventListener('load', async () => {
87 resolutionListEl.appendChild(itemEl) 87 resolutionListEl.appendChild(itemEl)
88 } 88 }
89 }) 89 })
90 } 90 })
91 91
92 player.getResolutions().then( 92 player.getResolutions().then(
93 resolutions => updateResolutions(resolutions)) 93 resolutions => updateResolutions(resolutions))
diff --git a/client/src/typings.d.ts b/client/src/typings.d.ts
index ef5c7bd62..9615434ac 100644
--- a/client/src/typings.d.ts
+++ b/client/src/typings.d.ts
@@ -2,4 +2,5 @@
2declare var module: NodeModule; 2declare var module: NodeModule;
3interface NodeModule { 3interface NodeModule {
4 id: string; 4 id: string;
5 [key: string]: any
5} 6}