mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-09-11 21:47:09 +03:00
Update server dependencies
This commit is contained in:
parent
f6e0de3f48
commit
d5d9b6d7bf
22
package.json
22
package.json
@ -107,7 +107,7 @@
|
|||||||
"body-parser": "^1.12.4",
|
"body-parser": "^1.12.4",
|
||||||
"bull": "^3.4.2",
|
"bull": "^3.4.2",
|
||||||
"bytes": "^3.0.0",
|
"bytes": "^3.0.0",
|
||||||
"commander": "^2.13.0",
|
"commander": "^3.0.2",
|
||||||
"config": "^3.0.0",
|
"config": "^3.0.0",
|
||||||
"cookie-parser": "^1.4.3",
|
"cookie-parser": "^1.4.3",
|
||||||
"cors": "^2.8.1",
|
"cors": "^2.8.1",
|
||||||
@ -146,17 +146,17 @@
|
|||||||
"reflect-metadata": "^0.1.12",
|
"reflect-metadata": "^0.1.12",
|
||||||
"request": "^2.81.0",
|
"request": "^2.81.0",
|
||||||
"scripty": "^1.5.0",
|
"scripty": "^1.5.0",
|
||||||
"sequelize": "5.13.1",
|
"sequelize": "5.21.1",
|
||||||
"sequelize-typescript": "^1.0.0-beta.4",
|
"sequelize-typescript": "^1.0.0-beta.4",
|
||||||
"sharp": "^0.22.0",
|
"sharp": "^0.23.1",
|
||||||
"sitemap": "^2",
|
"sitemap": "^5.0.0",
|
||||||
"socket.io": "^2.2.0",
|
"socket.io": "^2.2.0",
|
||||||
"srt-to-vtt": "^1.1.2",
|
"srt-to-vtt": "^1.1.2",
|
||||||
"useragent": "^2.3.0",
|
"useragent": "^2.3.0",
|
||||||
"uuid": "^3.1.0",
|
"uuid": "^3.1.0",
|
||||||
"validator": "^11.0.0",
|
"validator": "^11.0.0",
|
||||||
"webfinger.js": "^2.6.6",
|
"webfinger.js": "^2.6.6",
|
||||||
"webtorrent": "^0.105.1",
|
"webtorrent": "^0.107.16",
|
||||||
"winston": "3.2.1",
|
"winston": "3.2.1",
|
||||||
"ws": "^7.0.0",
|
"ws": "^7.0.0",
|
||||||
"youtube-dl": "^2.0.0"
|
"youtube-dl": "^2.0.0"
|
||||||
@ -194,21 +194,21 @@
|
|||||||
"@types/pem": "^1.9.3",
|
"@types/pem": "^1.9.3",
|
||||||
"@types/redis": "^2.8.5",
|
"@types/redis": "^2.8.5",
|
||||||
"@types/request": "^2.0.3",
|
"@types/request": "^2.0.3",
|
||||||
"@types/sharp": "^0.22.1",
|
"@types/sharp": "^0.23.0",
|
||||||
"@types/socket.io": "^2.1.2",
|
"@types/socket.io": "^2.1.2",
|
||||||
"@types/supertest": "^2.0.3",
|
"@types/supertest": "^2.0.3",
|
||||||
"@types/validator": "^10.9.0",
|
"@types/validator": "^10.9.0",
|
||||||
"@types/webtorrent": "^0.98.4",
|
"@types/webtorrent": "^0.107.0",
|
||||||
"@types/ws": "^6.0.0",
|
"@types/ws": "^6.0.0",
|
||||||
"chai": "^4.1.1",
|
"chai": "^4.1.1",
|
||||||
"chai-json-schema": "^1.5.0",
|
"chai-json-schema": "^1.5.0",
|
||||||
"chai-xml": "^0.3.2",
|
"chai-xml": "^0.3.2",
|
||||||
"concurrently": "^4.1.0",
|
"concurrently": "^5.0.0",
|
||||||
"husky": "^3.0.1",
|
"husky": "^3.0.1",
|
||||||
"libxmljs": "0.19.5",
|
"libxmljs": "0.19.7",
|
||||||
"lint-staged": "^9.2.0",
|
"lint-staged": "^9.2.0",
|
||||||
"maildev": "^1.0.0-rc3",
|
"maildev": "^1.0.0-rc3",
|
||||||
"marked-man": "^0.6.0",
|
"marked-man": "^0.7.0",
|
||||||
"mocha": "^6.0.0",
|
"mocha": "^6.0.0",
|
||||||
"mocha-parallel-tests": "^2.2.1",
|
"mocha-parallel-tests": "^2.2.1",
|
||||||
"nodemon": "^1.18.6",
|
"nodemon": "^1.18.6",
|
||||||
@ -216,7 +216,7 @@
|
|||||||
"source-map-support": "^0.5.0",
|
"source-map-support": "^0.5.0",
|
||||||
"supertest": "^4.0.2",
|
"supertest": "^4.0.2",
|
||||||
"swagger-cli": "^2.2.0",
|
"swagger-cli": "^2.2.0",
|
||||||
"ts-node": "8.3.0",
|
"ts-node": "8.4.1",
|
||||||
"tslint": "^5.7.0",
|
"tslint": "^5.7.0",
|
||||||
"tslint-config-standard": "^8.0.1",
|
"tslint-config-standard": "^8.0.1",
|
||||||
"typescript": "^3.4.3",
|
"typescript": "^3.4.3",
|
||||||
|
@ -36,8 +36,8 @@ export {
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
async function listJobs (req: express.Request, res: express.Response, next: express.NextFunction) {
|
async function listJobs (req: express.Request, res: express.Response) {
|
||||||
const state: JobState = req.params.state
|
const state = req.params.state as JobState
|
||||||
const asc = req.query.sort === 'createdAt'
|
const asc = req.query.sort === 'createdAt'
|
||||||
|
|
||||||
const jobs = await JobQueue.Instance.listForApi(state, req.query.start, req.query.count, asc)
|
const jobs = await JobQueue.Instance.listForApi(state, req.query.start, req.query.count, asc)
|
||||||
|
@ -2,7 +2,6 @@ import * as express from 'express'
|
|||||||
import { asyncMiddleware } from '../middlewares'
|
import { asyncMiddleware } from '../middlewares'
|
||||||
import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants'
|
import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants'
|
||||||
import * as sitemapModule from 'sitemap'
|
import * as sitemapModule from 'sitemap'
|
||||||
import { logger } from '../helpers/logger'
|
|
||||||
import { VideoModel } from '../models/video/video'
|
import { VideoModel } from '../models/video/video'
|
||||||
import { VideoChannelModel } from '../models/video/video-channel'
|
import { VideoChannelModel } from '../models/video/video-channel'
|
||||||
import { AccountModel } from '../models/account/account'
|
import { AccountModel } from '../models/account/account'
|
||||||
@ -39,15 +38,10 @@ async function getSitemap (req: express.Request, res: express.Response) {
|
|||||||
urls: urls
|
urls: urls
|
||||||
})
|
})
|
||||||
|
|
||||||
sitemap.toXML((err, xml) => {
|
const xml = sitemap.toXML()
|
||||||
if (err) {
|
|
||||||
logger.error('Cannot generate sitemap.', { err })
|
|
||||||
return res.sendStatus(500)
|
|
||||||
}
|
|
||||||
|
|
||||||
res.header('Content-Type', 'application/xml')
|
res.header('Content-Type', 'application/xml')
|
||||||
res.send(xml)
|
res.send(xml)
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getSitemapVideoChannelUrls () {
|
async function getSitemapVideoChannelUrls () {
|
||||||
|
@ -3,7 +3,8 @@ import { VideoChangeOwnershipModel } from '../../models/video/video-change-owner
|
|||||||
import { MVideoChangeOwnershipFull } from '@server/typings/models/video/video-change-ownership'
|
import { MVideoChangeOwnershipFull } from '@server/typings/models/video/video-change-ownership'
|
||||||
import { MUserId } from '@server/typings/models'
|
import { MUserId } from '@server/typings/models'
|
||||||
|
|
||||||
export async function doesChangeVideoOwnershipExist (id: number, res: Response) {
|
export async function doesChangeVideoOwnershipExist (idArg: number | string, res: Response) {
|
||||||
|
const id = parseInt(idArg + '', 10)
|
||||||
const videoChangeOwnership = await VideoChangeOwnershipModel.load(id)
|
const videoChangeOwnership = await VideoChangeOwnershipModel.load(id)
|
||||||
|
|
||||||
if (!videoChangeOwnership) {
|
if (!videoChangeOwnership) {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { Response } from 'express'
|
import { Response } from 'express'
|
||||||
import { VideoAbuseModel } from '../../models/video/video-abuse'
|
import { VideoAbuseModel } from '../../models/video/video-abuse'
|
||||||
|
|
||||||
async function doesVideoAbuseExist (abuseId: number, videoId: number, res: Response) {
|
async function doesVideoAbuseExist (abuseIdArg: number | string, videoId: number, res: Response) {
|
||||||
|
const abuseId = parseInt(abuseIdArg + '', 10)
|
||||||
const videoAbuse = await VideoAbuseModel.loadByIdAndVideoId(abuseId, videoId)
|
const videoAbuse = await VideoAbuseModel.loadByIdAndVideoId(abuseId, videoId)
|
||||||
|
|
||||||
if (videoAbuse === null) {
|
if (videoAbuse === null) {
|
||||||
|
@ -55,7 +55,7 @@ async function sendUpdateActor (accountOrChannel: MChannelDefault | MAccountDefa
|
|||||||
logger.info('Creating job to update actor %s.', byActor.url)
|
logger.info('Creating job to update actor %s.', byActor.url)
|
||||||
|
|
||||||
const url = getUpdateActivityPubUrl(byActor.url, byActor.updatedAt.toISOString())
|
const url = getUpdateActivityPubUrl(byActor.url, byActor.updatedAt.toISOString())
|
||||||
const accountOrChannelObject = accountOrChannel.toActivityPubObject()
|
const accountOrChannelObject = (accountOrChannel as any).toActivityPubObject() // FIXME: typescript bug?
|
||||||
const audience = getAudience(byActor)
|
const audience = getAudience(byActor)
|
||||||
const updateActivity = buildUpdateActivity(url, byActor, accountOrChannelObject, audience)
|
const updateActivity = buildUpdateActivity(url, byActor, accountOrChannelObject, audience)
|
||||||
|
|
||||||
|
@ -25,8 +25,12 @@ const videoFileRedundancyGetValidator = [
|
|||||||
if (!await doesVideoExist(req.params.videoId, res)) return
|
if (!await doesVideoExist(req.params.videoId, res)) return
|
||||||
|
|
||||||
const video = res.locals.videoAll
|
const video = res.locals.videoAll
|
||||||
|
|
||||||
|
const paramResolution = req.params.resolution as unknown as number // We casted to int above
|
||||||
|
const paramFPS = req.params.fps as unknown as number // We casted to int above
|
||||||
|
|
||||||
const videoFile = video.VideoFiles.find(f => {
|
const videoFile = video.VideoFiles.find(f => {
|
||||||
return f.resolution === req.params.resolution && (!req.params.fps || f.fps === req.params.fps)
|
return f.resolution === paramResolution && (!req.params.fps || paramFPS)
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!videoFile) return res.status(404).json({ error: 'Video file not found.' })
|
if (!videoFile) return res.status(404).json({ error: 'Video file not found.' })
|
||||||
@ -41,8 +45,12 @@ const videoFileRedundancyGetValidator = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
const videoPlaylistRedundancyGetValidator = [
|
const videoPlaylistRedundancyGetValidator = [
|
||||||
param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid video id'),
|
param('videoId')
|
||||||
param('streamingPlaylistType').custom(exists).withMessage('Should have a valid streaming playlist type'),
|
.custom(isIdOrUUIDValid)
|
||||||
|
.not().isEmpty().withMessage('Should have a valid video id'),
|
||||||
|
param('streamingPlaylistType')
|
||||||
|
.customSanitizer(toIntOrNull)
|
||||||
|
.custom(exists).withMessage('Should have a valid streaming playlist type'),
|
||||||
|
|
||||||
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
|
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||||
logger.debug('Checking videoPlaylistRedundancyGetValidator parameters', { parameters: req.params })
|
logger.debug('Checking videoPlaylistRedundancyGetValidator parameters', { parameters: req.params })
|
||||||
@ -51,7 +59,9 @@ const videoPlaylistRedundancyGetValidator = [
|
|||||||
if (!await doesVideoExist(req.params.videoId, res)) return
|
if (!await doesVideoExist(req.params.videoId, res)) return
|
||||||
|
|
||||||
const video = res.locals.videoAll
|
const video = res.locals.videoAll
|
||||||
const videoStreamingPlaylist = video.VideoStreamingPlaylists.find(p => p === req.params.streamingPlaylistType)
|
|
||||||
|
const paramPlaylistType = req.params.streamingPlaylistType as unknown as number // We casted to int above
|
||||||
|
const videoStreamingPlaylist = video.VideoStreamingPlaylists.find(p => p.type === paramPlaylistType)
|
||||||
|
|
||||||
if (!videoStreamingPlaylist) return res.status(404).json({ error: 'Video playlist not found.' })
|
if (!videoStreamingPlaylist) return res.status(404).json({ error: 'Video playlist not found.' })
|
||||||
res.locals.videoStreamingPlaylist = videoStreamingPlaylist
|
res.locals.videoStreamingPlaylist = videoStreamingPlaylist
|
||||||
|
@ -448,7 +448,8 @@ export {
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function checkUserIdExist (id: number, res: express.Response) {
|
function checkUserIdExist (idArg: number | string, res: express.Response) {
|
||||||
|
const id = parseInt(idArg + '', 10)
|
||||||
return checkUserExist(() => UserModel.loadById(id), res)
|
return checkUserExist(() => UserModel.loadById(id), res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,8 @@ export {
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
async function doesVideoCommentThreadExist (id: number, video: MVideoId, res: express.Response) {
|
async function doesVideoCommentThreadExist (idArg: number | string, video: MVideoId, res: express.Response) {
|
||||||
|
const id = parseInt(idArg + '', 10)
|
||||||
const videoComment = await VideoCommentModel.loadById(id)
|
const videoComment = await VideoCommentModel.loadById(id)
|
||||||
|
|
||||||
if (!videoComment) {
|
if (!videoComment) {
|
||||||
@ -151,7 +152,8 @@ async function doesVideoCommentThreadExist (id: number, video: MVideoId, res: ex
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
async function doesVideoCommentExist (id: number, video: MVideoId, res: express.Response) {
|
async function doesVideoCommentExist (idArg: number | string, video: MVideoId, res: express.Response) {
|
||||||
|
const id = parseInt(idArg + '', 10)
|
||||||
const videoComment = await VideoCommentModel.loadByIdAndPopulateVideoAndAccountAndReply(id)
|
const videoComment = await VideoCommentModel.loadByIdAndPopulateVideoAndAccountAndReply(id)
|
||||||
|
|
||||||
if (!videoComment) {
|
if (!videoComment) {
|
||||||
|
@ -150,7 +150,7 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> {
|
|||||||
static loadLocalAndPopulateVideo (
|
static loadLocalAndPopulateVideo (
|
||||||
rateType: VideoRateType,
|
rateType: VideoRateType,
|
||||||
accountName: string,
|
accountName: string,
|
||||||
videoId: number,
|
videoId: number | string,
|
||||||
t?: Transaction
|
t?: Transaction
|
||||||
): Bluebird<MAccountVideoRateAccountVideo> {
|
): Bluebird<MAccountVideoRateAccountVideo> {
|
||||||
const options: FindOptions = {
|
const options: FindOptions = {
|
||||||
|
@ -430,8 +430,6 @@ export class ActorModel extends Model<ActorModel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toActivityPubObject (this: MActorAP, name: string) {
|
toActivityPubObject (this: MActorAP, name: string) {
|
||||||
let activityPubType
|
|
||||||
|
|
||||||
let icon = undefined
|
let icon = undefined
|
||||||
if (this.avatarId) {
|
if (this.avatarId) {
|
||||||
const extension = extname(this.Avatar.filename)
|
const extension = extname(this.Avatar.filename)
|
||||||
|
@ -99,7 +99,7 @@ export class VideoFileModel extends Model<VideoFileModel> {
|
|||||||
static doesInfohashExist (infoHash: string) {
|
static doesInfohashExist (infoHash: string) {
|
||||||
const query = 'SELECT 1 FROM "videoFile" WHERE "infoHash" = $infoHash LIMIT 1'
|
const query = 'SELECT 1 FROM "videoFile" WHERE "infoHash" = $infoHash LIMIT 1'
|
||||||
const options = {
|
const options = {
|
||||||
type: QueryTypes.SELECT,
|
type: QueryTypes.SELECT as QueryTypes.SELECT,
|
||||||
bind: { infoHash },
|
bind: { infoHash },
|
||||||
raw: true
|
raw: true
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ export class VideoPlaylistElementModel extends Model<VideoPlaylistElementModel>
|
|||||||
return VideoPlaylistElementModel.findOne(query)
|
return VideoPlaylistElementModel.findOne(query)
|
||||||
}
|
}
|
||||||
|
|
||||||
static loadById (playlistElementId: number): Bluebird<MVideoPlaylistElement> {
|
static loadById (playlistElementId: number | string): Bluebird<MVideoPlaylistElement> {
|
||||||
return VideoPlaylistElementModel.findByPk(playlistElementId)
|
return VideoPlaylistElementModel.findByPk(playlistElementId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ export class VideoShareModel extends Model<VideoShareModel> {
|
|||||||
})
|
})
|
||||||
Video: VideoModel
|
Video: VideoModel
|
||||||
|
|
||||||
static load (actorId: number, videoId: number, t?: Transaction): Bluebird<MVideoShareActor> {
|
static load (actorId: number | string, videoId: number | string, t?: Transaction): Bluebird<MVideoShareActor> {
|
||||||
return VideoShareModel.scope(ScopeNames.WITH_ACTOR).findOne({
|
return VideoShareModel.scope(ScopeNames.WITH_ACTOR).findOne({
|
||||||
where: {
|
where: {
|
||||||
actorId,
|
actorId,
|
||||||
|
@ -1608,7 +1608,7 @@ export class VideoModel extends Model<VideoModel> {
|
|||||||
'LIMIT 1'
|
'LIMIT 1'
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
type: QueryTypes.SELECT,
|
type: QueryTypes.SELECT as QueryTypes.SELECT,
|
||||||
bind: { followerActorId, videoId },
|
bind: { followerActorId, videoId },
|
||||||
raw: true
|
raw: true
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,11 @@
|
|||||||
"es2016",
|
"es2016",
|
||||||
"es2017"
|
"es2017"
|
||||||
],
|
],
|
||||||
"typeRoots": [ "node_modules/@types", "server/typings" ],
|
"typeRoots": [
|
||||||
|
"node_modules/sitemap/node_modules/@types",
|
||||||
|
"node_modules/@types",
|
||||||
|
"server/typings"
|
||||||
|
],
|
||||||
"baseUrl": "./",
|
"baseUrl": "./",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@server/*": [ "server/*" ],
|
"@server/*": [ "server/*" ],
|
||||||
|
Loading…
Reference in New Issue
Block a user