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",
|
||||
"bull": "^3.4.2",
|
||||
"bytes": "^3.0.0",
|
||||
"commander": "^2.13.0",
|
||||
"commander": "^3.0.2",
|
||||
"config": "^3.0.0",
|
||||
"cookie-parser": "^1.4.3",
|
||||
"cors": "^2.8.1",
|
||||
|
@ -146,17 +146,17 @@
|
|||
"reflect-metadata": "^0.1.12",
|
||||
"request": "^2.81.0",
|
||||
"scripty": "^1.5.0",
|
||||
"sequelize": "5.13.1",
|
||||
"sequelize": "5.21.1",
|
||||
"sequelize-typescript": "^1.0.0-beta.4",
|
||||
"sharp": "^0.22.0",
|
||||
"sitemap": "^2",
|
||||
"sharp": "^0.23.1",
|
||||
"sitemap": "^5.0.0",
|
||||
"socket.io": "^2.2.0",
|
||||
"srt-to-vtt": "^1.1.2",
|
||||
"useragent": "^2.3.0",
|
||||
"uuid": "^3.1.0",
|
||||
"validator": "^11.0.0",
|
||||
"webfinger.js": "^2.6.6",
|
||||
"webtorrent": "^0.105.1",
|
||||
"webtorrent": "^0.107.16",
|
||||
"winston": "3.2.1",
|
||||
"ws": "^7.0.0",
|
||||
"youtube-dl": "^2.0.0"
|
||||
|
@ -194,21 +194,21 @@
|
|||
"@types/pem": "^1.9.3",
|
||||
"@types/redis": "^2.8.5",
|
||||
"@types/request": "^2.0.3",
|
||||
"@types/sharp": "^0.22.1",
|
||||
"@types/sharp": "^0.23.0",
|
||||
"@types/socket.io": "^2.1.2",
|
||||
"@types/supertest": "^2.0.3",
|
||||
"@types/validator": "^10.9.0",
|
||||
"@types/webtorrent": "^0.98.4",
|
||||
"@types/webtorrent": "^0.107.0",
|
||||
"@types/ws": "^6.0.0",
|
||||
"chai": "^4.1.1",
|
||||
"chai-json-schema": "^1.5.0",
|
||||
"chai-xml": "^0.3.2",
|
||||
"concurrently": "^4.1.0",
|
||||
"concurrently": "^5.0.0",
|
||||
"husky": "^3.0.1",
|
||||
"libxmljs": "0.19.5",
|
||||
"libxmljs": "0.19.7",
|
||||
"lint-staged": "^9.2.0",
|
||||
"maildev": "^1.0.0-rc3",
|
||||
"marked-man": "^0.6.0",
|
||||
"marked-man": "^0.7.0",
|
||||
"mocha": "^6.0.0",
|
||||
"mocha-parallel-tests": "^2.2.1",
|
||||
"nodemon": "^1.18.6",
|
||||
|
@ -216,7 +216,7 @@
|
|||
"source-map-support": "^0.5.0",
|
||||
"supertest": "^4.0.2",
|
||||
"swagger-cli": "^2.2.0",
|
||||
"ts-node": "8.3.0",
|
||||
"ts-node": "8.4.1",
|
||||
"tslint": "^5.7.0",
|
||||
"tslint-config-standard": "^8.0.1",
|
||||
"typescript": "^3.4.3",
|
||||
|
|
|
@ -36,8 +36,8 @@ export {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function listJobs (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const state: JobState = req.params.state
|
||||
async function listJobs (req: express.Request, res: express.Response) {
|
||||
const state = req.params.state as JobState
|
||||
const asc = req.query.sort === 'createdAt'
|
||||
|
||||
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 { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants'
|
||||
import * as sitemapModule from 'sitemap'
|
||||
import { logger } from '../helpers/logger'
|
||||
import { VideoModel } from '../models/video/video'
|
||||
import { VideoChannelModel } from '../models/video/video-channel'
|
||||
import { AccountModel } from '../models/account/account'
|
||||
|
@ -39,15 +38,10 @@ async function getSitemap (req: express.Request, res: express.Response) {
|
|||
urls: urls
|
||||
})
|
||||
|
||||
sitemap.toXML((err, xml) => {
|
||||
if (err) {
|
||||
logger.error('Cannot generate sitemap.', { err })
|
||||
return res.sendStatus(500)
|
||||
}
|
||||
const xml = sitemap.toXML()
|
||||
|
||||
res.header('Content-Type', 'application/xml')
|
||||
res.send(xml)
|
||||
})
|
||||
}
|
||||
|
||||
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 { 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)
|
||||
|
||||
if (!videoChangeOwnership) {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { Response } from 'express'
|
||||
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)
|
||||
|
||||
if (videoAbuse === null) {
|
||||
|
|
|
@ -55,7 +55,7 @@ async function sendUpdateActor (accountOrChannel: MChannelDefault | MAccountDefa
|
|||
logger.info('Creating job to update actor %s.', byActor.url)
|
||||
|
||||
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 updateActivity = buildUpdateActivity(url, byActor, accountOrChannelObject, audience)
|
||||
|
||||
|
|
|
@ -25,8 +25,12 @@ const videoFileRedundancyGetValidator = [
|
|||
if (!await doesVideoExist(req.params.videoId, res)) return
|
||||
|
||||
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 => {
|
||||
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.' })
|
||||
|
@ -41,8 +45,12 @@ const videoFileRedundancyGetValidator = [
|
|||
]
|
||||
|
||||
const videoPlaylistRedundancyGetValidator = [
|
||||
param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid video id'),
|
||||
param('streamingPlaylistType').custom(exists).withMessage('Should have a valid streaming playlist type'),
|
||||
param('videoId')
|
||||
.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) => {
|
||||
logger.debug('Checking videoPlaylistRedundancyGetValidator parameters', { parameters: req.params })
|
||||
|
@ -51,7 +59,9 @@ const videoPlaylistRedundancyGetValidator = [
|
|||
if (!await doesVideoExist(req.params.videoId, res)) return
|
||||
|
||||
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.' })
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
if (!videoComment) {
|
||||
|
@ -151,7 +152,8 @@ async function doesVideoCommentThreadExist (id: number, video: MVideoId, res: ex
|
|||
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)
|
||||
|
||||
if (!videoComment) {
|
||||
|
|
|
@ -150,7 +150,7 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> {
|
|||
static loadLocalAndPopulateVideo (
|
||||
rateType: VideoRateType,
|
||||
accountName: string,
|
||||
videoId: number,
|
||||
videoId: number | string,
|
||||
t?: Transaction
|
||||
): Bluebird<MAccountVideoRateAccountVideo> {
|
||||
const options: FindOptions = {
|
||||
|
|
|
@ -430,8 +430,6 @@ export class ActorModel extends Model<ActorModel> {
|
|||
}
|
||||
|
||||
toActivityPubObject (this: MActorAP, name: string) {
|
||||
let activityPubType
|
||||
|
||||
let icon = undefined
|
||||
if (this.avatarId) {
|
||||
const extension = extname(this.Avatar.filename)
|
||||
|
|
|
@ -99,7 +99,7 @@ export class VideoFileModel extends Model<VideoFileModel> {
|
|||
static doesInfohashExist (infoHash: string) {
|
||||
const query = 'SELECT 1 FROM "videoFile" WHERE "infoHash" = $infoHash LIMIT 1'
|
||||
const options = {
|
||||
type: QueryTypes.SELECT,
|
||||
type: QueryTypes.SELECT as QueryTypes.SELECT,
|
||||
bind: { infoHash },
|
||||
raw: true
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ export class VideoPlaylistElementModel extends Model<VideoPlaylistElementModel>
|
|||
return VideoPlaylistElementModel.findOne(query)
|
||||
}
|
||||
|
||||
static loadById (playlistElementId: number): Bluebird<MVideoPlaylistElement> {
|
||||
static loadById (playlistElementId: number | string): Bluebird<MVideoPlaylistElement> {
|
||||
return VideoPlaylistElementModel.findByPk(playlistElementId)
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ export class VideoShareModel extends Model<VideoShareModel> {
|
|||
})
|
||||
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({
|
||||
where: {
|
||||
actorId,
|
||||
|
|
|
@ -1608,7 +1608,7 @@ export class VideoModel extends Model<VideoModel> {
|
|||
'LIMIT 1'
|
||||
|
||||
const options = {
|
||||
type: QueryTypes.SELECT,
|
||||
type: QueryTypes.SELECT as QueryTypes.SELECT,
|
||||
bind: { followerActorId, videoId },
|
||||
raw: true
|
||||
}
|
||||
|
|
|
@ -14,7 +14,11 @@
|
|||
"es2016",
|
||||
"es2017"
|
||||
],
|
||||
"typeRoots": [ "node_modules/@types", "server/typings" ],
|
||||
"typeRoots": [
|
||||
"node_modules/sitemap/node_modules/@types",
|
||||
"node_modules/@types",
|
||||
"server/typings"
|
||||
],
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"@server/*": [ "server/*" ],
|
||||
|
|
Loading…
Reference in New Issue