Browse Source

tslint update

Chocobozzz 1 year ago
parent
commit
c47106315a
No account linked to committer's email address
26 changed files with 102 additions and 141 deletions
  1. 1
    1
      client/package.json
  2. 0
    1
      client/src/app/+accounts/accounts.component.ts
  3. 1
    1
      client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.html
  4. 1
    1
      client/src/app/shared/forms/form-reactive.ts
  5. 2
    2
      client/src/app/shared/misc/utils.ts
  6. 1
    1
      client/src/app/shared/renderer/markdown.service.ts
  7. 2
    2
      client/src/app/shared/video-playlist/video-playlist-element-miniature.component.html
  8. 1
    1
      client/src/app/shared/video-playlist/video-playlist-miniature.component.html
  9. 1
    1
      client/src/app/videos/+video-watch/video-watch.component.html
  10. 2
    2
      client/src/assets/player/p2p-media-loader/segment-url-builder.ts
  11. 2
    2
      client/src/assets/player/utils.ts
  12. 1
    1
      client/src/assets/player/videojs-components/resolution-menu-button.ts
  13. 9
    9
      client/src/assets/player/videojs-components/settings-menu-button.ts
  14. 5
    5
      client/src/assets/player/videojs-components/settings-menu-item.ts
  15. 3
    3
      client/src/assets/player/webtorrent/peertube-chunk-store.ts
  16. 1
    1
      client/src/assets/player/webtorrent/video-renderer.ts
  17. 1
    1
      client/src/assets/player/webtorrent/webtorrent-plugin.ts
  18. 1
    0
      client/src/polyfills.ts
  19. 1
    3
      client/src/standalone/player/definitions.ts
  20. 2
    2
      client/src/standalone/player/events.ts
  21. 6
    6
      client/src/standalone/videos/embed.ts
  22. 12
    12
      client/src/standalone/videos/test-embed.ts
  23. 1
    0
      client/tsconfig.json
  24. 6
    24
      client/tslint.json
  25. 18
    38
      client/yarn.lock
  26. 21
    21
      shared/models/videos/video-resolution.enum.ts

+ 1
- 1
client/package.json View File

@@ -73,7 +73,6 @@
73 73
     "bootstrap": "^4.1.3",
74 74
     "buffer": "^5.1.0",
75 75
     "cache-chunk-store": "^3.0.0",
76
-    "codelyzer": "^5.0.0",
77 76
     "core-js": "^3.0.0",
78 77
     "css-loader": "^2.1.1",
79 78
     "dexie": "^2.0.4",
@@ -118,6 +117,7 @@
118 117
     "stream-http": "^3.0.0",
119 118
     "terser-webpack-plugin": "^1.1.0",
120 119
     "tslint": "^5.7.0",
120
+    "tslint-angular": "^1.1.2",
121 121
     "tslint-config-standard": "^8.0.1",
122 122
     "typescript": "3.2",
123 123
     "video.js": "^7",

+ 0
- 1
client/src/app/+accounts/accounts.component.ts View File

@@ -7,7 +7,6 @@ import { catchError, distinctUntilChanged, map, switchMap, tap } from 'rxjs/oper
7 7
 import { Subscription } from 'rxjs'
8 8
 import { AuthService, Notifier, RedirectService } from '@app/core'
9 9
 import { User, UserRight } from '../../../../shared'
10
-import { I18n } from '@ngx-translate/i18n-polyfill'
11 10
 
12 11
 @Component({
13 12
   templateUrl: './accounts.component.html',

+ 1
- 1
client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.html View File

@@ -1,5 +1,5 @@
1 1
 <div i18n class="title-page title-page-single">
2
-  Created {{pagination.totalItems}} playlists
2
+  Created {{ pagination.totalItems }} playlists
3 3
 </div>
4 4
 
5 5
 <div i18n class="no-results" *ngIf="pagination.totalItems === 0">This channel does not have playlists.</div>

+ 1
- 1
client/src/app/shared/forms/form-reactive.ts View File

@@ -59,7 +59,7 @@ export abstract class FormReactive {
59 59
       const isDirty = control.dirty || forceCheck === true
60 60
       if (control && isDirty && !control.valid) {
61 61
         const messages = validationMessages[ field ]
62
-        for (const key in control.errors) {
62
+        for (const key of Object.keys(control.errors)) {
63 63
           formErrors[ field ] += messages[ key ] + ' '
64 64
         }
65 65
       }

+ 2
- 2
client/src/app/shared/misc/utils.ts View File

@@ -78,10 +78,10 @@ function objectToUrlEncoded (obj: any) {
78 78
 
79 79
 // Thanks: https://gist.github.com/ghinda/8442a57f22099bdb2e34
80 80
 function objectToFormData (obj: any, form?: FormData, namespace?: string) {
81
-  let fd = form || new FormData()
81
+  const fd = form || new FormData()
82 82
   let formKey
83 83
 
84
-  for (let key of Object.keys(obj)) {
84
+  for (const key of Object.keys(obj)) {
85 85
     if (namespace) formKey = `${namespace}[${key}]`
86 86
     else formKey = key
87 87
 

+ 1
- 1
client/src/app/shared/renderer/markdown.service.ts View File

@@ -45,7 +45,7 @@ export class MarkdownService {
45 45
 
46 46
     const markdownIt = new MarkdownItClass('zero', { linkify: true, breaks: true })
47 47
 
48
-    for (let rule of rules) {
48
+    for (const rule of rules) {
49 49
       markdownIt.enable(rule)
50 50
     }
51 51
 

+ 2
- 2
client/src/app/shared/video-playlist/video-playlist-element-miniature.component.html View File

@@ -19,7 +19,7 @@
19 19
       <a *ngIf="accountLink" tabindex="-1" class="video-info-account" [routerLink]="[ '/accounts', video.byAccount ]">{{ video.byAccount }}</a>
20 20
       <span *ngIf="!accountLink" tabindex="-1" class="video-info-account">{{ video.byAccount }}</span>
21 21
 
22
-      <span tabindex="-1" class="video-info-timestamp">{{ formatTimestamp(video)}}</span>
22
+      <span tabindex="-1" class="video-info-timestamp">{{ formatTimestamp(video) }}</span>
23 23
     </div>
24 24
   </a>
25 25
 
@@ -66,7 +66,7 @@
66 66
       </div>
67 67
 
68 68
       <span class="dropdown-item" (click)="removeFromPlaylist(video)">
69
-            <my-global-icon iconName="delete"></my-global-icon> <ng-container i18n>Delete from {{playlist?.displayName}}</ng-container>
69
+            <my-global-icon iconName="delete"></my-global-icon> <ng-container i18n>Delete from {{ playlist?.displayName }}</ng-container>
70 70
           </span>
71 71
     </div>
72 72
   </div>

+ 1
- 1
client/src/app/shared/video-playlist/video-playlist-miniature.component.html View File

@@ -6,7 +6,7 @@
6 6
     <img alt="" [attr.aria-labelledby]="playlist.displayName" [attr.src]="playlist.thumbnailUrl" />
7 7
 
8 8
     <div class="miniature-playlist-info-overlay">
9
-      <ng-container i18n>{playlist.videosLength, plural, =0 {No videos} =1 {1 video} other {{{playlist.videosLength}} videos}}</ng-container>
9
+      <ng-container i18n>{playlist.videosLength, plural, =0 {No videos} =1 {1 video} other {{{ playlist.videosLength }} videos}}</ng-container>
10 10
     </div>
11 11
 
12 12
     <div class="play-overlay">

+ 1
- 1
client/src/app/videos/+video-watch/video-watch.component.html View File

@@ -22,7 +22,7 @@
22 22
         <div class="playlist-by-index">
23 23
           <div class="playlist-by">{{ playlist.ownerBy }}</div>
24 24
           <div class="playlist-index">
25
-            <span>{{currentPlaylistPosition}}</span><span>{{playlistPagination.totalItems}}</span>
25
+            <span>{{ currentPlaylistPosition }}</span><span>{{ playlistPagination.totalItems }}</span>
26 26
           </div>
27 27
         </div>
28 28
       </div>

+ 2
- 2
client/src/assets/player/p2p-media-loader/segment-url-builder.ts View File

@@ -8,8 +8,8 @@ function segmentUrlBuilderFactory (baseUrls: string[]) {
8 8
 
9 9
     if (i === max - 1) return segment.url
10 10
 
11
-    let newBaseUrl = baseUrls[i]
12
-    let middlePart = newBaseUrl.endsWith('/') ? '' : '/'
11
+    const newBaseUrl = baseUrls[i]
12
+    const middlePart = newBaseUrl.endsWith('/') ? '' : '/'
13 13
 
14 14
     return newBaseUrl + middlePart + basename(segment.url)
15 15
   }

+ 2
- 2
client/src/assets/player/utils.ts View File

@@ -61,12 +61,12 @@ function secondsToTime (seconds: number, full = false, symbol?: string) {
61 61
   const minuteSymbol = (symbol || 'm')
62 62
   const secondsSymbol = full ? '' : 's'
63 63
 
64
-  let hours = Math.floor(seconds / 3600)
64
+  const hours = Math.floor(seconds / 3600)
65 65
   if (hours >= 1) time = hours + hourSymbol
66 66
   else if (full) time = '0' + hourSymbol
67 67
 
68 68
   seconds %= 3600
69
-  let minutes = Math.floor(seconds / 60)
69
+  const minutes = Math.floor(seconds / 60)
70 70
   if (minutes >= 1 && minutes < 10 && full) time += '0' + minutes + minuteSymbol
71 71
   else if (minutes >= 1) time += minutes + minuteSymbol
72 72
   else if (full) time += '00' + minuteSymbol

+ 1
- 1
client/src/assets/player/videojs-components/resolution-menu-button.ts View File

@@ -49,7 +49,7 @@ class ResolutionMenuButton extends MenuButton {
49 49
 
50 50
   private addClickListener (component: any) {
51 51
     component.on('click', () => {
52
-      let children = this.menu.children()
52
+      const children = this.menu.children()
53 53
 
54 54
       for (const child of children) {
55 55
         if (component !== child) {

+ 9
- 9
client/src/assets/player/videojs-components/settings-menu-button.ts View File

@@ -53,7 +53,7 @@ class SettingsButton extends Button {
53 53
 
54 54
   onDisposeSettingsItem (event: any, name: string) {
55 55
     if (name === undefined) {
56
-      let children = this.menu.children()
56
+      const children = this.menu.children()
57 57
 
58 58
       while (children.length > 0) {
59 59
         children[0].dispose()
@@ -62,7 +62,7 @@ class SettingsButton extends Button {
62 62
 
63 63
       this.addClass('vjs-hidden')
64 64
     } else {
65
-      let item = this.menu.getChild(name)
65
+      const item = this.menu.getChild(name)
66 66
 
67 67
       if (item) {
68 68
         item.dispose()
@@ -148,8 +148,8 @@ class SettingsButton extends Button {
148 148
       return
149 149
     }
150 150
 
151
-    let offset = this.options_.setup.maxHeightOffset
152
-    let maxHeight = this.playerComponent.el_.offsetHeight - offset
151
+    const offset = this.options_.setup.maxHeightOffset
152
+    const maxHeight = this.playerComponent.el_.offsetHeight - offset
153 153
 
154 154
     if (height > maxHeight) {
155 155
       height = maxHeight
@@ -166,7 +166,7 @@ class SettingsButton extends Button {
166 166
   buildMenu () {
167 167
     this.menu = new Menu(this.player())
168 168
     this.menu.addClass('vjs-main-menu')
169
-    let entries = this.options_.entries
169
+    const entries = this.options_.entries
170 170
 
171 171
     if (entries.length === 0) {
172 172
       this.addClass('vjs-hidden')
@@ -174,7 +174,7 @@ class SettingsButton extends Button {
174 174
       return
175 175
     }
176 176
 
177
-    for (let entry of entries) {
177
+    for (const entry of entries) {
178 178
       this.addMenuItem(entry, this.options_)
179 179
     }
180 180
 
@@ -191,7 +191,7 @@ class SettingsButton extends Button {
191 191
     }
192 192
 
193 193
     options.name = toTitleCase(entry)
194
-    let settingsMenuItem = new SettingsMenuItem(this.player(), options, entry, this as any)
194
+    const settingsMenuItem = new SettingsMenuItem(this.player(), options, entry, this as any)
195 195
 
196 196
     this.menu.addChild(settingsMenuItem)
197 197
 
@@ -204,7 +204,7 @@ class SettingsButton extends Button {
204 204
   }
205 205
 
206 206
   resetChildren () {
207
-    for (let menuChild of this.menu.children()) {
207
+    for (const menuChild of this.menu.children()) {
208 208
       menuChild.reset()
209 209
     }
210 210
   }
@@ -213,7 +213,7 @@ class SettingsButton extends Button {
213 213
    * Hide all the sub menus
214 214
    */
215 215
   hideChildren () {
216
-    for (let menuChild of this.menu.children()) {
216
+    for (const menuChild of this.menu.children()) {
217 217
       menuChild.hideSubMenu()
218 218
     }
219 219
   }

+ 5
- 5
client/src/assets/player/videojs-components/settings-menu-item.ts View File

@@ -167,7 +167,7 @@ class SettingsMenuItem extends MenuItem {
167 167
    * @method PrefixedEvent
168 168
    */
169 169
   PrefixedEvent (element: any, type: any, callback: any, action = 'addEvent') {
170
-    let prefix = ['webkit', 'moz', 'MS', 'o', '']
170
+    const prefix = ['webkit', 'moz', 'MS', 'o', '']
171 171
 
172 172
     for (let p = 0; p < prefix.length; p++) {
173 173
       if (!prefix[p]) {
@@ -249,7 +249,7 @@ class SettingsMenuItem extends MenuItem {
249 249
 
250 250
   update (event?: any) {
251 251
     let target: HTMLElement = null
252
-    let subMenu = this.subMenu.name()
252
+    const subMenu = this.subMenu.name()
253 253
 
254 254
     if (event && event.type === 'tap') {
255 255
       target = event.target
@@ -264,7 +264,7 @@ class SettingsMenuItem extends MenuItem {
264 264
       setTimeout(() => this.settingsSubMenuValueEl_.innerHTML = this.subMenu.labelEl_.innerHTML, 250)
265 265
     } else {
266 266
       // Loop trough the submenu items to find the selected child
267
-      for (let subMenuItem of this.subMenu.menu.children_) {
267
+      for (const subMenuItem of this.subMenu.menu.children_) {
268 268
         if (!(subMenuItem instanceof component)) {
269 269
           continue
270 270
         }
@@ -287,7 +287,7 @@ class SettingsMenuItem extends MenuItem {
287 287
   }
288 288
 
289 289
   bindClickEvents () {
290
-    for (let item of this.subMenu.menu.children()) {
290
+    for (const item of this.subMenu.menu.children()) {
291 291
       if (!(item instanceof component)) {
292 292
         continue
293 293
       }
@@ -307,7 +307,7 @@ class SettingsMenuItem extends MenuItem {
307 307
   }
308 308
 
309 309
   setMargin () {
310
-    let [width] = this.size
310
+    const [ width ] = this.size
311 311
 
312 312
     this.settingsSubMenuEl_.style.marginRight = `-${width}px`
313 313
   }

+ 3
- 3
client/src/assets/player/webtorrent/peertube-chunk-store.ts View File

@@ -131,7 +131,7 @@ export class PeertubeChunkStore extends EventEmitter {
131 131
     // Chunk in store
132 132
     this.db.transaction('r', this.db.chunks, async () => {
133 133
       const result = await this.db.chunks.get({ id: index })
134
-      if (result === undefined) return cb(null, new Buffer(0))
134
+      if (result === undefined) return cb(null, Buffer.alloc(0))
135 135
 
136 136
       const buf = result.buf
137 137
       if (!opts) return this.nextTick(cb, null, buf)
@@ -162,13 +162,13 @@ export class PeertubeChunkStore extends EventEmitter {
162 162
       }
163 163
 
164 164
       if (this.db) {
165
-        await this.db.close()
165
+        this.db.close()
166 166
 
167 167
         await this.dropDatabase(this.databaseName)
168 168
       }
169 169
 
170 170
       if (this.expirationDB) {
171
-        await this.expirationDB.close()
171
+        this.expirationDB.close()
172 172
         this.expirationDB = null
173 173
       }
174 174
 

+ 1
- 1
client/src/assets/player/webtorrent/video-renderer.ts View File

@@ -29,7 +29,7 @@ function renderVideo (
29 29
 
30 30
 function renderMedia (file: any, elem: HTMLVideoElement, opts: RenderMediaOptions, callback: (err: Error, renderer?: any) => void) {
31 31
   const extension = extname(file.name).toLowerCase()
32
-  let preparedElem: any = undefined
32
+  let preparedElem: any
33 33
   let currentTime = 0
34 34
   let renderer: any
35 35
 

+ 1
- 1
client/src/assets/player/webtorrent/webtorrent-plugin.ts View File

@@ -347,7 +347,7 @@ class WebTorrentPlugin extends Plugin {
347 347
     if (!averageDownloadSpeed) averageDownloadSpeed = this.getAndSaveActualDownloadSpeed()
348 348
 
349 349
     // Limit resolution according to player height
350
-    const playerHeight = this.playerElement.offsetHeight as number
350
+    const playerHeight = this.playerElement.offsetHeight
351 351
 
352 352
     // We take the first resolution just above the player height
353 353
     // Example: player height is 530px, we want the 720p file instead of 480p

+ 1
- 0
client/src/polyfills.ts View File

@@ -76,6 +76,7 @@ import 'core-js/es7/object'
76 76
 /***************************************************************************************************
77 77
  * Zone JS is required by default for Angular itself.
78 78
  */
79
+// tslint:disable
79 80
 import 'zone.js/dist/zone'  // Included with Angular CLI.
80 81
 
81 82
 /***************************************************************************************************

+ 1
- 3
client/src/standalone/player/definitions.ts View File

@@ -1,6 +1,4 @@
1
-export interface EventHandler<T> {
2
-  (ev: T): void
3
-}
1
+export type EventHandler<T> = (ev: T) => void
4 2
 
5 3
 export type PlayerEventType =
6 4
   'pause' | 'play' |

+ 2
- 2
client/src/standalone/player/events.ts View File

@@ -13,13 +13,13 @@ export class EventRegistrar {
13 13
   private eventRegistrations: PlayerEventRegistrationMap = {}
14 14
 
15 15
   public bindToChannel (channel: Channel.MessagingChannel) {
16
-    for (let name of Object.keys(this.eventRegistrations)) {
16
+    for (const name of Object.keys(this.eventRegistrations)) {
17 17
       channel.bind(name, (txn, params) => this.fire(name, params))
18 18
     }
19 19
   }
20 20
 
21 21
   public registerTypes (names: string[]) {
22
-    for (let name of names) {
22
+    for (const name of names) {
23 23
       this.eventRegistrations[ name ] = { registrations: [] }
24 24
     }
25 25
   }

+ 6
- 6
client/src/standalone/videos/embed.ts View File

@@ -40,7 +40,7 @@ class PeerTubeEmbedApi {
40 40
   }
41 41
 
42 42
   private constructChannel () {
43
-    let channel = Channel.build({ window: window.parent, origin: '*', scope: this.embed.scope })
43
+    const channel = Channel.build({ window: window.parent, origin: '*', scope: this.embed.scope })
44 44
 
45 45
     channel.bind('play', (txn, params) => this.embed.player.play())
46 46
     channel.bind('pause', (txn, params) => this.embed.player.pause())
@@ -82,8 +82,8 @@ class PeerTubeEmbedApi {
82 82
     let currentState: 'playing' | 'paused' | 'unstarted' = 'unstarted'
83 83
 
84 84
     setInterval(() => {
85
-      let position = this.element.currentTime
86
-      let volume = this.element.volume
85
+      const position = this.element.currentTime
86
+      const volume = this.element.volume
87 87
 
88 88
       this.channel.notify({
89 89
         method: 'playbackStatusUpdate',
@@ -114,8 +114,8 @@ class PeerTubeEmbedApi {
114 114
   }
115 115
 
116 116
   private loadWebTorrentResolutions () {
117
-    let resolutions = []
118
-    let currentResolutionId = this.embed.player.webtorrent().getCurrentResolutionId()
117
+    const resolutions = []
118
+    const currentResolutionId = this.embed.player.webtorrent().getCurrentResolutionId()
119 119
 
120 120
     for (const videoFile of this.embed.player.webtorrent().videoFiles) {
121 121
       let label = videoFile.resolution.label
@@ -235,7 +235,7 @@ class PeerTubeEmbed {
235 235
 
236 236
   private loadParams () {
237 237
     try {
238
-      let params = new URL(window.location.toString()).searchParams
238
+      const params = new URL(window.location.toString()).searchParams
239 239
 
240 240
       this.autoplay = this.getParamToggle(params, 'autoplay')
241 241
       this.controls = this.getParamToggle(params, 'controls')

+ 12
- 12
client/src/standalone/videos/test-embed.ts View File

@@ -7,13 +7,13 @@ window.addEventListener('load', async () => {
7 7
   const lastPart = urlParts[ urlParts.length - 1 ]
8 8
   const videoId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[ 0 ]
9 9
 
10
-  let iframe = document.createElement('iframe')
10
+  const iframe = document.createElement('iframe')
11 11
   iframe.src = `/videos/embed/${videoId}?autoplay=1&controls=0&api=1`
12
-  let mainElement = document.querySelector('#host')
12
+  const mainElement = document.querySelector('#host')
13 13
   mainElement.appendChild(iframe)
14 14
 
15 15
   console.log(`Document finished loading.`)
16
-  let player = new PeerTubePlayer(document.querySelector('iframe'))
16
+  const player = new PeerTubePlayer(document.querySelector('iframe'))
17 17
 
18 18
   window[ 'player' ] = player
19 19
 
@@ -21,7 +21,7 @@ window.addEventListener('load', async () => {
21 21
   await player.ready
22 22
   console.log(`Player is ready.`)
23 23
 
24
-  let monitoredEvents = [
24
+  const monitoredEvents = [
25 25
     'pause',
26 26
     'play',
27 27
     'playbackStatusUpdate',
@@ -36,18 +36,18 @@ window.addEventListener('load', async () => {
36 36
   let playbackRates: number[] = []
37 37
   let currentRate = await player.getPlaybackRate()
38 38
 
39
-  let updateRates = async () => {
40
-    let rateListEl = document.querySelector('#rate-list')
39
+  const updateRates = async () => {
40
+    const rateListEl = document.querySelector('#rate-list')
41 41
     rateListEl.innerHTML = ''
42 42
 
43 43
     playbackRates.forEach(rate => {
44 44
       if (currentRate === rate) {
45
-        let itemEl = document.createElement('strong')
45
+        const itemEl = document.createElement('strong')
46 46
         itemEl.innerText = `${rate} (active)`
47 47
         itemEl.style.display = 'block'
48 48
         rateListEl.appendChild(itemEl)
49 49
       } else {
50
-        let itemEl = document.createElement('a')
50
+        const itemEl = document.createElement('a')
51 51
         itemEl.href = 'javascript:;'
52 52
         itemEl.innerText = rate.toString()
53 53
         itemEl.addEventListener('click', () => {
@@ -66,18 +66,18 @@ window.addEventListener('load', async () => {
66 66
     updateRates()
67 67
   })
68 68
 
69
-  let updateResolutions = ((resolutions: PeerTubeResolution[]) => {
70
-    let resolutionListEl = document.querySelector('#resolution-list')
69
+  const updateResolutions = ((resolutions: PeerTubeResolution[]) => {
70
+    const resolutionListEl = document.querySelector('#resolution-list')
71 71
     resolutionListEl.innerHTML = ''
72 72
 
73 73
     resolutions.forEach(resolution => {
74 74
       if (resolution.active) {
75
-        let itemEl = document.createElement('strong')
75
+        const itemEl = document.createElement('strong')
76 76
         itemEl.innerText = `${resolution.label} (active)`
77 77
         itemEl.style.display = 'block'
78 78
         resolutionListEl.appendChild(itemEl)
79 79
       } else {
80
-        let itemEl = document.createElement('a')
80
+        const itemEl = document.createElement('a')
81 81
         itemEl.href = 'javascript:;'
82 82
         itemEl.innerText = resolution.label
83 83
         itemEl.addEventListener('click', () => {

+ 1
- 0
client/tsconfig.json View File

@@ -43,6 +43,7 @@
43 43
     "fullTemplateTypeCheck": true
44 44
   },
45 45
   "include": [
46
+    "./src",
46 47
     "../../shared"
47 48
   ],
48 49
   "exclude": [

+ 6
- 24
client/tslint.json View File

@@ -1,12 +1,12 @@
1 1
 {
2
-  "extends": "tslint-config-standard",
3
-  "rulesDirectory": ["./node_modules/codelyzer"],
2
+  "extends": [ "tslint-angular", "tslint-config-standard" ],
4 3
   "rules": {
5 4
     "no-inferrable-types": true,
6 5
     "eofline": true,
7 6
     "max-line-length": [true, 140],
8 7
     "no-floating-promises": false,
9 8
     "no-unused-variable": false, // Memory issues
9
+    "await-promise": [true, "PromiseLike"],
10 10
     "member-ordering": [true, {
11 11
       "order": [
12 12
         "public-static-field",
@@ -21,27 +21,9 @@
21 21
         ]}
22 22
     ],
23 23
 
24
-    "angular-whitespace": [true, "check-interpolation", "check-semicolon"],
25
-    "banana-in-box": true,
26
-    "templates-no-negated-async": true,
27
-    "directive-selector": [true, "attribute", "my", "camelCase"],
28
-    "component-selector": [true, "element", "my", "kebab-case"],
29
-    "use-input-property-decorator": true,
30
-    "use-output-property-decorator": true,
31
-    "use-host-property-decorator": true,
32
-    "use-view-encapsulation": true,
33
-    "no-attribute-parameter-decorator": true,
34
-    "no-input-rename": true,
35
-    "no-output-rename": true,
36
-    "no-output-on-prefix": true,
37
-    "no-forward-ref": false,
38
-    "use-life-cycle-interface": true,
39
-    "contextual-life-cycle": true,
40
-    "trackBy-function": false,
41
-    "use-pipe-transform-interface": true,
42
-    "pipe-prefix": [true, "my"],
43
-    "component-class-suffix": true,
44
-    "directive-class-suffix": true,
45
-    "pipe-impure": true
24
+    "no-shadowed-variable": false,
25
+    "no-bitwise": false,
26
+    "max-classes-per-file": false,
27
+    "interface-over-type-literal": false
46 28
   }
47 29
 }

+ 18
- 38
client/yarn.lock View File

@@ -961,14 +961,6 @@ argparse@^1.0.7:
961 961
   dependencies:
962 962
     sprintf-js "~1.0.2"
963 963
 
964
-aria-query@^3.0.0:
965
-  version "3.0.0"
966
-  resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc"
967
-  integrity sha1-ZbP8wcoRVajJrmTW7uKX8V1RM8w=
968
-  dependencies:
969
-    ast-types-flow "0.0.7"
970
-    commander "^2.11.0"
971
-
972 964
 arr-diff@^4.0.0:
973 965
   version "4.0.0"
974 966
   resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520"
@@ -1064,11 +1056,6 @@ assign-symbols@^1.0.0:
1064 1056
   resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367"
1065 1057
   integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=
1066 1058
 
1067
-ast-types-flow@0.0.7:
1068
-  version "0.0.7"
1069
-  resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad"
1070
-  integrity sha1-9wtzXGvKGlycItmCw+Oef+ujva0=
1071
-
1072 1059
 ast-types@0.9.6:
1073 1060
   version "0.9.6"
1074 1061
   resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.6.tgz#102c9e9e9005d3e7e3829bf0c4fa24ee862ee9b9"
@@ -1147,13 +1134,6 @@ aws4@^1.8.0:
1147 1134
   resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f"
1148 1135
   integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==
1149 1136
 
1150
-axobject-query@^2.0.2:
1151
-  version "2.0.2"
1152
-  resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.0.2.tgz#ea187abe5b9002b377f925d8bf7d1c561adf38f9"
1153
-  integrity sha512-MCeek8ZH7hKyO1rWUbKNQBbl4l2eY0ntk7OGi+q0RlafrCnfPxC06WZA+uebCfmYp4mNU9jRBP1AhGyf8+W3ww==
1154
-  dependencies:
1155
-    ast-types-flow "0.0.7"
1156
-
1157 1137
 babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
1158 1138
   version "6.26.0"
1159 1139
   resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
@@ -1969,20 +1949,17 @@ code-point-at@^1.0.0:
1969 1949
   resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
1970 1950
   integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=
1971 1951
 
1972
-codelyzer@^5.0.0:
1973
-  version "5.0.0"
1974
-  resolved "https://registry.yarnpkg.com/codelyzer/-/codelyzer-5.0.0.tgz#e4032efb23a7c5d4bcfe7321fc1789490c679837"
1975
-  integrity sha512-Bif70XYt8NFf/Q9GPTxmC86OsBRfQZq1dBjdruJ5kZhJ8/jKhJL6MvCLKnYtSOG6Rhiv/44DU0cHk6GYthjy8Q==
1952
+codelyzer@^4.0.2:
1953
+  version "4.5.0"
1954
+  resolved "https://registry.yarnpkg.com/codelyzer/-/codelyzer-4.5.0.tgz#a65ddeeeca2894653253a89bfa229118ff9f59b1"
1955
+  integrity sha512-oO6vCkjqsVrEsmh58oNlnJkRXuA30hF8cdNAQV9DytEalDwyOFRvHMnlKFzmOStNerOmPGZU9GAHnBo4tGvtiQ==
1976 1956
   dependencies:
1977 1957
     app-root-path "^2.1.0"
1978
-    aria-query "^3.0.0"
1979
-    axobject-query "^2.0.2"
1980
-    css-selector-tokenizer "^0.7.1"
1958
+    css-selector-tokenizer "^0.7.0"
1981 1959
     cssauron "^1.4.0"
1982
-    damerau-levenshtein "^1.0.4"
1983 1960
     semver-dsl "^1.0.1"
1984 1961
     source-map "^0.5.7"
1985
-    sprintf-js "^1.1.2"
1962
+    sprintf-js "^1.1.1"
1986 1963
 
1987 1964
 collection-visit@^1.0.0:
1988 1965
   version "1.0.0"
@@ -2026,7 +2003,7 @@ commander@2.17.x:
2026 2003
   resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
2027 2004
   integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==
2028 2005
 
2029
-commander@^2.11.0, commander@^2.12.1, commander@^2.18.0, commander@^2.19.0, commander@^2.9.0, commander@~2.19.0:
2006
+commander@^2.12.1, commander@^2.18.0, commander@^2.19.0, commander@^2.9.0, commander@~2.19.0:
2030 2007
   version "2.19.0"
2031 2008
   resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
2032 2009
   integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==
@@ -2345,7 +2322,7 @@ css-select@^1.1.0:
2345 2322
     domutils "1.5.1"
2346 2323
     nth-check "~1.0.1"
2347 2324
 
2348
-css-selector-tokenizer@^0.7.1:
2325
+css-selector-tokenizer@^0.7.0:
2349 2326
   version "0.7.1"
2350 2327
   resolved "https://registry.yarnpkg.com/css-selector-tokenizer/-/css-selector-tokenizer-0.7.1.tgz#a177271a8bca5019172f4f891fc6eed9cbf68d5d"
2351 2328
   integrity sha512-xYL0AMZJ4gFzJQsHUKa5jiWWi2vH77WVNg7JYRyewwj6oPh4yb/y6Y9ZCw9dsj/9UauMhtuxR+ogQd//EdEVNA==
@@ -2415,11 +2392,6 @@ d@1:
2415 2392
   dependencies:
2416 2393
     es5-ext "^0.10.9"
2417 2394
 
2418
-damerau-levenshtein@^1.0.4:
2419
-  version "1.0.4"
2420
-  resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.4.tgz#03191c432cb6eea168bb77f3a55ffdccb8978514"
2421
-  integrity sha1-AxkcQyy27qFou3fzpV/9zLiXhRQ=
2422
-
2423 2395
 dashdash@^1.12.0:
2424 2396
   version "1.14.1"
2425 2397
   resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
@@ -8065,7 +8037,7 @@ split@^1.0.0:
8065 8037
   dependencies:
8066 8038
     through "2"
8067 8039
 
8068
-sprintf-js@^1.1.2:
8040
+sprintf-js@^1.1.1:
8069 8041
   version "1.1.2"
8070 8042
   resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.2.tgz#da1765262bf8c0f571749f2ad6c26300207ae673"
8071 8043
   integrity sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==
@@ -8592,6 +8564,14 @@ tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0, tslib@~1.9.0:
8592 8564
   resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
8593 8565
   integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==
8594 8566
 
8567
+tslint-angular@^1.1.2:
8568
+  version "1.1.2"
8569
+  resolved "https://registry.yarnpkg.com/tslint-angular/-/tslint-angular-1.1.2.tgz#5ce7020968e3b9dc7a40b6d15dadd6da34787309"
8570
+  integrity sha512-YDLdgQXBSFcVdDZH3mThx21fKzRctIgmCWpuwmppFLc7QHV3tdWDaFnD5lwUmgvLH8W0o+KsXhSzZ2uIsFJ+YA==
8571
+  dependencies:
8572
+    codelyzer "^4.0.2"
8573
+    tslint "^5.8.0"
8574
+
8595 8575
 tslint-config-standard@^8.0.1:
8596 8576
   version "8.0.1"
8597 8577
   resolved "https://registry.yarnpkg.com/tslint-config-standard/-/tslint-config-standard-8.0.1.tgz#e4dd3128e84b0e34b51990b68715a641f2b417e4"
@@ -8608,7 +8588,7 @@ tslint-eslint-rules@^5.3.1:
8608 8588
     tslib "1.9.0"
8609 8589
     tsutils "^3.0.0"
8610 8590
 
8611
-tslint@^5.7.0:
8591
+tslint@^5.7.0, tslint@^5.8.0:
8612 8592
   version "5.15.0"
8613 8593
   resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.15.0.tgz#6ffb180986d63afa1e531feb2a134dbf961e27d3"
8614 8594
   integrity sha512-6bIEujKR21/3nyeoX2uBnE8s+tMXCQXhqMmaIPJpHmXJoBJPTLcI7/VHRtUwMhnLVdwLqqY3zmd8Dxqa5CVdJA==

+ 21
- 21
shared/models/videos/video-resolution.enum.ts View File

@@ -17,27 +17,27 @@ export enum VideoResolution {
17 17
  */
18 18
 function getBaseBitrate (resolution: VideoResolution) {
19 19
   switch (resolution) {
20
-  case VideoResolution.H_240P:
21
-    // quality according to Google Live Encoder: 300 - 700 Kbps
22
-    // Quality according to YouTube Video Info: 186 Kbps
23
-    return 250 * 1000
24
-  case VideoResolution.H_360P:
25
-    // quality according to Google Live Encoder: 400 - 1,000 Kbps
26
-    // Quality according to YouTube Video Info: 480 Kbps
27
-    return 500 * 1000
28
-  case VideoResolution.H_480P:
29
-    // quality according to Google Live Encoder: 500 - 2,000 Kbps
30
-    // Quality according to YouTube Video Info: 879 Kbps
31
-    return 900 * 1000
32
-  case VideoResolution.H_720P:
33
-    // quality according to Google Live Encoder: 1,500 - 4,000 Kbps
34
-    // Quality according to YouTube Video Info: 1752 Kbps
35
-    return 1750 * 1000
36
-  case VideoResolution.H_1080P: // fallthrough
37
-  default:
38
-    // quality according to Google Live Encoder: 3000 - 6000 Kbps
39
-    // Quality according to YouTube Video Info: 3277 Kbps
40
-    return 3300 * 1000
20
+    case VideoResolution.H_240P:
21
+      // quality according to Google Live Encoder: 300 - 700 Kbps
22
+      // Quality according to YouTube Video Info: 186 Kbps
23
+      return 250 * 1000
24
+    case VideoResolution.H_360P:
25
+      // quality according to Google Live Encoder: 400 - 1,000 Kbps
26
+      // Quality according to YouTube Video Info: 480 Kbps
27
+      return 500 * 1000
28
+    case VideoResolution.H_480P:
29
+      // quality according to Google Live Encoder: 500 - 2,000 Kbps
30
+      // Quality according to YouTube Video Info: 879 Kbps
31
+      return 900 * 1000
32
+    case VideoResolution.H_720P:
33
+      // quality according to Google Live Encoder: 1,500 - 4,000 Kbps
34
+      // Quality according to YouTube Video Info: 1752 Kbps
35
+      return 1750 * 1000
36
+    case VideoResolution.H_1080P: // fallthrough
37
+    default:
38
+      // quality according to Google Live Encoder: 3000 - 6000 Kbps
39
+      // Quality according to YouTube Video Info: 3277 Kbps
40
+      return 3300 * 1000
41 41
   }
42 42
 }
43 43
 

Loading…
Cancel
Save