Chocobozzz/PeerTube

View on GitHub

Showing 1,292 of 3,313 total issues

Function run has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function run () {
  console.log('Moving private video files in dedicated folders.')

  await ensureDir(DIRECTORIES.HLS_STREAMING_PLAYLIST.PRIVATE)
  await ensureDir(DIRECTORIES.WEB_VIDEOS.PRIVATE)
Severity: Minor
Found in server/scripts/migrations/peertube-5.0.ts - About 1 hr to fix

    Function buildMainQuery has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private buildMainQuery (options: BuildVideosListQueryOptions, serverActor: MActorAccount) {
        this.attributes = {
          '"video".*': ''
        }
    
    

      Function buildAvailableUrl has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private buildAvailableUrl (obj: any) {
          const urls: string[] = []
      
          if (obj.url) urls.push(obj.url)
          if (obj.urls) {
      Severity: Minor
      Found in server/core/helpers/youtube-dl/youtube-dl-info-builder.ts - About 1 hr to fix

        Function downloadHLSVideoFile has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function downloadHLSVideoFile (req: express.Request, res: express.Response) {
          const video = res.locals.videoAll
          const streamingPlaylist = getHLSPlaylist(video)
          if (!streamingPlaylist) return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
        
        
        Severity: Minor
        Found in server/core/controllers/download.ts - About 1 hr to fix

          Function filter has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            filter: async function (infoHash, params, cb) {
              if (CONFIG.TRACKER.ENABLED === false) {
                return cb(new Error('Tracker is disabled on this instance.'))
              }
          
          
          Severity: Minor
          Found in server/core/controllers/tracker.ts - About 1 hr to fix

            Function createUser has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            async function createUser (req: express.Request, res: express.Response) {
              const body: UserCreate = req.body
            
              const userToCreate = buildUser({
                ...pick(body, [ 'username', 'password', 'email', 'role', 'videoQuota', 'videoQuotaDaily', 'adminFlags' ]),
            Severity: Minor
            Found in server/core/controllers/api/users/index.ts - About 1 hr to fix

              Function addVideoInPlaylist has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              async function addVideoInPlaylist (req: express.Request, res: express.Response) {
                const body: VideoPlaylistElementCreate = req.body
                const videoPlaylist = res.locals.videoPlaylistFull
                const video = res.locals.onlyVideo
              
              
              Severity: Minor
              Found in server/core/controllers/api/video-playlist.ts - About 1 hr to fix

                Function videoPlaylistsGetValidator has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const videoPlaylistsGetValidator = (fetchType: VideoPlaylistFetchType) => {
                  return [
                    isValidPlaylistIdParam('playlistId'),
                
                    async (req: express.Request, res: express.Response, next: express.NextFunction) => {
                Severity: Minor
                Found in server/core/middlewares/validators/videos/video-playlists.ts - About 1 hr to fix

                  Function isVideoCommentAccepted has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function isVideoCommentAccepted (req: express.Request, res: express.Response, video: MVideoFullLight, isReply: boolean) {
                    const acceptParameters = {
                      video,
                      commentBody: req.body,
                      user: res.locals.oauth.token.User,
                  Severity: Minor
                  Found in server/core/middlewares/validators/videos/video-comments.ts - About 1 hr to fix

                    Function processViewerStats has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      async processViewerStats () {
                        if (this.processingViewersStats) return
                        this.processingViewersStats = true
                    
                        if (!isTestOrDevInstance()) logger.info('Processing viewer statistics.', lTags())
                    Severity: Minor
                    Found in server/core/lib/views/shared/video-viewer-stats.ts - About 1 hr to fix

                      Function saveToken has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      async function saveToken (
                        token: TokenInfo,
                        client: MOAuthClient,
                        user: MUser,
                        options: {
                      Severity: Minor
                      Found in server/core/lib/auth/oauth-model.ts - About 1 hr to fix

                        Function updateLocalActorImageFiles has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export async function updateLocalActorImageFiles (options: {
                          accountOrChannel: MAccountDefault | MChannelDefault
                          imagePhysicalFile: { path: string }
                          type: ActorImageType_Type
                          sendActorUpdate: boolean
                        Severity: Minor
                        Found in server/core/lib/local-actor.ts - About 1 hr to fix

                          Function buildWorker has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            private buildWorker (handlerName: JobType) {
                              const workerOptions: WorkerOptions = {
                                autorun: false,
                                concurrency: this.getJobConcurrency(handlerName),
                                prefix: this.jobRedisPrefix,
                          Severity: Minor
                          Found in server/core/lib/job-queue/job-queue.ts - About 1 hr to fix

                            Function onWebVideoFileTranscoding has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export async function onWebVideoFileTranscoding (options: {
                              video: MVideoFullLight
                              videoOutputPath: string
                              wasAudioFile?: boolean // default false
                              deleteWebInputVideoFile?: MVideoFile
                            Severity: Minor
                            Found in server/core/lib/transcoding/web-transcoding.ts - About 1 hr to fix

                              Function create has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                async create (options: CreateOptions) {
                                  const { video, resolution, fps, dependsOnRunnerJob, separatedAudio, priority } = options
                              
                                  const jobUUID = buildUUID()
                              
                              

                                Function buildMetadataFromVideo has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function buildMetadataFromVideo (video: MVideoThumbnail, type: ThumbnailType_Type, size?: ImageSize) {
                                  const existingThumbnail = Array.isArray(video.Thumbnails)
                                    ? video.Thumbnails.find(t => t.type === type)
                                    : undefined
                                
                                
                                Severity: Minor
                                Found in server/core/lib/thumbnail.ts - About 1 hr to fix

                                  Function buildPlayerIfNeeded has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    private async buildPlayerIfNeeded () {
                                      if (this.player) return
                                  
                                      await TranslationsManager.loadLocaleInVideoJS(this.options.serverUrl, this.options.language, videojs)
                                  
                                  
                                  Severity: Minor
                                  Found in client/src/assets/player/peertube-player.ts - About 1 hr to fix

                                    Function initHotkeys has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      private initHotkeys () {
                                        this.hotkeysService.add([
                                          new Hotkey([ 'Shift+/', 's' ], () => {
                                            document.getElementById('search-video').focus()
                                            return false
                                    Severity: Minor
                                    Found in client/src/app/app.component.ts - About 1 hr to fix

                                      Function autoFollow has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        private async autoFollow () {
                                          if (CONFIG.FOLLOWINGS.INSTANCE.AUTO_FOLLOW_INDEX.ENABLED === false) return
                                      
                                          const indexUrl = CONFIG.FOLLOWINGS.INSTANCE.AUTO_FOLLOW_INDEX.INDEX_URL
                                      
                                      
                                      Severity: Minor
                                      Found in server/core/lib/schedulers/auto-follow-index-instances.ts - About 1 hr to fix

                                        Function listRunnerJobs has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          listRunnerJobs (options: {
                                            pagination: RestPagination
                                            sort: SortMeta
                                            search?: string
                                          }) {
                                        Severity: Minor
                                        Found in client/src/app/+admin/system/runners/runner.service.ts - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language