Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

NoImplicitAny flag true (#1157)

BO41244b4ae3973b
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 25b303f44f..9a9298825f 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 {
}
ngOnInit () {
- const formGroupData = {
+ const formGroupData: any = {
instanceName: this.customConfigValidatorsService.INSTANCE_NAME,
instanceShortDescription: this.customConfigValidatorsService.INSTANCE_SHORT_DESCRIPTION,
instanceDescription: null,
@@ -202,7 +202,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
}
private updateForm () {
- const data = {
+ const data: any = {
instanceName: this.customConfig.instance.name,
instanceShortDescription: this.customConfig.instance.shortDescription,
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 99ce5804b7..a4d696e699 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 {
videoQuotaOptions: { value: string, label: string }[] = []
videoQuotaDailyOptions: { value: string, label: string }[] = []
- roles = Object.keys(USER_ROLE_LABELS).map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] }))
+ roles = Object.keys(USER_ROLE_LABELS).map((key: any) => ({ value: key.toString(), label: USER_ROLE_LABELS[key] }))
protected abstract serverService: ServerService
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 ab22507223..0d7f88d2ba 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 {
{
label: this.i18n('Ban'),
handler: users => this.openBanUserModal(users),
- isDisplayed: users => users.every(u => u.blocked === false)
+ isDisplayed: users => users.every((u: any) => u.blocked === false)
},
{
label: this.i18n('Unban'),
handler: users => this.unbanUsers(users),
- isDisplayed: users => users.every(u => u.blocked === true)
+ isDisplayed: users => users.every((u: any) => u.blocked === true)
}
]
}
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 56697030be..f2b8a4e26f 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
styleUrls: [ './my-account-video-channel-edit.component.scss' ]
})
export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelEdit implements OnInit, OnDestroy {
- @ViewChild('avatarfileInput') avatarfileInput
+ @ViewChild('avatarfileInput') avatarfileInput: any
error: string
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 7560f01289..52307f09e7 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
}
isInSelectionMode () {
- return Object.keys(this.checkedVideos).some(k => this.checkedVideos[ k ] === true)
+ return Object.keys(this.checkedVideos).some((k: any) => this.checkedVideos[ k ] === true)
}
getVideosObservable (page: number) {
@@ -81,7 +81,7 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni
async deleteSelectedVideos () {
const toDeleteVideosIds = Object.keys(this.checkedVideos)
- .filter(k => this.checkedVideos[ k ] === true)
+ .filter((k: any) => this.checkedVideos[ k ] === true)
.map(k => parseInt(k, 10))
const res = await this.confirmService.confirm(
@@ -168,9 +168,10 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni
}
private spliceVideosById (id: number) {
- for (const key of Object.keys(this.loadedPages)) {
+ let key: any
+ for (key of Object.keys(this.loadedPages)) {
const videos = this.loadedPages[ key ]
- const index = videos.findIndex(v => v.id === id)
+ const index = videos.findIndex((v: any) => v.id === id)
if (index !== -1) {
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 7437b939ad..eb3f9404f8 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
.catch((_) => _) // Called when closing (cancel) the modal without validating, do nothing
}
- search (event) {
+ // TODO: typing
+ search (event: any) {
const query = event.query
this.userService.autocomplete(query)
.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 7b80b1ed43..b4505a7f28 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'
styleUrls: [ './actor-avatar-info.component.scss' ]
})
export class ActorAvatarInfoComponent {
- @ViewChild('avatarfileInput') avatarfileInput
+ @ViewChild('avatarfileInput') avatarfileInput: any
@Input() actor: VideoChannel | Account
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts
index 34e890b40d..3711994422 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 {
providers: [
{
provide: TRANSLATIONS,
- useFactory: (locale) => {
+ useFactory: (locale: string) => {
// On dev mode, test localization
if (isOnDevLocale()) {
locale = buildFileLocale(getDevLocale())
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index 9c36b946e3..5315c8b1d8 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 {
}
refreshUserInformation () {
- const obj = {
+ const obj: any = {
access_token: this.user.getAccessToken(),
refresh_token: null,
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 2f1ef1fc23..1663a052c2 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 {
.pipe(
switchMap(translations => {
return this.http.get(ServerService.BASE_VIDEO_URL + attributeName)
- .pipe(map(data => ({ data, translations })))
+ .pipe(map((data: any) => ({ data, translations })))
})
)
.subscribe(({ data, translations }) => {
diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.ts
index a6eef08984..50c19ecac3 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'
export class ThemeService {
private theme = document.querySelector('body')
private darkTheme = false
- private previousTheme = {}
+ private previousTheme: { [ id: string ]: string } = {}
constructor () {
// initialise the alternative theme with dark theme colors
@@ -33,7 +33,7 @@ export class ThemeService {
}
}
- private switchProperty (property, newValue?) {
+ private switchProperty (property: string, newValue?: string) {
const propertyOldvalue = window.getComputedStyle(this.theme).getPropertyValue('--' + property)
this.theme.style.setProperty('--' + property, (newValue) ? newValue : this.previousTheme[property])
this.previousTheme[property] = propertyOldvalue
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts
index 95926f5f0d..348700c09f 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 {
userHasAdminAccess = false
helpVisible = false
- private routesPerRight = {
+ private routesPerRight: any = {
[UserRight.MANAGE_USERS]: '/admin/users',
[UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends',
[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 033fa9bba8..1d6c89282e 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 {
}
containsValues () {
- const obj = this.toUrlObject()
+ const obj: any = this.toUrlObject()
for (const k of Object.keys(obj)) {
if (k === 'sort') continue // Exception
@@ -113,7 +113,7 @@ export class AdvancedSearch {
size () {
let acc = 0
- const obj = this.toUrlObject()
+ const obj: any = this.toUrlObject()
for (const k of Object.keys(obj)) {
if (k === 'sort') continue // Exception
diff --git a/client/src/app/shared/buttons/action-dropdown.component.ts b/client/src/app/shared/buttons/action-dropdown.component.ts
index 022ab5ee81..9877f639dd 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'
export type DropdownAction<T> = {
label?: string
- handler?: (T) => any
- linkBuilder?: (T) => (string | number)[]
- isDisplayed?: (T) => boolean
+ handler?: (T: any) => any
+ linkBuilder?: (T: any) => (string | number)[]
+ isDisplayed?: (T: any) => boolean
}
@Component({
diff --git a/client/src/app/shared/buttons/button.component.ts b/client/src/app/shared/buttons/button.component.ts
index 967cb14097..cccf98bc3a 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'
export class ButtonComponent {
@Input() label = ''
- @Input() className = undefined
- @Input() icon = undefined
- @Input() title = undefined
+ @Input() className: any = undefined
+ @Input() icon: any = undefined
+ @Input() title: any = undefined
getTitle () {
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 7abaacc26b..ea552663ac 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'
export class EditButtonComponent {
@Input() label: string
- @Input() routerLink = []
+ @Input() routerLink: any = []
}
diff --git a/client/src/app/shared/misc/help.component.ts b/client/src/app/shared/misc/help.component.ts
index ba0452e778..ccce1ccfa5 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 {
}
private createMarkdownList (rules: string[]) {
- const rulesToText = {
+ const rulesToText: any = {
'emphasis': this.i18n('Emphasis'),
'link': this.i18n('Links'),
'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 260f994b64..fb5c45acf8 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 {
[key: string]: any
[index: number]: string
- getItem (key) {
+ getItem (key: any) {
const stringKey = String(key)
if (valuesMap.has(key)) {
return String(valuesMap.get(stringKey))
@@ -15,11 +15,11 @@ class MemoryStorage {
return null
}
- setItem (key, val) {
+ setItem (key: any, val: any) {
valuesMap.set(String(key), String(val))
}
- removeItem (key) {
+ removeItem (key: any) {
valuesMap.delete(key)
}
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts
index c8b7ebc67b..78be2e5dda 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) {
return fd
}
-function lineFeedToHtml (obj: object, keyToNormalize: string) {
+function lineFeedToHtml (obj: any, keyToNormalize: string) {
return immutableAssign(obj, {
[keyToNormalize]: obj[keyToNormalize].replace(/\r?\n|\r/g, '<br />')
})
diff --git a/client/src/app/shared/overview/videos-overview.model.ts b/client/src/app/shared/overview/videos-overview.model.ts
index cf02bdb3de..c8eafc8e81 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 {
tag: string
videos: Video[]
}[]
+ [key: string]: any
}
diff --git a/client/src/app/shared/rest/rest-extractor.service.ts b/client/src/app/shared/rest/rest-extractor.service.ts
index 6492aa66de..934f6c618a 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 {
return this.applyToResultListData(result, this.convertDateToHuman, [ fieldsToConvert ])
}
- convertDateToHuman (target: object, fieldsToConvert: string[]) {
+ convertDateToHuman (target: any, fieldsToConvert: string[]) {
fieldsToConvert.forEach(field => target[field] = dateToHuman(target[field]))
return target
@@ -83,7 +83,7 @@ export class RestExtractor {
errorMessage = err
}
- const errorObj = {
+ const errorObj: any = {
message: errorMessage,
status: undefined,
body: undefined
diff --git a/client/src/app/shared/rest/rest.service.ts b/client/src/app/shared/rest/rest.service.ts
index 4560c20249..41824a18f8 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 {
return newParams
}
- addObjectParams (params: HttpParams, object: object) {
+ addObjectParams (params: HttpParams, object: any) {
for (const name of Object.keys(object)) {
const value = object[name]
if (!value) continue
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index 7c840ffa70..e6b6120541 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 {
blocked: boolean
blockedReason?: string
+ [key: string]: any
constructor (hash: UserConstructorHash) {
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 1f43f974c3..87814d4ba1 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 {
sort: VideoSortField = '-publishedAt'
categoryOneOf?: number
defaultSort: VideoSortField = '-publishedAt'
- syndicationItems = []
+ syndicationItems: any = []
loadOnInit = true
marginContent = true
@@ -59,7 +59,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
private resizeSubscription: Subscription
abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}>
- abstract generateSyndicationList ()
+ abstract generateSyndicationList (): any
get user () {
return this.authService.getUser()
@@ -209,7 +209,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
}
protected setNewRouteParams () {
- const paramsObject = this.buildRouteParams()
+ const paramsObject: any = this.buildRouteParams()
const queryParams = Object.keys(paramsObject).map(p => p + '=' + paramsObject[p]).join('&')
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 0046be9645..a62277e045 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 {
uuid?: string
id?: number
scheduleUpdate?: VideoScheduleUpdate
+ [key: string]: any
constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) {
if (video) {
@@ -49,7 +50,7 @@ export class VideoEdit implements VideoUpdate {
}
}
- patch (values: Object) {
+ patch (values: any) {
Object.keys(values).forEach((key) => {
this[ key ] = values[ key ]
})
diff --git a/client/src/app/shared/video/video-feed.component.ts b/client/src/app/shared/video/video-feed.component.ts
index 6922153c0d..be6c80c3fa 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'
templateUrl: './video-feed.component.html'
})
export class VideoFeedComponent {
- @Input() syndicationItems
+ @Input() syndicationItems: any
}
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index 724a0bde94..6283cf84d8 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 {
return this.authHttp
.get(environment.apiUrl + descriptionPath)
.pipe(
- map(res => res[ 'description' ]),
+ map((res: any) => res[ 'description' ]),
catchError(err => this.restExtractor.handleError(err))
)
}
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 07c33030aa..a2c9237ad2 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
@ViewChild('modal') modal: ElementRef
- videoCaptionLanguages = []
+ videoCaptionLanguages: any = []
private openedModal: NgbModalRef
private closingModal = false
@@ -73,7 +73,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni
this.hide()
const languageId = this.form.value[ 'language' ]
- const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId)
+ const languageObject = this.videoCaptionLanguages.find((l: any) => l.id === languageId)
this.captionAdded.emit({
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 eb9396d70b..a56733e575 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 {
calendarTimezone: string
calendarDateFormat: string
- private schedulerInterval
+ private schedulerInterval: any
private firstPatchDone = false
private initialVideoCaptions: string[] = []
@@ -77,13 +77,13 @@ export class VideoEditComponent implements OnInit, OnDestroy {
}
updateForm () {
- const defaultValues = {
+ const defaultValues: any = {
nsfw: 'false',
commentsEnabled: 'true',
waitTranscoding: 'true',
tags: []
}
- const obj = {
+ const obj: any = {
name: this.videoValidatorsService.VIDEO_NAME,
privacy: this.videoValidatorsService.VIDEO_PRIVACY,
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 0f7184ff8e..9a50e2ab2b 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'
})
export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate {
@Output() firstStepDone = new EventEmitter<string>()
- @ViewChild('torrentfileInput') torrentfileInput
+ @ViewChild('torrentfileInput') torrentfileInput: any
videoFileName: string
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 6d1bac3f23..cf9d47cbe0 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
protected videoService: VideoService
protected videoCaptionService: VideoCaptionService
- abstract canDeactivate ()
+ abstract canDeactivate (): any
ngOnInit () {
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 941dc5441e..fa6ee0c23e 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'
})
export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate {
@Output() firstStepDone = new EventEmitter<string>()
- @ViewChild('videofileInput') videofileInput
+ @ViewChild('videofileInput') videofileInput: any
// So that it can be accessed in the template
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 3f4072efd2..9ad419a69b 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 @@
import { Injectable } from '@angular/core'
import { getAbsoluteAPIUrl } from '@app/shared/misc/utils'
-import * as linkify from 'linkifyjs'
-import * as linkifyHtml from 'linkifyjs/html'
+const linkify = require('linkifyjs')
+const linkifyHtml = require('linkifyjs/html')
@Injectable()
export class LinkifierService {
@@ -40,7 +40,7 @@ export class LinkifierService {
const TT_UNDERSCORE = TT.UNDERSCORE
const TT_DOT = TT.DOT
- function MENTION (value) {
+ function MENTION (value: any) {
this.v = value
}
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 fb7de0e048..ba3c0398ec 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 {
this.formValidated()
}
- openVisitorModal (event) {
+ openVisitorModal (event: any) {
if (this.user === null) { // we only open it for visitors
// fixing ng-bootstrap ModalService and the "Expression Changed After It Has Been Checked" Error
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 e90008de9b..9824707860 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 {
@Output() resetReply = new EventEmitter()
sanitizedCommentHTML = ''
- newParentComments = []
+ newParentComments: any = []
constructor (
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 fe591811ee..824fb24c30 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 {
account: AccountInterface
totalReplies: number
by: string
- accountAvatarUrl
+ accountAvatarUrl: string
constructor (hash: VideoCommentServerModel) {
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 9bcb4b7de9..7d9c2d0ad8 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 {
return this.authHttp.post(url, normalizedComment)
.pipe(
- map(data => this.extractVideoComment(data['comment'])),
+ map((data: any) => this.extractVideoComment(data['comment'])),
catchError(err => this.restExtractor.handleError(err))
)
}
@@ -43,7 +43,7 @@ export class VideoCommentService {
return this.authHttp.post(url, normalizedComment)
.pipe(
- map(data => this.extractVideoComment(data[ 'comment' ])),
+ map((data: any) => this.extractVideoComment(data[ 'comment' ])),
catchError(err => this.restExtractor.handleError(err))
)
}
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 c864d82b70..4c1bdf2dd8 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 {
threadComments: { [ id: number ]: VideoCommentThreadTree } = {}
threadLoading: { [ id: number ]: boolean } = {}
- syndicationItems = []
+ syndicationItems: any = []
private sub: Subscription
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 c5deddf050..ed5e723c93 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
import { MetaService } from '@ngx-meta/core'
import { NotificationsService } from 'angular2-notifications'
import { forkJoin, Subscription } from 'rxjs'
-import * as videojs from 'video.js'
+const videojs = require('video.js')
import 'videojs-hotkeys'
import { Hotkey, HotkeysService } from 'angular2-hotkeys'
import * as WebTorrent from 'webtorrent'
@@ -45,7 +45,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
@ViewChild('videoBlacklistModal') videoBlacklistModal: VideoBlacklistComponent
@ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent
- player: videojs.Player
+ player: any
playerElement: HTMLVideoElement
userRating: UserVideoRateType = null
video: VideoDetails = null
@@ -435,7 +435,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
this.zone.runOutsideAngular(async () => {
videojs(this.playerElement, videojsOptions, function () {
self.player = this
- this.on('customError', (event, data) => self.handleError(data.err))
+ this.on('customError', (data: any) => self.handleError(data.err))
addContextMenu(self.player, self.video.embedUrl)
})
@@ -448,7 +448,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
this.checkUserRating()
}
- private setRating (nextRating) {
+ private setRating (nextRating: string) {
let method
switch (nextRating) {
case 'like':
@@ -466,11 +466,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
.subscribe(
() => {
// Update the video like attribute
- this.updateVideoRating(this.userRating, nextRating)
- this.userRating = nextRating
+ this.updateVideoRating(this.userRating, nextRating as VideoRateType)
+ this.userRating = nextRating as UserVideoRateType
},
- err => this.notificationsService.error(this.i18n('Error'), err.message)
+ (err: any) => this.notificationsService.error(this.i18n('Error'), err.message)
)
}
diff --git a/client/src/assets/player/peertube-chunk-store.ts b/client/src/assets/player/peertube-chunk-store.ts
index 767e468219..ac3f9e6548 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 {
// If the store is full
private memoryChunks: { [ id: number ]: Buffer | true } = {}
private databaseName: string
- private putBulkTimeout
- private cleanerInterval
+ private putBulkTimeout: any
+ private cleanerInterval: any
private db: ChunkDatabase
private expirationDB: ExpirationDatabase
private readonly length: number
private readonly lastChunkLength: number
private readonly lastChunkIndex: number
- constructor (chunkLength: number, opts) {
+ constructor (chunkLength: number, opts: any) {
super()
this.databaseName = 'webtorrent-chunks-'
@@ -113,13 +113,13 @@ export class PeertubeChunkStore extends EventEmitter {
}, PeertubeChunkStore.BUFFERING_PUT_MS)
}
- get (index: number, opts, cb) {
+ get (index: number, opts: any, cb: any): any {
if (typeof opts === 'function') return this.get(index, null, opts)
// IndexDB could be slow, use our memory index first
const memoryChunk = this.memoryChunks[index]
if (memoryChunk === undefined) {
- const err = new Error('Chunk not found')
+ const err = new Error('Chunk not found') as any
err['notFound'] = true
return process.nextTick(() => cb(err))
@@ -146,11 +146,11 @@ export class PeertubeChunkStore extends EventEmitter {
})
}
- close (db) {
+ close (db: any) {
return this.destroy(db)
}
- async destroy (cb) {
+ async destroy (cb: any) {
try {
if (this.pendingPut) {
clearTimeout(this.putBulkTimeout)
@@ -225,7 +225,7 @@ export class PeertubeChunkStore extends EventEmitter {
}
}
- private nextTick (cb, err, val?) {
+ private nextTick (cb: any, err: Error, val?: any) {
process.nextTick(() => cb(err, val), undefined)
}
}
diff --git a/client/src/assets/player/peertube-link-button.ts b/client/src/assets/player/peertube-link-button.ts
index 715207bc07..b03952b476 100644
--- a/client/src/assets/player/peertube-link-button.ts
+++ b/client/src/assets/player/peertube-link-button.ts
@@ -1,11 +1,10 @@
-import * as videojs from 'video.js'
import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
import { buildVideoLink } from './utils'
const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button')
class PeerTubeLinkButton extends Button {
- constructor (player: videojs.Player, options) {
+ constructor (player: any, options: any) {
super(player, options)
}
diff --git a/client/src/assets/player/peertube-load-progress-bar.ts b/client/src/assets/player/peertube-load-progress-bar.ts
index aedc641e4a..ee8a6cd81c 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
class PeerTubeLoadProgressBar extends Component {
- constructor (player, options) {
+ constructor (player: any, options: any) {
super(player, options)
this.partEls_ = []
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 792662b6c1..ef9e7fcc06 100644
--- a/client/src/assets/player/peertube-player.ts
+++ b/client/src/assets/player/peertube-player.ts
@@ -75,12 +75,12 @@ function getVideojsOptions (options: {
enableVolumeScroll: false,
enableModifiersForNumbers: false,
- fullscreenKey: function (event) {
+ fullscreenKey: function (event: any) {
// fullscreen with the f key or Ctrl+Enter
return event.key === 'f' || (event.ctrlKey && event.key === 'Enter')
},
- seekStep: function (event) {
+ seekStep: function (event: any) {
// mimic VLC seek behavior, and default to 5 (original value is 5).
if (event.ctrlKey && event.altKey) {
return 5 * 60
@@ -95,26 +95,26 @@ function getVideojsOptions (options: {
customKeys: {
increasePlaybackRateKey: {
- key: function (event) {
+ key: function (event: any) {
return event.key === '>'
},
- handler: function (player) {
+ handler: function (player: any) {
player.playbackRate((player.playbackRate() + 0.1).toFixed(2))
}
},
decreasePlaybackRateKey: {
- key: function (event) {
+ key: function (event: any) {
return event.key === '<'
},
- handler: function (player) {
+ handler: function (player: any) {
player.playbackRate((player.playbackRate() - 0.1).toFixed(2))
}
},
frameByFrame: {
- key: function (event) {
+ key: function (event: any) {
return event.key === '.'
},
- handler: function (player, options, event) {
+ handler: function (player: any) {
player.pause()
// Calculate movement distance (assuming 30 fps)
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 5cebab6d9a..03def186e5 100644
--- a/client/src/assets/player/peertube-videojs-plugin.ts
+++ b/client/src/assets/player/peertube-videojs-plugin.ts
@@ -1,11 +1,11 @@
-import * as videojs from 'video.js'
+const videojs = require('video.js')
import * as WebTorrent from 'webtorrent'
import { VideoFile } from '../../../../shared/models/videos/video.model'
import { renderVideo } from './video-renderer'
import './settings-menu-button'
import { PeertubePluginOptions, UserWatching, VideoJSCaption, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
import { isMobile, timeToInt, videoFileMaxByResolution, videoFileMinByResolution } from './utils'
-import * as CacheChunkStore from 'cache-chunk-store'
+const CacheChunkStore = require('cache-chunk-store')
import { PeertubeChunkStore } from './peertube-chunk-store'
import {
getAverageBandwidthInStore,
@@ -61,11 +61,11 @@ class PeerTubePlugin extends Plugin {
private player: any
private currentVideoFile: VideoFile
- private torrent: WebTorrent.Torrent
+ private torrent: any
private videoCaptions: VideoJSCaption[]
- private renderer
- private fakeRenderer
+ private renderer: any
+ private fakeRenderer: any
private destoyingFakeRenderer = false
private autoResolution = true
@@ -73,17 +73,17 @@ class PeerTubePlugin extends Plugin {
private isAutoResolutionObservation = false
private playerRefusedP2P = false
- private videoViewInterval
- private torrentInfoInterval
- private autoQualityInterval
- private userWatchingVideoInterval
- private addTorrentDelay
- private qualityObservationTimer
- private runAutoQualitySchedulerTimer
+ private videoViewInterval: any
+ private torrentInfoInterval: any
+ private autoQualityInterval: any
+ private userWatchingVideoInterval: any
+ private addTorrentDelay: any
+ private qualityObservationTimer: any
+ private runAutoQualitySchedulerTimer: any
private downloadSpeeds: number[] = []
- constructor (player: videojs.Player, options: PeertubePluginOptions) {
+ constructor (player: any, options: PeertubePluginOptions) {
super(player, options)
// Disable auto play on iOS
@@ -273,7 +273,7 @@ class PeerTubePlugin extends Plugin {
const oldTorrent = this.torrent
const torrentOptions = {
- store: (chunkLength, storeOpts) => new CacheChunkStore(new PeertubeChunkStore(chunkLength, storeOpts), {
+ store: (chunkLength: any, storeOpts: any) => new CacheChunkStore(new PeertubeChunkStore(chunkLength, storeOpts), {
max: 100
})
}
@@ -304,7 +304,7 @@ class PeerTubePlugin extends Plugin {
if (err) return this.fallbackToHttp(options, done)
- return this.tryToPlay(err => {
+ return this.tryToPlay((err: Error) => {
if (err) return done(err)
if (options.seek) this.seek(options.seek)
@@ -316,7 +316,7 @@ class PeerTubePlugin extends Plugin {
}, options.delay || 0)
})
- this.torrent.on('error', err => console.error(err))
+ this.torrent.on('error', (err: any) => console.error(err))
this.torrent.on('warning', (err: any) => {
// 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 {
const playPromise = this.player.play()
if (playPromise !== undefined) {
return playPromise.then(done)
- .catch(err => {
+ .catch((err: Error) => {
if (err.message.indexOf('The play() request was interrupted by a call to pause()') !== -1) {
return
}
@@ -627,7 +627,7 @@ class PeerTubePlugin extends Plugin {
this.player.options_.inactivityTimeout = saveInactivityTimeout
}
- const settingsDialog = this.player.children_.find(c => c.name_ === 'SettingsDialog')
+ const settingsDialog = this.player.children_.find((c: any) => c.name_ === 'SettingsDialog')
this.player.controlBar.on('mouseenter', () => disableInactivity())
settingsDialog.on('mouseenter', () => disableInactivity())
@@ -641,7 +641,7 @@ class PeerTubePlugin extends Plugin {
return this.videoFiles[Math.floor(this.videoFiles.length / 2)]
}
- private stopTorrent (torrent: WebTorrent.Torrent) {
+ private stopTorrent (torrent: any) {
torrent.pause()
// Pause does not remove actual peers (in particular the webseed peer)
torrent.removePeer(torrent[ 'ws' ])
@@ -703,7 +703,7 @@ class PeerTubePlugin extends Plugin {
const percent = time / this.player_.duration()
return percent >= 1 ? 1 : percent
}
- SeekBar.prototype.handleMouseMove = function handleMouseMove (event) {
+ SeekBar.prototype.handleMouseMove = function handleMouseMove (event: any) {
let newTime = this.calculateDistance(event) * this.player_.duration()
if (newTime === this.player_.duration()) {
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 b117007aff..98a33077d2 100644
--- a/client/src/assets/player/peertube-videojs-typings.ts
+++ b/client/src/assets/player/peertube-videojs-typings.ts
@@ -1,4 +1,4 @@
-import * as videojs from 'video.js'
+const videojs = require('video.js')
import { VideoFile } from '../../../../shared/models/videos/video.model'
import { PeerTubePlugin } from './peertube-videojs-plugin'
@@ -11,9 +11,9 @@ declare namespace videojs {
interface VideoJSComponentInterface {
_player: videojs.Player
- new (player: videojs.Player, options?: any)
+ new (player: videojs.Player, options?: any): any
- registerComponent (name: string, obj: any)
+ registerComponent (name: string, obj: any): any
}
type VideoJSCaption = {
diff --git a/client/src/assets/player/resolution-menu-button.ts b/client/src/assets/player/resolution-menu-button.ts
index d53a241519..91818efc94 100644
--- a/client/src/assets/player/resolution-menu-button.ts
+++ b/client/src/assets/player/resolution-menu-button.ts
@@ -1,4 +1,3 @@
-import * as videojs from 'video.js'
import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
import { ResolutionMenuItem } from './resolution-menu-item'
@@ -7,7 +6,7 @@ const MenuButton: VideoJSComponentInterface = videojsUntyped.getComponent('MenuB
class ResolutionMenuButton extends MenuButton {
label: HTMLElement
- constructor (player: videojs.Player, options) {
+ constructor (player: any, options: any) {
super(player, options)
this.player = player
diff --git a/client/src/assets/player/resolution-menu-item.ts b/client/src/assets/player/resolution-menu-item.ts
index 0ab0f53b54..afe490abbf 100644
--- a/client/src/assets/player/resolution-menu-item.ts
+++ b/client/src/assets/player/resolution-menu-item.ts
@@ -1,10 +1,9 @@
-import * as videojs from 'video.js'
import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem')
class ResolutionMenuItem extends MenuItem {
- constructor (player: videojs.Player, options) {
+ constructor (player: any, options: any) {
const currentResolutionId = player.peertube().getCurrentResolutionId()
options.selectable = true
options.selected = options.id === currentResolutionId
@@ -18,7 +17,7 @@ class ResolutionMenuItem extends MenuItem {
player.peertube().on('autoResolutionUpdate', () => this.updateSelection())
}
- handleClick (event) {
+ handleClick (event: any) {
if (this.id === -1 && this.player_.peertube().isAutoResolutionForbidden()) return
super.handleClick(event)
diff --git a/client/src/assets/player/settings-menu-button.ts b/client/src/assets/player/settings-menu-button.ts
index b51c52506b..f0ccb5862b 100644
--- a/client/src/assets/player/settings-menu-button.ts
+++ b/client/src/assets/player/settings-menu-button.ts
@@ -1,7 +1,7 @@
// Author: Yanko Shterev
// Thanks https://github.com/yshterev/videojs-settings-menu
-import * as videojs from 'video.js'
+const videojs = require('video.js')
import { SettingsMenuItem } from './settings-menu-item'
import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
import { toTitleCase } from './utils'
@@ -11,7 +11,7 @@ const Menu: VideoJSComponentInterface = videojsUntyped.getComponent('Menu')
const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Component')
class SettingsButton extends Button {
- constructor (player: videojs.Player, options) {
+ constructor (player: any, options: any) {
super(player, options)
this.playerComponent = player
@@ -48,7 +48,7 @@ class SettingsButton extends Button {
}
}
- onDisposeSettingsItem (event, name: string) {
+ onDisposeSettingsItem (name: string) {
if (name === undefined) {
let children = this.menu.children()
@@ -74,7 +74,7 @@ class SettingsButton extends Button {
}
}
- onAddSettingsItem (event, data) {
+ onAddSettingsItem (data: any) {
const [ entry, options ] = data
this.addMenuItem(entry, options)
@@ -120,7 +120,7 @@ class SettingsButton extends Button {
this.resetChildren()
}
- getComponentSize (element) {
+ getComponentSize (element: any) {
let width: number = null
let height: number = null
@@ -178,7 +178,7 @@ class SettingsButton extends Button {
this.panelChild.addChild(this.menu)
}
- addMenuItem (entry, options) {
+ addMenuItem (entry: any, options: any) {
const openSubMenu = function () {
if (videojsUntyped.dom.hasClass(this.el_, 'open')) {
videojsUntyped.dom.removeClass(this.el_, 'open')
@@ -218,7 +218,7 @@ class SettingsButton extends Button {
}
class SettingsPanel extends Component {
- constructor (player: videojs.Player, options) {
+ constructor (player: any, options: any) {
super(player, options)
}
@@ -232,7 +232,7 @@ class SettingsPanel extends Component {
}
class SettingsPanelChild extends Component {
- constructor (player: videojs.Player, options) {
+ constructor (player: any, options: any) {
super(player, options)
}
@@ -246,7 +246,7 @@ class SettingsPanelChild extends Component {
}
class SettingsDialog extends Component {
- constructor (player: videojs.Player, options) {
+ constructor (player: any, options: any) {
super(player, options)
this.hide()
}
diff --git a/client/src/assets/player/settings-menu-item.ts b/client/src/assets/player/settings-menu-item.ts
index 665ce6fc20..2d752b62ed 100644
--- a/client/src/assets/player/settings-menu-item.ts
+++ b/client/src/assets/player/settings-menu-item.ts
@@ -1,7 +1,6 @@
// Author: Yanko Shterev
// Thanks https://github.com/yshterev/videojs-settings-menu
-import * as videojs from 'video.js'
import { toTitleCase } from './utils'
import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
@@ -10,7 +9,7 @@ const component: VideoJSComponentInterface = videojsUntyped.getComponent('Compon
class SettingsMenuItem extends MenuItem {
- constructor (player: videojs.Player, options, entry: string, menuButton: VideoJSComponentInterface) {
+ constructor (player: any, options: any, entry: string, menuButton: VideoJSComponentInterface) {
super(player, options)
this.settingsButton = menuButton
@@ -55,7 +54,7 @@ class SettingsMenuItem extends MenuItem {
this.transitionEndHandler = this.onTransitionEnd.bind(this)
}
- onSubmenuClick (event) {
+ onSubmenuClick (event: any) {
let target = null
if (event.type === 'tap') {
@@ -150,7 +149,7 @@ class SettingsMenuItem extends MenuItem {
*
* @method PrefixedEvent
*/
- PrefixedEvent (element, type, callback, action = 'addEvent') {
+ PrefixedEvent (element: any, type: any, callback: any, action = 'addEvent') {
let prefix = ['webkit', 'moz', 'MS', 'o', '']
for (let p = 0; p < prefix.length; p++) {
@@ -166,7 +165,7 @@ class SettingsMenuItem extends MenuItem {
}
}
- onTransitionEnd (event) {
+ onTransitionEnd (event: any) {
if (event.propertyName !== 'margin-right') {
return
}
@@ -229,7 +228,7 @@ class SettingsMenuItem extends MenuItem {
)
}
- update (event?: Event) {
+ update (event?: any) {
let target = null
let subMenu = this.subMenu.name()
diff --git a/client/src/assets/player/theater-button.ts b/client/src/assets/player/theater-button.ts
index 5cf0b64255..b761f6030d 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 {
private static readonly THEATER_MODE_CLASS = 'vjs-theater-enabled'
- constructor (player, options) {
+ constructor (player: any, options: any) {
super(player, options)
const enabled = getStoredTheater()
diff --git a/client/src/assets/player/utils.ts b/client/src/assets/player/utils.ts
index cf4f60f558..46081c0d2e 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}> = [
{ max: 1073741824, type: 'MB' },
{ max: 1.0995116e12, type: 'GB' }
]
-function bytes (value) {
+function bytes (value: any) {
const format = dictionaryBytes.find(d => value < d.max) || dictionaryBytes[dictionaryBytes.length - 1]
const calc = Math.floor(value / (format.max / 1024)).toString()
diff --git a/client/src/assets/player/video-renderer.ts b/client/src/assets/player/video-renderer.ts
index 2cb05a4482..a3415937b9 100644
--- a/client/src/assets/player/video-renderer.ts
+++ b/client/src/assets/player/video-renderer.ts
@@ -1,9 +1,9 @@
// Thanks: https://github.com/feross/render-media
// TODO: use render-media once https://github.com/feross/render-media/issues/32 is fixed
-import * as MediaElementWrapper from 'mediasource'
+const MediaElementWrapper = require('mediasource')
import { extname } from 'path'
-import * as videostream from 'videostream'
+const videostream = require('videostream')
const VIDEOSTREAM_EXTS = [
'.m4a',
@@ -17,7 +17,7 @@ type RenderMediaOptions = {
}
function renderVideo (
- file,
+ file: any,
elem: HTMLVideoElement,
opts: RenderMediaOptions,
callback: (err: Error, renderer: any) => void
@@ -27,11 +27,11 @@ function renderVideo (
return renderMedia(file, elem, opts, callback)
}
-function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, callback: (err: Error, renderer?: any) => void) {
+function renderMedia (file: any, elem: HTMLVideoElement, opts: RenderMediaOptions, callback: (err: Error, renderer?: any) => void) {
const extension = extname(file.name).toLowerCase()
- let preparedElem = undefined
+ let preparedElem: any = undefined
let currentTime = 0
- let renderer
+ let renderer: any
try {
if (VIDEOSTREAM_EXTS.indexOf(extension) >= 0) {
@@ -45,7 +45,7 @@ function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, ca
function useVideostream () {
prepareElem()
- preparedElem.addEventListener('error', function onError (err) {
+ preparedElem.addEventListener('error', function onError (err: Error) {
preparedElem.removeEventListener('error', onError)
return callback(err)
@@ -58,7 +58,7 @@ function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, ca
const codecs = getCodec(file.name, useVP9)
prepareElem()
- preparedElem.addEventListener('error', function onError (err) {
+ preparedElem.addEventListener('error', function onError (err: Error) {
preparedElem.removeEventListener('error', onError)
// Try with vp9 before returning an error
@@ -102,7 +102,7 @@ function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, ca
}
}
-function validateFile (file) {
+function validateFile (file: any) {
if (file == null) {
throw new Error('file cannot be null or undefined')
}
diff --git a/client/src/assets/player/webtorrent-info-button.ts b/client/src/assets/player/webtorrent-info-button.ts
index deef253cea..5b9d0a4013 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 {
subDivHttp.appendChild(subDivHttpText)
div.appendChild(subDivHttp)
- this.player_.peertube().on('torrentInfo', (event, data) => {
+ this.player_.peertube().on('torrentInfo', (data: any) => {
// We are in HTTP fallback
if (!data) {
subDivHttp.className = 'vjs-peertube-displayed'
diff --git a/client/src/main.ts b/client/src/main.ts
index f456e89c5d..dee9621808 100644
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -8,7 +8,7 @@ import { hmrBootstrap } from './hmr'
import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils'
import { buildFileLocale } from '../../shared'
-let providers = []
+let providers: any[] = []
if (environment.production) {
enableProdMode()
}
diff --git a/client/src/polyfills.ts b/client/src/polyfills.ts
index eec30760df..dfe45b5911 100644
--- a/client/src/polyfills.ts
+++ b/client/src/polyfills.ts
@@ -18,24 +18,26 @@
* BROWSER POLYFILLS
*/
-/** IE9, IE10 and IE11 requires all of the following polyfills. **/
+/**
+ * IE9, IE10 and IE11 requires all of the following polyfills.
+ */
// For Google Bot
-import 'core-js/es6/symbol';
-import 'core-js/es6/object';
-import 'core-js/es6/function';
-import 'core-js/es6/parse-int';
-import 'core-js/es6/parse-float';
-import 'core-js/es6/number';
-import 'core-js/es6/math';
-import 'core-js/es6/string';
-import 'core-js/es6/date';
-import 'core-js/es6/array';
-import 'core-js/es6/regexp';
-import 'core-js/es6/map';
-import 'core-js/es6/weak-map';
-import 'core-js/es6/set';
-import 'core-js/es7/object';
+import 'core-js/es6/symbol'
+import 'core-js/es6/object'
+import 'core-js/es6/function'
+import 'core-js/es6/parse-int'
+import 'core-js/es6/parse-float'
+import 'core-js/es6/number'
+import 'core-js/es6/math'
+import 'core-js/es6/string'
+import 'core-js/es6/date'
+import 'core-js/es6/array'
+import 'core-js/es6/regexp'
+import 'core-js/es6/map'
+import 'core-js/es6/weak-map'
+import 'core-js/es6/set'
+import 'core-js/es7/object'
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
@@ -43,17 +45,18 @@ import 'core-js/es7/object';
/** IE10 and IE11 requires the following for the Reflect API. */
// For Google Bot
-import 'core-js/es6/reflect';
+import 'core-js/es6/reflect'
-/** Evergreen browsers require these. **/
+/**
+ * Evergreen browsers require these.
+ */
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect'
-
/**
* Required to support Web Animations `@angular/platform-browser/animations`.
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
- **/
+ */
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/**
@@ -70,19 +73,17 @@ import 'core-js/es7/reflect'
*/
// (window as any).__Zone_enable_cross_context_check = true;
-
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone' // Included with Angular CLI.
-
/***************************************************************************************************
* APPLICATION IMPORTS
*/
// global/process polyfills
-;(window as any).global = window;
-;(window as any).process = require('process/');
-;(window as any).Buffer = require('buffer/').Buffer;
+;(window as any).global = window
+;(window as any).process = require('process/')
+;(window as any).Buffer = require('buffer/').Buffer
diff --git a/client/src/shims/noop.ts b/client/src/shims/noop.ts
index 899b69bf3a..086a60e32b 100644
--- a/client/src/shims/noop.ts
+++ b/client/src/shims/noop.ts
@@ -1,3 +1,3 @@
// Does nothing. Used to shim out node.js modules
// which are no-ops in the browser.
-export const NOOP = 0
\ No newline at end of file
+export const NOOP = 0
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts
index ea3436c7c8..e5a2d208a3 100644
--- a/client/src/standalone/videos/embed.ts
+++ b/client/src/standalone/videos/embed.ts
@@ -17,7 +17,7 @@ import 'core-js/es6/set'
// For google bot that uses Chrome 41 and does not understand fetch
import 'whatwg-fetch'
-import * as vjs from 'video.js'
+const vjs = require('video.js')
import * as Channel from 'jschannel'
import { peertubeTranslate, ResultList, VideoDetails } from '../../../../shared'
@@ -304,7 +304,7 @@ class PeerTubeEmbed {
this.playerOptions = videojsOptions
this.player = vjs(this.videoContainerId, videojsOptions, () => {
- this.player.on('customError', (event, data) => this.handleError(data.err))
+ this.player.on('customError', (data: any) => this.handleError(data.err))
window[ 'videojsPlayer' ] = this.player
diff --git a/client/src/standalone/videos/test-embed.ts b/client/src/standalone/videos/test-embed.ts
index dba331e90b..b750c2ee6a 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 () => {
updateRates()
})
- let updateResolutions = resolutions => {
+ let updateResolutions = ((resolutions: any) => {
let resolutionListEl = document.querySelector('#resolution-list')
resolutionListEl.innerHTML = ''
- resolutions.forEach(resolution => {
+ resolutions.forEach((resolution: any) => {
if (resolution.active) {
let itemEl = document.createElement('strong')
itemEl.innerText = `${resolution.label} (active)`
@@ -87,7 +87,7 @@ window.addEventListener('load', async () => {
resolutionListEl.appendChild(itemEl)
}
})
- }
+ })
player.getResolutions().then(
resolutions => updateResolutions(resolutions))
diff --git a/client/src/typings.d.ts b/client/src/typings.d.ts
index ef5c7bd620..9615434ac6 100644
--- a/client/src/typings.d.ts
+++ b/client/src/typings.d.ts
@@ -2,4 +2,5 @@
declare var module: NodeModule;
interface NodeModule {
id: string;
+ [key: string]: any
}
diff --git a/client/tsconfig.json b/client/tsconfig.json
index 431ea7d91b..ef80445db0 100644
--- a/client/tsconfig.json
+++ b/client/tsconfig.json
@@ -7,7 +7,8 @@
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
- "noImplicitAny": false,
+ "noImplicitAny": true,
+ "suppressImplicitAnyIndexErrors":true,
"alwaysStrict": true,
"target": "es5",
"typeRoots": [
diff --git a/shared/models/i18n/i18n.ts b/shared/models/i18n/i18n.ts
index 5c3249452e..9278c043b6 100644
--- a/shared/models/i18n/i18n.ts
+++ b/shared/models/i18n/i18n.ts
@@ -1,6 +1,6 @@
export const LOCALE_FILES = [ 'player', 'server' ]
-export const I18N_LOCALES = {
+export const I18N_LOCALES: any = {
'en-US': 'English',
'fr-FR': 'Français',
'eu-ES': 'Euskara',
@@ -17,7 +17,7 @@ export const I18N_LOCALES = {
'zh-Hans-CN': '简体中文(中国)'
}
-const I18N_LOCALE_ALIAS = {
+const I18N_LOCALE_ALIAS: any = {
'en': 'en-US',
'fr': 'fr-FR',
'eu': 'eu-ES',
diff --git a/shared/models/overviews/videos-overview.ts b/shared/models/overviews/videos-overview.ts
index ee009d94c7..8c87857634 100644
--- a/shared/models/overviews/videos-overview.ts
+++ b/shared/models/overviews/videos-overview.ts
@@ -15,4 +15,5 @@ export interface VideosOverview {
tag: string
videos: Video[]
}[]
+ [key: string]: any
}
diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts
index 3afd36fcdb..c5156d9f3a 100644
--- a/shared/models/server/custom-config.model.ts
+++ b/shared/models/server/custom-config.model.ts
@@ -55,6 +55,7 @@ export interface CustomConfig {
'480p': boolean
'720p': boolean
'1080p': boolean
+ [key: string]: boolean
}
}
diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts
index 8147dc48e8..06a6602063 100644
--- a/shared/models/users/user.model.ts
+++ b/shared/models/users/user.model.ts
@@ -20,4 +20,5 @@ export interface User {
blockedReason?: string
videoQuotaUsed?: number
+ [key: string]: any
}