Chocobozzz/PeerTube

View on GitHub

Showing 1,292 of 3,313 total issues

Function runMetricsInterval has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private runMetricsInterval () {
    if (this.metricsInterval) clearInterval(this.metricsInterval)
    if (!this.options_.metricsUrl()) return

    this.metricsInterval = setInterval(() => {
Severity: Minor
Found in client/src/assets/player/shared/metrics/metrics-plugin.ts - About 1 hr to fix

    Function content has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const content = () => {
          const self = this
          const player = this.player
    
          const shortUUID = self.currentLoadOptions.videoShortUUID
    Severity: Minor
    Found in client/src/assets/player/peertube-player.ts - About 1 hr to fix

      Function runUserViewing has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private runUserViewing () {
          const startTime = timeToInt(this.options.startTime())
      
          let lastCurrentTime = startTime
          let lastViewEvent: VideoViewEvent
      Severity: Minor
      Found in client/src/assets/player/shared/peertube/peertube-plugin.ts - About 1 hr to fix

        Function buildPieData has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          buildPieData (stats: VideosRedundancyStats) {
            if (stats.totalSize === 0) return
        
            const totalAvailable = stats.totalSize
              ? stats.totalSize - stats.totalUsed

          Function buildAdminParamsFromSearch has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private buildAdminParamsFromSearch (search: string, params: HttpParams) {
              let include = VideoInclude.BLACKLISTED |
                VideoInclude.BLOCKED_OWNER |
                VideoInclude.NOT_PUBLISHED_STATE |
                VideoInclude.FILES |
          Severity: Minor
          Found in client/src/app/+admin/overview/videos/video-admin.service.ts - About 1 hr to fix

            Function buildChartOptions has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private buildChartOptions () {
                const channelsMinimumDailyViews = Math.min(...this.videoChannels.map(v => minBy(v.viewsPerDay, 'views').views))
                const channelsMaximumDailyViews = Math.max(...this.videoChannels.map(v => maxBy(v.viewsPerDay, 'views').views))
            
                this.chartOptions = {

              Function getPrefefinedReasons has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                getPrefefinedReasons (type: AbuseFilter) {
                  let reasons: { id: AbusePredefinedReasonsString, label: string, description?: string, help?: string }[] = [
                    {
                      id: 'violentOrRepulsive',
                      label: $localize`Violent or repulsive`,
              Severity: Minor
              Found in client/src/app/shared/shared-moderation/abuse.service.ts - About 1 hr to fix

                Function tasksBuilder has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function tasksBuilder () {
                    const tasks: Promise<any>[] = []
                
                    // Check if each server has pending request
                    for (const server of servers) {
                Severity: Minor
                Found in packages/server-commands/src/server/jobs.ts - About 1 hr to fix

                  Function buildLanguages has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export async function buildLanguages () {
                    const { iso6393 } = await import('iso-639-3')
                  
                    const languages: { [id: string]: string } = {}
                  
                  
                  Severity: Minor
                  Found in server/core/initializers/constants.ts - About 1 hr to fix

                    Function checkHttpSignature has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    async function checkHttpSignature (req: Request, res: Response) {
                      return wrapWithSpanAndContext('peertube.activitypub.checkHTTPSignature', async () => {
                        // FIXME: compatibility with http-signature < v1.3
                        const sig = req.headers[HTTP_SIGNATURE.HEADER_NAME] as string
                        if (sig && sig.startsWith('Signature ') === true) req.headers[HTTP_SIGNATURE.HEADER_NAME] = sig.replace(/^Signature /, '')
                    Severity: Minor
                    Found in server/core/middlewares/activitypub.ts - About 1 hr to fix

                      Function sanitizeAndCheckVideoTorrentObject has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function sanitizeAndCheckVideoTorrentObject (video: VideoObject) {
                        if (!video || video.type !== 'Video') return false
                      
                        const fail = (field: string) => {
                          logger.debug(`Video field is not valid to PeerTube: ${field}`, { video })
                      Severity: Minor
                      Found in server/core/helpers/custom-validators/activitypub/videos.ts - About 1 hr to fix

                        Function showCard has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          showCard (cb: (canceled: boolean) => void) {
                            this.autoplayRing.setAttribute('stroke-dasharray', `${this.dashOffsetStart}`)
                            this.autoplayRing.setAttribute('stroke-dashoffset', `${-this.dashOffsetStart}`)
                        
                            this.title.innerText = this.options_.getTitle()
                        Severity: Minor
                        Found in client/src/assets/player/shared/upnext/end-card.ts - About 1 hr to fix

                          Function getPluginOptions has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            async getPluginOptions () {
                              const segmentsSha256Url = this.options.hls.segmentsSha256Url
                          
                              if (!segmentsSha256Url) {
                                logger.info('No segmentsSha256Url found. Disabling P2P & redundancy.')

                            Function ngOnInit has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              ngOnInit () {
                                this.serverConfig = this.serverService.getHTMLConfig()
                            
                                this.updateForm()
                            
                            
                            Severity: Minor
                            Found in client/src/app/+videos/+video-edit/shared/video-edit.component.ts - About 1 hr to fix

                              Function constructor has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                constructor (
                                  private serverService: ServerService
                                ) {
                                  this.publishedDateRanges = [
                                    {
                              Severity: Minor
                              Found in client/src/app/+search/search-filters.component.ts - About 1 hr to fix

                                Function refreshFetch has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  private refreshFetch (url: string, options?: RequestInit) {
                                    return fetch(url, options)
                                      .then((res: Response) => {
                                        if (res.status !== HttpStatusCode.UNAUTHORIZED_401) return res
                                
                                
                                Severity: Minor
                                Found in client/src/standalone/videos/shared/auth-http.ts - About 1 hr to fix

                                  Function getEncoderBuilderResult has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    async getEncoderBuilderResult (options: EncoderOptionsBuilderParams & {
                                      streamType: 'video' | 'audio'
                                      input: string
                                  
                                      videoType: 'vod' | 'live'
                                  Severity: Minor
                                  Found in packages/ffmpeg/src/ffmpeg-command-wrapper.ts - About 1 hr to fix

                                    Function listLocalByVideoId has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      static async listLocalByVideoId (videoId: number): Promise<MVideoRedundancyVideo[]> {
                                        const actor = await getServerActor()
                                    
                                        const queryStreamingPlaylist = {
                                          where: {
                                    Severity: Minor
                                    Found in server/core/models/redundancy/video-redundancy.ts - About 1 hr to fix

                                      Function buildModerationHelpers has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      function buildModerationHelpers () {
                                        return {
                                          blockServer: async (options: { byAccountId: number, hostToBlock: string }) => {
                                            const serverToBlock = await ServerModel.loadOrCreateByHost(options.hostToBlock)
                                            const user = await UserModel.loadByAccountId(options.byAccountId)
                                      Severity: Minor
                                      Found in server/core/lib/plugins/plugin-helpers-builder.ts - About 1 hr to fix

                                        Function downloadPlaylistSegments has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        export function downloadPlaylistSegments (playlistUrl: string, destinationDir: string, timeout: number, bodyKBLimit: number) {
                                          let timer
                                          let remainingBodyKBLimit = bodyKBLimit
                                        
                                          logger.info('Importing HLS playlist %s', playlistUrl)
                                        Severity: Minor
                                        Found in server/core/lib/hls.ts - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language