1
0
Fork 0
This commit is contained in:
Chocobozzz 2022-07-13 11:58:01 +02:00
parent e45dd87b93
commit ba2684cedd
No known key found for this signature in database
GPG key ID: 583A612D890159BE
44 changed files with 93 additions and 63 deletions

View file

@ -43,7 +43,9 @@
2,
{
"SwitchCase": 1,
"MemberExpression": "off"
"MemberExpression": "off",
// https://github.com/eslint/eslint/issues/15299
"ignoredNodes": ["PropertyDefinition"]
}
],
"@typescript-eslint/consistent-type-assertions": [

View file

@ -29,7 +29,7 @@
"arrow-body-style": "off",
"import/no-webpack-loader-syntax": "off",
"no-underscore-dangle": "off",
"node/no-callback-literal": "off",
"n/no-callback-literal": "off",
"@angular-eslint/component-selector": [
"error",
{

View file

@ -220,6 +220,7 @@
"eslint": "^8.0.0",
"eslint-config-standard-with-typescript": "^22.0.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-n": "^15.2.4",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^6.0.0",
"fast-xml-parser": "^4.0.0-beta.8",

View file

@ -208,7 +208,7 @@ function runBenchmark (options: {
return new Promise((res, rej) => {
autocannon({
url: server.url + path,
method: method,
method,
body,
connections: 20,
headers,

View file

@ -226,7 +226,7 @@ async function registerUser (req: express.Request, res: express.Response) {
})
const { user, account, videoChannel } = await createUserAccountAndChannelAndPlaylist({
userToCreate: userToCreate,
userToCreate,
userDisplayName: body.displayName || undefined,
channelNames: body.channel
})

View file

@ -274,7 +274,7 @@ async function buildVideo (channelId: number, body: VideoImportCreate, importDat
support: body.support || null,
privacy: body.privacy || VideoPrivacy.PRIVATE,
duration: 0, // duration will be set by the import job
channelId: channelId,
channelId,
originallyPublishedAt: body.originallyPublishedAt
? new Date(body.originallyPublishedAt)
: importData.originallyPublishedAt

View file

@ -39,7 +39,7 @@ async function viewVideo (req: express.Request, res: express.Response) {
})
if (successView) {
Hooks.runAction('action:api.video.viewed', { video: video, ip, req, res })
Hooks.runAction('action:api.video.viewed', { video, ip, req, res })
}
await updateUserHistoryIfNeeded(body, video, res)

View file

@ -141,7 +141,7 @@ function buildOEmbed (options: {
html,
width: embedWidth,
height: embedHeight,
title: title,
title,
author_name: channel.name,
author_url: channel.Actor.url,
provider_name: 'PeerTube',

View file

@ -11,12 +11,12 @@ async function fetchRemoteActor (actorUrl: string): Promise<{ statusCode: number
if (sanitizeAndCheckActorObject(body) === false) {
logger.debug('Remote actor JSON is not valid.', { actorJSON: body })
return { actorObject: undefined, statusCode: statusCode }
return { actorObject: undefined, statusCode }
}
if (checkUrlsSameHost(body.id, actorUrl) !== true) {
logger.warn('Actor url %s has not the same host than its AP id %s', actorUrl, body.id)
return { actorObject: undefined, statusCode: statusCode }
return { actorObject: undefined, statusCode }
}
return {

View file

@ -166,7 +166,7 @@ function getBypassFromExternalAuth (username: string, externalAuthToken: string)
return {
bypass: true,
pluginName: npmName,
authName: authName,
authName,
user
}
}

View file

@ -8,7 +8,7 @@ function addAccountInBlocklist (byAccountId: number, targetAccountId: number) {
return sequelizeTypescript.transaction(async t => {
return AccountBlocklistModel.upsert({
accountId: byAccountId,
targetAccountId: targetAccountId
targetAccountId
}, { transaction: t })
})
}

View file

@ -115,8 +115,8 @@ async function createVideoAbuse (options: {
const videoAbuseInstance: MVideoAbuseVideoFull = await VideoAbuseModel.create({
abuseId: abuseInstance.id,
videoId: videoInstance.id,
startAt: startAt,
endAt: endAt
startAt,
endAt
}, { transaction })
videoAbuseInstance.Video = videoInstance

View file

@ -47,7 +47,7 @@ function registerOpentelemetryTracing () {
})
registerInstrumentations({
tracerProvider: tracerProvider,
tracerProvider,
instrumentations: [
new PgInstrumentation({
enhancedDatabaseReporting: true

View file

@ -563,7 +563,7 @@ export class PluginManager implements ServerHook {
if (!this.hooks[options.target]) this.hooks[options.target] = []
this.hooks[options.target].push({
npmName: npmName,
npmName,
pluginName: plugin.name,
handler: options.handler,
priority: options.priority || 0

View file

@ -97,7 +97,7 @@ export class VideoConstantManagerFactory {
}
}
this.updatedVideoConstants[type][npmName].added.push({ key: key, label } as VideoConstant)
this.updatedVideoConstants[type][npmName].added.push({ key, label } as VideoConstant)
obj[key] = label
return true

View file

@ -64,8 +64,8 @@ function buildUser (options: {
emailVerified,
adminFlags,
videoQuota: videoQuota,
videoQuotaDaily: videoQuotaDaily,
videoQuota,
videoQuotaDaily,
pluginAuth
})
@ -147,7 +147,7 @@ async function createApplicationActor (applicationId: number) {
const accountCreated = await createLocalAccountWithoutKeys({
name: SERVER_ACTOR_NAME,
userId: null,
applicationId: applicationId,
applicationId,
t: undefined,
type: 'Application'
})

View file

@ -26,7 +26,7 @@ function buildLocalVideoFromReq (videoInfo: VideoCreate, channelId: number): Fil
description: videoInfo.description,
support: videoInfo.support,
privacy: videoInfo.privacy || VideoPrivacy.PRIVATE,
channelId: channelId,
channelId,
originallyPublishedAt: videoInfo.originallyPublishedAt
? new Date(videoInfo.originallyPublishedAt)
: null
@ -122,7 +122,7 @@ async function addOptimizeOrMergeAudioJob (options: {
async function addTranscodingJob (payload: VideoTranscodingPayload, options: CreateJobOptions = {}) {
await VideoJobInfoModel.increaseOrCreate(payload.videoUUID, 'pendingTranscode')
return JobQueue.Instance.createJobWithPromise({ type: 'video-transcoding', payload: payload }, options)
return JobQueue.Instance.createJobWithPromise({ type: 'video-transcoding', payload }, options)
}
async function getTranscodingJobPriority (user: MUserId) {

View file

@ -218,7 +218,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
const query = {
where: {
actorId,
targetActorId: targetActorId
targetActorId
},
include: [
{
@ -372,7 +372,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
}) {
const { actorId, start, count, sort } = options
const where = {
actorId: actorId
actorId
}
if (options.search) {

View file

@ -53,8 +53,8 @@ export class OAuthClientModel extends Model<Partial<AttributesOnly<OAuthClientMo
static getByIdAndSecret (clientId: string, clientSecret: string) {
const query = {
where: {
clientId: clientId,
clientSecret: clientSecret
clientId,
clientSecret
}
}

View file

@ -530,7 +530,7 @@ export class VideoRedundancyModel extends Model<Partial<AttributesOnly<VideoRedu
}
if (strategy) {
Object.assign(redundancyWhere, { strategy: strategy })
Object.assign(redundancyWhere, { strategy })
}
const videoFilterWhere = {

View file

@ -488,9 +488,7 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> {
}
if (blocked !== undefined) {
Object.assign(where, {
blocked: blocked
})
Object.assign(where, { blocked })
}
const query: FindOptions = {

View file

@ -423,7 +423,7 @@ export class VideoPlaylistModel extends Model<Partial<AttributesOnly<VideoPlayli
]).then(([ count, rows ]) => ({ total: count, data: rows }))
}
static searchForApi (options: Pick<AvailableForListOptions, 'followerActorId' | 'search'| 'host'| 'uuids'> & {
static searchForApi (options: Pick<AvailableForListOptions, 'followerActorId' | 'search' | 'host' | 'uuids'> & {
start: number
count: number
sort: string

View file

@ -949,7 +949,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
const total = totalVideos + totalVideoShares
return {
data: rows,
total: total
total
}
})
}

View file

@ -163,7 +163,7 @@ describe('Test abuses API validators', function () {
it('Should fail with a wrong video', async function () {
const fields = { video: { id: 'blabla' }, reason: 'my super reason' }
await makePostBodyRequest({ url: server.url, path: path, token: userToken, fields })
await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
})
it('Should fail with an unknown video', async function () {
@ -179,7 +179,7 @@ describe('Test abuses API validators', function () {
it('Should fail with a wrong comment', async function () {
const fields = { comment: { id: 'blabla' }, reason: 'my super reason' }
await makePostBodyRequest({ url: server.url, path: path, token: userToken, fields })
await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
})
it('Should fail with an unknown comment', async function () {
@ -195,7 +195,7 @@ describe('Test abuses API validators', function () {
it('Should fail with a wrong account', async function () {
const fields = { account: { id: 'blabla' }, reason: 'my super reason' }
await makePostBodyRequest({ url: server.url, path: path, token: userToken, fields })
await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
})
it('Should fail with an unknown account', async function () {

View file

@ -51,7 +51,7 @@ describe('Test video lives API validator', function () {
const username = 'user1'
const password = 'my super password'
await server.users.create({ username: username, password: password })
await server.users.create({ username, password })
userAccessToken = await server.login.getAccessToken({ username, password })
{

View file

@ -175,7 +175,7 @@ describe('Test users admin API validators', function () {
await makePostBodyRequest({
url: server.url,
path: path,
path,
token: server.accessToken,
fields,
expectedStatus: HttpStatusCode.OK_200

View file

@ -163,7 +163,7 @@ describe('Test users API validators', function () {
url: server.url,
path: registrationPath,
token: server.accessToken,
fields: fields,
fields,
expectedStatus: HttpStatusCode.NO_CONTENT_204
})
})

View file

@ -37,14 +37,14 @@ describe('Test video blacklist API validators', function () {
{
const username = 'user1'
const password = 'my super password'
await servers[0].users.create({ username: username, password: password })
await servers[0].users.create({ username, password })
userAccessToken1 = await servers[0].login.getAccessToken({ username, password })
}
{
const username = 'user2'
const password = 'my super password'
await servers[0].users.create({ username: username, password: password })
await servers[0].users.create({ username, password })
userAccessToken2 = await servers[0].login.getAccessToken({ username, password })
}

View file

@ -35,7 +35,7 @@ describe('Test video imports API validator', function () {
const username = 'user1'
const password = 'my super password'
await server.users.create({ username: username, password: password })
await server.users.create({ username, password })
userAccessToken = await server.login.getAccessToken({ username, password })
{

View file

@ -209,7 +209,7 @@ describe('Test video playlists API validator', function () {
}
}
const getUpdate = (params: any, playlistId: number | string) => {
return { ...params, playlistId: playlistId }
return { ...params, playlistId }
}
it('Should fail with an unauthenticated user', async function () {

View file

@ -205,7 +205,7 @@ describe('Test videos API validator', function () {
support: 'my super support text',
tags: [ 'tag1', 'tag2' ],
privacy: VideoPrivacy.PUBLIC,
channelId: channelId,
channelId,
originallyPublishedAt: new Date().toISOString()
}
})

View file

@ -64,12 +64,12 @@ describe('Test videos views', function () {
})
it('Should fail without token', async function () {
await servers[0].videoStats.getOverallStats({ videoId: videoId, token: null, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
await servers[0].videoStats.getOverallStats({ videoId, token: null, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
})
it('Should fail with another token', async function () {
await servers[0].videoStats.getOverallStats({
videoId: videoId,
videoId,
token: userAccessToken,
expectedStatus: HttpStatusCode.FORBIDDEN_403
})
@ -114,7 +114,7 @@ describe('Test videos views', function () {
it('Should fail without token', async function () {
await servers[0].videoStats.getTimeserieStats({
videoId: videoId,
videoId,
token: null,
metric: 'viewers',
expectedStatus: HttpStatusCode.UNAUTHORIZED_401
@ -123,7 +123,7 @@ describe('Test videos views', function () {
it('Should fail with another token', async function () {
await servers[0].videoStats.getTimeserieStats({
videoId: videoId,
videoId,
token: userAccessToken,
metric: 'viewers',
expectedStatus: HttpStatusCode.FORBIDDEN_403
@ -198,7 +198,7 @@ describe('Test videos views', function () {
it('Should fail without token', async function () {
await servers[0].videoStats.getRetentionStats({
videoId: videoId,
videoId,
token: null,
expectedStatus: HttpStatusCode.UNAUTHORIZED_401
})
@ -206,7 +206,7 @@ describe('Test videos views', function () {
it('Should fail with another token', async function () {
await servers[0].videoStats.getRetentionStats({
videoId: videoId,
videoId,
token: userAccessToken,
expectedStatus: HttpStatusCode.FORBIDDEN_403
})

View file

@ -51,7 +51,7 @@ describe('Test admin notifications', function () {
adminNotifications = res.adminNotifications
baseParams = {
server: server,
server,
emails,
socketNotifications: adminNotifications,
token: server.accessToken

View file

@ -99,7 +99,7 @@ describe('Test notifications API', function () {
before(() => {
baseParams = {
server: server,
server,
emails,
socketNotifications: userNotifications,
token: userToken

View file

@ -53,7 +53,7 @@ async function createServers (strategy: VideoRedundancyStrategy | null, addition
strategies.push(
{
min_lifetime: '1 hour',
strategy: strategy,
strategy,
size: '400KB',
...additionalParams

View file

@ -106,7 +106,7 @@ describe('Test videos search', function () {
licence: 2,
language: 'en'
}
await server.videos.upload({ attributes: attributes })
await server.videos.upload({ attributes })
await server.videos.upload({ attributes: { ...attributes, name: attributes.name + ' duplicate' } })
}
@ -119,7 +119,7 @@ describe('Test videos search', function () {
licence: 3,
language: 'pl'
}
await server.videos.upload({ attributes: attributes })
await server.videos.upload({ attributes })
}
{
@ -210,7 +210,7 @@ describe('Test videos search', function () {
const search = {
categoryOneOf: [ 3 ]
}
const body = await command.advancedVideoSearch({ search: search })
const body = await command.advancedVideoSearch({ search })
expect(body.total).to.equal(1)

View file

@ -162,7 +162,7 @@ describe('Test handle downs', function () {
for (const state of states) {
const body = await servers[0].jobs.list({
state: state,
state,
start: 0,
count: 50,
sort: '-createdAt'

View file

@ -136,7 +136,7 @@ describe('Test video NSFW policy', function () {
it('Should create a user having the default nsfw policy', async function () {
const username = 'user1'
const password = 'my super password'
await server.users.create({ username: username, password: password })
await server.users.create({ username, password })
userAccessToken = await server.login.getAccessToken({ username, password })

View file

@ -395,7 +395,7 @@ describe('Test plugin filter hooks', function () {
const uuids: string[] = []
for (const name of [ 'bad torrent', 'bad file', 'bad playlist file' ]) {
const uuid = (await servers[0].videos.quickUpload({ name: name })).uuid
const uuid = (await servers[0].videos.quickUpload({ name })).uuid
uuids.push(uuid)
}
@ -446,7 +446,7 @@ describe('Test plugin filter hooks', function () {
for (const name of [ 'bad embed', 'good embed' ]) {
{
const uuid = (await servers[0].videos.quickUpload({ name: name })).uuid
const uuid = (await servers[0].videos.quickUpload({ name })).uuid
embedVideos.push(await servers[0].videos.get({ id: uuid }))
}

View file

@ -780,7 +780,7 @@ async function checkNotification (options: CheckerBaseParams & {
const check = options.check || { web: true, mail: true }
if (check.web) {
const notification = await server.notifications.getLatest({ token: token })
const notification = await server.notifications.getLatest({ token })
if (notification || checkType !== 'absence') {
notificationChecker(notification, checkType)

View file

@ -52,7 +52,7 @@ function makeActivityPubGetRequest (url: string, path: string, expectedStatus =
return makeGetRequest({
url,
path,
expectedStatus: expectedStatus,
expectedStatus,
accept: 'application/activity+json,text/html;q=0.9,\\*/\\*;q=0.8'
})
}

View file

@ -74,7 +74,7 @@ export class SearchCommand extends AbstractCommand {
...options,
search: {
search: search,
search,
sort: sort ?? '-publishedAt'
}
})

View file

@ -60,7 +60,7 @@ export class LoginCommand extends AbstractCommand {
const body = {
client_id: this.server.store.client.id,
client_secret: this.server.store.client.secret,
username: username,
username,
response_type: 'code',
grant_type: 'password',
scope: 'upload',

View file

@ -3157,6 +3157,13 @@ bufrw@^1.3.0:
hexer "^1.5.0"
xtend "^4.0.0"
builtins@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/builtins/-/builtins-5.0.1.tgz#87f6db9ab0458be728564fa81d876d8d74552fa9"
integrity sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==
dependencies:
semver "^7.0.0"
bull@^4.1.0:
version "4.8.4"
resolved "https://registry.yarnpkg.com/bull/-/bull-4.8.4.tgz#c538610492050d5160dbd9180704145f135a0aa9"
@ -4350,6 +4357,14 @@ eslint-plugin-es@^3.0.0:
eslint-utils "^2.0.0"
regexpp "^3.0.0"
eslint-plugin-es@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz#f0822f0c18a535a97c3e714e89f88586a7641ec9"
integrity sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==
dependencies:
eslint-utils "^2.0.0"
regexpp "^3.0.0"
eslint-plugin-import@^2.20.1:
version "2.26.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz#f812dc47be4f2b72b478a021605a59fc6fe8b88b"
@ -4369,6 +4384,20 @@ eslint-plugin-import@^2.20.1:
resolve "^1.22.0"
tsconfig-paths "^3.14.1"
eslint-plugin-n@^15.2.4:
version "15.2.4"
resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-15.2.4.tgz#d62021a0821ae650701ed459756aaf478a9b6056"
integrity sha512-tjnVMv2fiXYMnuiIFI8QMtyUFI42SckEEWvi8h68SWGWshfqO6SSCASy24dGMGAiy7NUk6DZt90DM0iNUsmQ5w==
dependencies:
builtins "^5.0.1"
eslint-plugin-es "^4.1.0"
eslint-utils "^3.0.0"
ignore "^5.1.1"
is-core-module "^2.9.0"
minimatch "^3.1.2"
resolve "^1.10.1"
semver "^7.3.7"
eslint-plugin-node@^11.0.0:
version "11.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz#c95544416ee4ada26740a30474eefc5402dc671d"
@ -8005,7 +8034,7 @@ semver@^6.0.0, semver@^6.1.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
semver@^7.3.2, semver@^7.3.5, semver@^7.3.7:
semver@^7.0.0, semver@^7.3.2, semver@^7.3.5, semver@^7.3.7:
version "7.3.7"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f"
integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==