Showing 1,292 of 3,313 total issues
Function runMetricsInterval
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private runMetricsInterval () {
if (this.metricsInterval) clearInterval(this.metricsInterval)
if (!this.options_.metricsUrl()) return
this.metricsInterval = setInterval(() => {
Function content
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const content = () => {
const self = this
const player = this.player
const shortUUID = self.currentLoadOptions.videoShortUUID
Function runUserViewing
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private runUserViewing () {
const startTime = timeToInt(this.options.startTime())
let lastCurrentTime = startTime
let lastViewEvent: VideoViewEvent
Function buildPieData
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Open
private buildAdminParamsFromSearch (search: string, params: HttpParams) {
let include = VideoInclude.BLACKLISTED |
VideoInclude.BLOCKED_OWNER |
VideoInclude.NOT_PUBLISHED_STATE |
VideoInclude.FILES |
Function buildChartOptions
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Open
getPrefefinedReasons (type: AbuseFilter) {
let reasons: { id: AbusePredefinedReasonsString, label: string, description?: string, help?: string }[] = [
{
id: 'violentOrRepulsive',
label: $localize`Violent or repulsive`,
Function tasksBuilder
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function tasksBuilder () {
const tasks: Promise<any>[] = []
// Check if each server has pending request
for (const server of servers) {
Function buildLanguages
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function buildLanguages () {
const { iso6393 } = await import('iso-639-3')
const languages: { [id: string]: string } = {}
Function checkHttpSignature
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 /, '')
Function sanitizeAndCheckVideoTorrentObject
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 })
Function showCard
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
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()
Function getPluginOptions
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Open
ngOnInit () {
this.serverConfig = this.serverService.getHTMLConfig()
this.updateForm()
Function constructor
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor (
private serverService: ServerService
) {
this.publishedDateRanges = [
{
Function refreshFetch
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private refreshFetch (url: string, options?: RequestInit) {
return fetch(url, options)
.then((res: Response) => {
if (res.status !== HttpStatusCode.UNAUTHORIZED_401) return res
Function getEncoderBuilderResult
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getEncoderBuilderResult (options: EncoderOptionsBuilderParams & {
streamType: 'video' | 'audio'
input: string
videoType: 'vod' | 'live'
Function listLocalByVideoId
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async listLocalByVideoId (videoId: number): Promise<MVideoRedundancyVideo[]> {
const actor = await getServerActor()
const queryStreamingPlaylist = {
where: {
Function buildModerationHelpers
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
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)
Function downloadPlaylistSegments
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function downloadPlaylistSegments (playlistUrl: string, destinationDir: string, timeout: number, bodyKBLimit: number) {
let timer
let remainingBodyKBLimit = bodyKBLimit
logger.info('Importing HLS playlist %s', playlistUrl)