Remove useless async
This commit is contained in:
		
							parent
							
								
									851675c559
								
							
						
					
					
						commit
						98ab5dc810
					
				
					 35 changed files with 49 additions and 43 deletions
				
			
		| 
						 | 
					@ -89,6 +89,10 @@
 | 
				
			||||||
    "@typescript-eslint/no-empty-interface": "off",
 | 
					    "@typescript-eslint/no-empty-interface": "off",
 | 
				
			||||||
    "@typescript-eslint/no-extraneous-class": "off",
 | 
					    "@typescript-eslint/no-extraneous-class": "off",
 | 
				
			||||||
    "@typescript-eslint/no-use-before-define": "off",
 | 
					    "@typescript-eslint/no-use-before-define": "off",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    "require-await": "off",
 | 
				
			||||||
 | 
					    "@typescript-eslint/require-await": "error",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // bugged but useful
 | 
					    // bugged but useful
 | 
				
			||||||
    "@typescript-eslint/restrict-plus-operands": "off"
 | 
					    "@typescript-eslint/restrict-plus-operands": "off"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -260,7 +260,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
 | 
				
			||||||
    this.loadCategoriesAndLanguages()
 | 
					    this.loadCategoriesAndLanguages()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async formValidated () {
 | 
					  formValidated () {
 | 
				
			||||||
    const value: ComponentCustomConfig = this.form.getRawValue()
 | 
					    const value: ComponentCustomConfig = this.form.getRawValue()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    forkJoin([
 | 
					    forkJoin([
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,7 +54,7 @@ export class FollowModalComponent extends FormReactive implements OnInit {
 | 
				
			||||||
    return window.location.protocol === 'https:'
 | 
					    return window.location.protocol === 'https:'
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private async addFollowing () {
 | 
					  private addFollowing () {
 | 
				
			||||||
    const hostsOrHandles = splitAndGetNotEmpty(this.form.value['hostsOrHandles'])
 | 
					    const hostsOrHandles = splitAndGetNotEmpty(this.form.value['hostsOrHandles'])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.followService.follow(hostsOrHandles)
 | 
					    this.followService.follow(hostsOrHandles)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -134,7 +134,7 @@ export class VideoCommentListComponent extends RestTable implements OnInit {
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private async removeComments (comments: VideoCommentAdmin[]) {
 | 
					  private removeComments (comments: VideoCommentAdmin[]) {
 | 
				
			||||||
    const commentArgs = comments.map(c => ({ videoId: c.video.id, commentId: c.id }))
 | 
					    const commentArgs = comments.map(c => ({ videoId: c.video.id, commentId: c.id }))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.videoCommentService.deleteVideoComments(commentArgs)
 | 
					    this.videoCommentService.deleteVideoComments(commentArgs)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -206,7 +206,7 @@ export class UserListComponent extends RestTable implements OnInit {
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async setEmailsAsVerified (users: User[]) {
 | 
					  setEmailsAsVerified (users: User[]) {
 | 
				
			||||||
    this.userService.updateUsers(users, { emailVerified: true })
 | 
					    this.userService.updateUsers(users, { emailVerified: true })
 | 
				
			||||||
      .subscribe({
 | 
					      .subscribe({
 | 
				
			||||||
        next: () => {
 | 
					        next: () => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,7 @@ export class HomeComponent implements OnInit {
 | 
				
			||||||
    private customPageService: CustomPageService
 | 
					    private customPageService: CustomPageService
 | 
				
			||||||
  ) { }
 | 
					  ) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async ngOnInit () {
 | 
					  ngOnInit () {
 | 
				
			||||||
    this.customPageService.getInstanceHomepage()
 | 
					    this.customPageService.getInstanceHomepage()
 | 
				
			||||||
      .subscribe(({ content }) => this.homepageContent = content)
 | 
					      .subscribe(({ content }) => this.homepageContent = content)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,7 +75,7 @@ export class SearchComponent implements OnInit, OnDestroy {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.subActivatedRoute = this.route.queryParams
 | 
					    this.subActivatedRoute = this.route.queryParams
 | 
				
			||||||
      .subscribe({
 | 
					      .subscribe({
 | 
				
			||||||
        next: async queryParams => {
 | 
					        next: queryParams => {
 | 
				
			||||||
          const querySearch = queryParams['search']
 | 
					          const querySearch = queryParams['search']
 | 
				
			||||||
          const searchTarget = queryParams['searchTarget']
 | 
					          const searchTarget = queryParams['searchTarget']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,7 +71,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni
 | 
				
			||||||
    return languageId && this.existingCaptions.includes(languageId)
 | 
					    return languageId && this.existingCaptions.includes(languageId)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async addCaption () {
 | 
					  addCaption () {
 | 
				
			||||||
    const languageId = this.form.value['language']
 | 
					    const languageId = this.form.value['language']
 | 
				
			||||||
    const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId)
 | 
					    const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -231,7 +231,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
 | 
				
			||||||
    this.sortVideoCaptions()
 | 
					    this.sortVideoCaptions()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async deleteCaption (caption: VideoCaptionEdit) {
 | 
					  deleteCaption (caption: VideoCaptionEdit) {
 | 
				
			||||||
    // Caption recovers his former state
 | 
					    // Caption recovers his former state
 | 
				
			||||||
    if (caption.action && this.initialVideoCaptions.includes(caption.language.id)) {
 | 
					    if (caption.action && this.initialVideoCaptions.includes(caption.language.id)) {
 | 
				
			||||||
      caption.action = undefined
 | 
					      caption.action = undefined
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,8 +21,9 @@ export class PrivacyConcernsComponent implements OnInit {
 | 
				
			||||||
    private serverService: ServerService
 | 
					    private serverService: ServerService
 | 
				
			||||||
  ) { }
 | 
					  ) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async ngOnInit () {
 | 
					  ngOnInit () {
 | 
				
			||||||
    this.serverConfig = this.serverService.getHTMLConfig()
 | 
					    this.serverConfig = this.serverService.getHTMLConfig()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (
 | 
					    if (
 | 
				
			||||||
      isWebRTCDisabled() ||
 | 
					      isWebRTCDisabled() ||
 | 
				
			||||||
      this.serverConfig.tracker.enabled === false ||
 | 
					      this.serverConfig.tracker.enabled === false ||
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -113,7 +113,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
 | 
				
			||||||
    return this.userService.getAnonymousUser()
 | 
					    return this.userService.getAnonymousUser()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async ngOnInit () {
 | 
					  ngOnInit () {
 | 
				
			||||||
    this.serverConfig = this.serverService.getHTMLConfig()
 | 
					    this.serverConfig = this.serverService.getHTMLConfig()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    PeertubePlayerManager.initState()
 | 
					    PeertubePlayerManager.initState()
 | 
				
			||||||
| 
						 | 
					@ -640,7 +640,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (oldVideo && oldVideo.id !== newVideo.id) {
 | 
					    if (oldVideo && oldVideo.id !== newVideo.id) {
 | 
				
			||||||
      await this.peertubeSocket.unsubscribeLiveVideos(oldVideo.id)
 | 
					      this.peertubeSocket.unsubscribeLiveVideos(oldVideo.id)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!newVideo.isLive) return
 | 
					    if (!newVideo.isLive) return
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -220,7 +220,7 @@ export class AppComponent implements OnInit, AfterViewInit {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private async openModalsIfNeeded () {
 | 
					  private openModalsIfNeeded () {
 | 
				
			||||||
    this.authService.userInformationLoaded
 | 
					    this.authService.userInformationLoaded
 | 
				
			||||||
        .pipe(
 | 
					        .pipe(
 | 
				
			||||||
          map(() => this.authService.getUser()),
 | 
					          map(() => this.authService.getUser()),
 | 
				
			||||||
| 
						 | 
					@ -232,7 +232,7 @@ export class AppComponent implements OnInit, AfterViewInit {
 | 
				
			||||||
        ).subscribe(({ serverConfig, user }) => this._openAdminModalsIfNeeded(serverConfig, user))
 | 
					        ).subscribe(({ serverConfig, user }) => this._openAdminModalsIfNeeded(serverConfig, user))
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private async _openAdminModalsIfNeeded (serverConfig: ServerConfig, user: User) {
 | 
					  private _openAdminModalsIfNeeded (serverConfig: ServerConfig, user: User) {
 | 
				
			||||||
    if (user.noWelcomeModal !== true) return this.welcomeModal.show()
 | 
					    if (user.noWelcomeModal !== true) return this.welcomeModal.show()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (user.noInstanceConfigWarningModal === true || !serverConfig.signup.allowed) return
 | 
					    if (user.noInstanceConfigWarningModal === true || !serverConfig.signup.allowed) return
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,7 +38,7 @@ export class PeerTubeSocket {
 | 
				
			||||||
    this.liveVideosSocket.emit('subscribe', { videoId })
 | 
					    this.liveVideosSocket.emit('subscribe', { videoId })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async unsubscribeLiveVideos (videoId: number) {
 | 
					  unsubscribeLiveVideos (videoId: number) {
 | 
				
			||||||
    if (!this.liveVideosSocket) return
 | 
					    if (!this.liveVideosSocket) return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.liveVideosSocket.emit('unsubscribe', { videoId })
 | 
					    this.liveVideosSocket.emit('unsubscribe', { videoId })
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,7 +49,7 @@ export class ModerationCommentModalComponent extends FormReactive implements OnI
 | 
				
			||||||
    this.form.reset()
 | 
					    this.form.reset()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async banUser () {
 | 
					  banUser () {
 | 
				
			||||||
    const moderationComment: string = this.form.value['moderationComment']
 | 
					    const moderationComment: string = this.form.value['moderationComment']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.abuseService.updateAbuse(this.abuseToComment, { moderationComment })
 | 
					    this.abuseService.updateAbuse(this.abuseToComment, { moderationComment })
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -84,8 +84,9 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.modalService.open(this.modal, {
 | 
					    this.modalService.open(this.modal, {
 | 
				
			||||||
      centered: true,
 | 
					      centered: true,
 | 
				
			||||||
      beforeDismiss: async () => {
 | 
					      beforeDismiss: () => {
 | 
				
			||||||
        this.onModalDismiss()
 | 
					        this.onModalDismiss()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return true
 | 
					        return true
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,7 +43,7 @@ export class UserBanModalComponent extends FormReactive implements OnInit {
 | 
				
			||||||
    this.openedModal.close()
 | 
					    this.openedModal.close()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async banUser () {
 | 
					  banUser () {
 | 
				
			||||||
    const reason = this.form.value['reason'] || undefined
 | 
					    const reason = this.form.value['reason'] || undefined
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.userService.banUsers(this.usersToBan, reason)
 | 
					    this.userService.banUsers(this.usersToBan, reason)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -86,7 +86,7 @@ class StatsCard extends Component {
 | 
				
			||||||
    this.updateInterval = setInterval(async () => {
 | 
					    this.updateInterval = setInterval(async () => {
 | 
				
			||||||
      try {
 | 
					      try {
 | 
				
			||||||
        const options = this.mode === 'p2p-media-loader'
 | 
					        const options = this.mode === 'p2p-media-loader'
 | 
				
			||||||
          ? await this.buildHLSOptions()
 | 
					          ? this.buildHLSOptions()
 | 
				
			||||||
          : await this.buildWebTorrentOptions() // Default
 | 
					          : await this.buildWebTorrentOptions() // Default
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.list.innerHTML = this.getListTemplate(options)
 | 
					        this.list.innerHTML = this.getListTemplate(options)
 | 
				
			||||||
| 
						 | 
					@ -102,7 +102,7 @@ class StatsCard extends Component {
 | 
				
			||||||
    this.container.style.display = 'none'
 | 
					    this.container.style.display = 'none'
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private async buildHLSOptions () {
 | 
					  private buildHLSOptions () {
 | 
				
			||||||
    const p2pMediaLoader = this.player_.p2pMediaLoader()
 | 
					    const p2pMediaLoader = this.player_.p2pMediaLoader()
 | 
				
			||||||
    const level = p2pMediaLoader.getCurrentLevel()
 | 
					    const level = p2pMediaLoader.getCurrentLevel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -184,7 +184,7 @@ export class PeertubeChunkStore extends EventEmitter {
 | 
				
			||||||
  private runCleaner () {
 | 
					  private runCleaner () {
 | 
				
			||||||
    this.checkExpiration()
 | 
					    this.checkExpiration()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.cleanerInterval = setInterval(async () => {
 | 
					    this.cleanerInterval = setInterval(() => {
 | 
				
			||||||
      this.checkExpiration()
 | 
					      this.checkExpiration()
 | 
				
			||||||
    }, PeertubeChunkStore.CLEANER_INTERVAL_MS)
 | 
					    }, PeertubeChunkStore.CLEANER_INTERVAL_MS)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -589,7 +589,7 @@ export class PeerTubeEmbed {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.buildCSS()
 | 
					    this.buildCSS()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await this.buildDock(videoInfo)
 | 
					    this.buildDock(videoInfo)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.initializeApi()
 | 
					    this.initializeApi()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -665,7 +665,7 @@ export class PeerTubeEmbed {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private async buildDock (videoInfo: VideoDetails) {
 | 
					  private buildDock (videoInfo: VideoDetails) {
 | 
				
			||||||
    if (!this.controls) return
 | 
					    if (!this.controls) return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // On webtorrent fallback, player may have been disposed
 | 
					    // On webtorrent fallback, player may have been disposed
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,7 +47,7 @@ window.addEventListener('load', async () => {
 | 
				
			||||||
  let playbackRates: number[] = []
 | 
					  let playbackRates: number[] = []
 | 
				
			||||||
  let currentRate = await player.getPlaybackRate()
 | 
					  let currentRate = await player.getPlaybackRate()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const updateRates = async () => {
 | 
					  const updateRates = () => {
 | 
				
			||||||
    const rateListEl = document.querySelector('#rate-list')
 | 
					    const rateListEl = document.querySelector('#rate-list')
 | 
				
			||||||
    rateListEl.innerHTML = ''
 | 
					    rateListEl.innerHTML = ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -108,7 +108,7 @@ videoChannelRouter.delete('/:nameWithHost',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
videoChannelRouter.get('/:nameWithHost',
 | 
					videoChannelRouter.get('/:nameWithHost',
 | 
				
			||||||
  asyncMiddleware(videoChannelsNameWithHostValidator),
 | 
					  asyncMiddleware(videoChannelsNameWithHostValidator),
 | 
				
			||||||
  asyncMiddleware(getVideoChannel)
 | 
					  getVideoChannel
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
videoChannelRouter.get('/:nameWithHost/video-playlists',
 | 
					videoChannelRouter.get('/:nameWithHost/video-playlists',
 | 
				
			||||||
| 
						 | 
					@ -281,7 +281,7 @@ async function removeVideoChannel (req: express.Request, res: express.Response)
 | 
				
			||||||
  return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
 | 
					  return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function getVideoChannel (req: express.Request, res: express.Response) {
 | 
					function getVideoChannel (req: express.Request, res: express.Response) {
 | 
				
			||||||
  const videoChannel = res.locals.videoChannel
 | 
					  const videoChannel = res.locals.videoChannel
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (videoChannel.isOutdated()) {
 | 
					  if (videoChannel.isOutdated()) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -102,7 +102,7 @@ videosRouter.get('/:id',
 | 
				
			||||||
  optionalAuthenticate,
 | 
					  optionalAuthenticate,
 | 
				
			||||||
  asyncMiddleware(videosCustomGetValidator('for-api')),
 | 
					  asyncMiddleware(videosCustomGetValidator('for-api')),
 | 
				
			||||||
  asyncMiddleware(checkVideoFollowConstraints),
 | 
					  asyncMiddleware(checkVideoFollowConstraints),
 | 
				
			||||||
  asyncMiddleware(getVideo)
 | 
					  getVideo
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
videosRouter.post('/:id/views',
 | 
					videosRouter.post('/:id/views',
 | 
				
			||||||
  openapiOperationDoc({ operationId: 'addView' }),
 | 
					  openapiOperationDoc({ operationId: 'addView' }),
 | 
				
			||||||
| 
						 | 
					@ -141,7 +141,7 @@ function listVideoPrivacies (_req: express.Request, res: express.Response) {
 | 
				
			||||||
  res.json(VIDEO_PRIVACIES)
 | 
					  res.json(VIDEO_PRIVACIES)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function getVideo (_req: express.Request, res: express.Response) {
 | 
					function getVideo (_req: express.Request, res: express.Response) {
 | 
				
			||||||
  const video = res.locals.videoAPI
 | 
					  const video = res.locals.videoAPI
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (video.isOutdated()) {
 | 
					  if (video.isOutdated()) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,7 +39,7 @@ liveRouter.post('/live',
 | 
				
			||||||
liveRouter.get('/live/:videoId',
 | 
					liveRouter.get('/live/:videoId',
 | 
				
			||||||
  authenticate,
 | 
					  authenticate,
 | 
				
			||||||
  asyncMiddleware(videoLiveGetValidator),
 | 
					  asyncMiddleware(videoLiveGetValidator),
 | 
				
			||||||
  asyncRetryTransactionMiddleware(getLiveVideo)
 | 
					  getLiveVideo
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
liveRouter.put('/live/:videoId',
 | 
					liveRouter.put('/live/:videoId',
 | 
				
			||||||
| 
						 | 
					@ -57,7 +57,7 @@ export {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ---------------------------------------------------------------------------
 | 
					// ---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function getLiveVideo (req: express.Request, res: express.Response) {
 | 
					function getLiveVideo (req: express.Request, res: express.Response) {
 | 
				
			||||||
  const videoLive = res.locals.videoLive
 | 
					  const videoLive = res.locals.videoLive
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return res.json(videoLive.toFormattedJSON())
 | 
					  return res.json(videoLive.toFormattedJSON())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -474,7 +474,7 @@ async function buildHLSVODCommand (command: ffmpeg.FfmpegCommand, options: HLSTr
 | 
				
			||||||
  return command
 | 
					  return command
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function buildHLSVODFromTSCommand (command: ffmpeg.FfmpegCommand, options: HLSFromTSTranscodeOptions) {
 | 
					function buildHLSVODFromTSCommand (command: ffmpeg.FfmpegCommand, options: HLSFromTSTranscodeOptions) {
 | 
				
			||||||
  const videoPath = getHLSVideoPath(options)
 | 
					  const videoPath = getHLSVideoPath(options)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  command.outputOption('-c copy')
 | 
					  command.outputOption('-c copy')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -81,7 +81,7 @@ async function handleOAuthToken (req: express.Request, options: { refreshTokenAu
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function handleOAuthAuthenticate (
 | 
					function handleOAuthAuthenticate (
 | 
				
			||||||
  req: express.Request,
 | 
					  req: express.Request,
 | 
				
			||||||
  res: express.Response,
 | 
					  res: express.Response,
 | 
				
			||||||
  authenticateInQuery = false
 | 
					  authenticateInQuery = false
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -199,7 +199,7 @@ class MuxingSession extends EventEmitter {
 | 
				
			||||||
  private watchMasterFile (outPath: string) {
 | 
					  private watchMasterFile (outPath: string) {
 | 
				
			||||||
    this.masterWatcher = chokidar.watch(outPath + '/' + this.streamingPlaylist.playlistFilename)
 | 
					    this.masterWatcher = chokidar.watch(outPath + '/' + this.streamingPlaylist.playlistFilename)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.masterWatcher.on('add', async () => {
 | 
					    this.masterWatcher.on('add', () => {
 | 
				
			||||||
      this.emit('master-playlist-created', { videoId: this.videoId })
 | 
					      this.emit('master-playlist-created', { videoId: this.videoId })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.masterWatcher.close()
 | 
					      this.masterWatcher.close()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -170,8 +170,8 @@ function createAccountAbuse (options: {
 | 
				
			||||||
}) {
 | 
					}) {
 | 
				
			||||||
  const { baseAbuse, accountInstance, transaction, reporterAccount } = options
 | 
					  const { baseAbuse, accountInstance, transaction, reporterAccount } = options
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const associateFun = async () => {
 | 
					  const associateFun = () => {
 | 
				
			||||||
    return { isOwned: accountInstance.isOwned() }
 | 
					    return Promise.resolve({ isOwned: accountInstance.isOwned() })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return createAbuse({
 | 
					  return createAbuse({
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,7 +35,7 @@ export class AutoFollowForInstance extends AbstractNotification <MActorFollowFul
 | 
				
			||||||
    return notification
 | 
					    return notification
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async createEmail (to: string) {
 | 
					  createEmail (to: string) {
 | 
				
			||||||
    const instanceUrl = this.actorFollow.ActorFollowing.url
 | 
					    const instanceUrl = this.actorFollow.ActorFollowing.url
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,7 +43,7 @@ export class FollowForInstance extends AbstractNotification <MActorFollowFull> {
 | 
				
			||||||
    return notification
 | 
					    return notification
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async createEmail (to: string) {
 | 
					  createEmail (to: string) {
 | 
				
			||||||
    const awaitingApproval = this.actorFollow.state === 'pending'
 | 
					    const awaitingApproval = this.actorFollow.state === 'pending'
 | 
				
			||||||
      ? ' awaiting manual approval.'
 | 
					      ? ' awaiting manual approval.'
 | 
				
			||||||
      : ''
 | 
					      : ''
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,7 +56,7 @@ export class FollowForUser extends AbstractNotification <MActorFollowFull> {
 | 
				
			||||||
    return notification
 | 
					    return notification
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async createEmail (to: string) {
 | 
					  createEmail (to: string) {
 | 
				
			||||||
    const following = this.actorFollow.ActorFollowing
 | 
					    const following = this.actorFollow.ActorFollowing
 | 
				
			||||||
    const follower = this.actorFollow.ActorFollower
 | 
					    const follower = this.actorFollow.ActorFollower
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,7 +41,7 @@ export class NewPeerTubeVersionForAdmins extends AbstractNotification <NewPeerTu
 | 
				
			||||||
    return notification
 | 
					    return notification
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async createEmail (to: string) {
 | 
					  createEmail (to: string) {
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
      to,
 | 
					      to,
 | 
				
			||||||
      template: 'peertube-version-new',
 | 
					      template: 'peertube-version-new',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,7 +37,7 @@ export class NewPluginVersionForAdmins extends AbstractNotification <MPlugin> {
 | 
				
			||||||
    return notification
 | 
					    return notification
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async createEmail (to: string) {
 | 
					  createEmail (to: string) {
 | 
				
			||||||
    const pluginUrl = WEBSERVER.URL + '/admin/plugins/list-installed?pluginType=' + this.plugin.type
 | 
					    const pluginUrl = WEBSERVER.URL + '/admin/plugins/list-installed?pluginType=' + this.plugin.type
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,7 +36,7 @@ export class RegistrationForModerators extends AbstractNotification <MUserDefaul
 | 
				
			||||||
    return notification
 | 
					    return notification
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async createEmail (to: string) {
 | 
					  createEmail (to: string) {
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
      template: 'user-registered',
 | 
					      template: 'user-registered',
 | 
				
			||||||
      to,
 | 
					      to,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,7 +14,7 @@ import { canDoQuickAudioTranscode, ffprobePromise, getAudioStream, getMaxAudioBi
 | 
				
			||||||
 *  * https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate
 | 
					 *  * https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = async (options: EncoderOptionsBuilderParams) => {
 | 
					const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = (options: EncoderOptionsBuilderParams) => {
 | 
				
			||||||
  const { fps, inputRatio, inputBitrate } = options
 | 
					  const { fps, inputRatio, inputBitrate } = options
 | 
				
			||||||
  if (!fps) return { outputOptions: [ ] }
 | 
					  if (!fps) return { outputOptions: [ ] }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,7 +30,7 @@ const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = async (options: Enco
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const defaultX264LiveOptionsBuilder: EncoderOptionsBuilder = async (options: EncoderOptionsBuilderParams) => {
 | 
					const defaultX264LiveOptionsBuilder: EncoderOptionsBuilder = (options: EncoderOptionsBuilderParams) => {
 | 
				
			||||||
  const { streamNum, fps, inputBitrate, inputRatio } = options
 | 
					  const { streamNum, fps, inputBitrate, inputRatio } = options
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const targetBitrate = capBitrate(inputBitrate, getAverageBitrate({ ...options, fps, ratio: inputRatio }))
 | 
					  const targetBitrate = capBitrate(inputBitrate, getAverageBitrate({ ...options, fps, ratio: inputRatio }))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -407,7 +407,7 @@ function getYoutubeDLInfo (youtubeDL: any, url: string, args: string[]) {
 | 
				
			||||||
  return new Promise<any>((res, rej) => {
 | 
					  return new Promise<any>((res, rej) => {
 | 
				
			||||||
    const options = [ '-j', '--flat-playlist', '--playlist-reverse', ...args ]
 | 
					    const options = [ '-j', '--flat-playlist', '--playlist-reverse', ...args ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    youtubeDL.getInfo(url, options, processOptions, async (err, info) => {
 | 
					    youtubeDL.getInfo(url, options, processOptions, (err, info) => {
 | 
				
			||||||
      if (err) return rej(err)
 | 
					      if (err) return rej(err)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return res(info)
 | 
					      return res(info)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue