mirror of https://github.com/Chocobozzz/PeerTube
Upgrade server packages
parent
604e02abcb
commit
53abc4c272
|
@ -115,7 +115,7 @@
|
|||
"standard": "^10.0.0",
|
||||
"supertest": "^3.0.0",
|
||||
"tslint": "^5.7.0",
|
||||
"tslint-config-standard": "^6.0.0",
|
||||
"tslint-config-standard": "^7.0.0",
|
||||
"webtorrent": "^0.98.0"
|
||||
},
|
||||
"scripty": {
|
||||
|
|
|
@ -19,7 +19,7 @@ import {
|
|||
videoRateValidator,
|
||||
asyncMiddleware
|
||||
} from '../../../middlewares'
|
||||
import { UserVideoRateUpdate, VideoRateType } from '../../../../shared'
|
||||
import { UserVideoRateUpdate } from '../../../../shared'
|
||||
|
||||
const rateVideoRouter = express.Router()
|
||||
|
||||
|
@ -73,7 +73,7 @@ async function rateVideo (req: express.Request, res: express.Response) {
|
|||
if (rateType === 'none') { // Destroy previous rate
|
||||
await previousRate.destroy()
|
||||
} else { // Update previous rate
|
||||
previousRate.type = rateType as VideoRateType
|
||||
previousRate.type = rateType
|
||||
|
||||
await previousRate.save()
|
||||
}
|
||||
|
|
|
@ -122,9 +122,6 @@ async function generateWatchHtmlPage (req: express.Request, res: express.Respons
|
|||
videoPromise
|
||||
])
|
||||
|
||||
file = file as Buffer
|
||||
video = video as VideoInstance
|
||||
|
||||
const html = file.toString()
|
||||
|
||||
// Let Angular application handle errors
|
||||
|
|
|
@ -71,13 +71,13 @@ async function createCertsIfNotExist () {
|
|||
return
|
||||
}
|
||||
|
||||
return await createCerts()
|
||||
return createCerts()
|
||||
}
|
||||
|
||||
async function cryptPassword (password: string) {
|
||||
const salt = await bcryptGenSaltPromise(BCRYPT_SALT_SIZE)
|
||||
|
||||
return await bcryptHashPromise(password, salt)
|
||||
return bcryptHashPromise(password, salt)
|
||||
}
|
||||
|
||||
function getMyPrivateCert () {
|
||||
|
|
|
@ -3,10 +3,9 @@ import * as express from 'express'
|
|||
|
||||
import { database as db } from '../../initializers/database'
|
||||
import { checkErrors } from './utils'
|
||||
import { logger, isEachUniqueHostValid } from '../../helpers'
|
||||
import { logger, isEachUniqueHostValid, isTestInstance } from '../../helpers'
|
||||
import { CONFIG } from '../../initializers'
|
||||
import { hasFriends } from '../../lib'
|
||||
import { isTestInstance } from '../../helpers'
|
||||
|
||||
const makeFriendsValidator = [
|
||||
body('hosts').custom(isEachUniqueHostValid).withMessage('Should have an array of unique hosts'),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as Sequelize from 'sequelize'
|
||||
import * as Promise from 'bluebird'
|
||||
|
||||
import { getSort } from '../utils'
|
||||
import { getSort, addMethodsToModel } from '../utils'
|
||||
import {
|
||||
cryptPassword,
|
||||
comparePassword,
|
||||
|
@ -13,7 +13,6 @@ import {
|
|||
} from '../../helpers'
|
||||
import { UserRight, USER_ROLE_LABELS, hasUserRight } from '../../../shared'
|
||||
|
||||
import { addMethodsToModel } from '../utils'
|
||||
import {
|
||||
UserInstance,
|
||||
UserAttributes,
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import * as safeBuffer from 'safe-buffer'
|
||||
const Buffer = safeBuffer.Buffer
|
||||
import * as magnetUtil from 'magnet-uri'
|
||||
import { map } from 'lodash'
|
||||
import { map, maxBy, truncate } from 'lodash'
|
||||
import * as parseTorrent from 'parse-torrent'
|
||||
import { join } from 'path'
|
||||
import * as Sequelize from 'sequelize'
|
||||
import * as Promise from 'bluebird'
|
||||
import { maxBy, truncate } from 'lodash'
|
||||
|
||||
import { TagInstance } from './tag-interface'
|
||||
import {
|
||||
|
|
|
@ -25,12 +25,12 @@ describe('Test advanced friends', function () {
|
|||
|
||||
async function makeFriendsWrapper (podNumber: number) {
|
||||
const server = servers[podNumber - 1]
|
||||
return await makeFriends(server.url, server.accessToken)
|
||||
return makeFriends(server.url, server.accessToken)
|
||||
}
|
||||
|
||||
async function quitFriendsWrapper (podNumber: number) {
|
||||
const server = servers[podNumber - 1]
|
||||
return await quitFriends(server.url, server.accessToken)
|
||||
return quitFriends(server.url, server.accessToken)
|
||||
}
|
||||
|
||||
async function removeFriendWrapper (podNumber: number, podNumberToRemove: number) {
|
||||
|
@ -42,12 +42,12 @@ describe('Test advanced friends', function () {
|
|||
let friendsList = res.body.data
|
||||
let podToRemove = friendsList.find(friend => (friend.host === serverToRemove.host))
|
||||
|
||||
return await quitOneFriend(server.url, server.accessToken, podToRemove.id)
|
||||
return quitOneFriend(server.url, server.accessToken, podToRemove.id)
|
||||
}
|
||||
|
||||
async function getFriendsListWrapper (podNumber: number) {
|
||||
const server = servers[podNumber - 1]
|
||||
return await getFriendsList(server.url)
|
||||
return getFriendsList(server.url)
|
||||
}
|
||||
|
||||
async function uploadVideoWrapper (podNumber: number) {
|
||||
|
@ -56,11 +56,11 @@ describe('Test advanced friends', function () {
|
|||
}
|
||||
const server = servers[podNumber - 1]
|
||||
|
||||
return await uploadVideo(server.url, server.accessToken, videoAttributes)
|
||||
return uploadVideo(server.url, server.accessToken, videoAttributes)
|
||||
}
|
||||
|
||||
async function getVideosWrapper (podNumber: number) {
|
||||
return await getVideosList(servers[podNumber - 1].url)
|
||||
return getVideosList(servers[podNumber - 1].url)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
|
|
@ -80,11 +80,15 @@ start()
|
|||
async function start () {
|
||||
const servers = await runServers(numberOfPods)
|
||||
|
||||
process.on('exit', async () => await exitServers(servers, flushAtExit))
|
||||
process.on('exit', async () => {
|
||||
await exitServers(servers, flushAtExit)
|
||||
|
||||
return
|
||||
})
|
||||
process.on('SIGINT', goodbye)
|
||||
process.on('SIGTERM', goodbye)
|
||||
|
||||
console.log('Servers runned')
|
||||
console.log('Servers ran')
|
||||
initializeRequestsPerServer(servers)
|
||||
|
||||
let checking = false
|
||||
|
@ -150,10 +154,8 @@ function getRandomNumServer (servers) {
|
|||
}
|
||||
|
||||
async function runServers (numberOfPods: number) {
|
||||
let servers = null
|
||||
|
||||
// Run servers
|
||||
servers = await flushAndRunMultipleServers(numberOfPods)
|
||||
const servers: ServerInfo[] = (await flushAndRunMultipleServers(numberOfPods))
|
||||
.map(s => Object.assign({ requestsNumber: 0 }, s))
|
||||
|
||||
// Get the access tokens
|
||||
await setAccessTokensToServers(servers)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import * as program from 'commander'
|
||||
import * as Promise from 'bluebird'
|
||||
import { isAbsolute } from 'path'
|
||||
import { join } from 'path'
|
||||
import { isAbsolute, join } from 'path'
|
||||
|
||||
import { readdirPromise } from '../../../helpers/core-utils'
|
||||
import { execCLI } from '../../utils'
|
||||
|
|
|
@ -33,7 +33,7 @@ interface ServerInfo {
|
|||
}
|
||||
}
|
||||
|
||||
async function flushAndRunMultipleServers (totalServers) {
|
||||
function flushAndRunMultipleServers (totalServers) {
|
||||
let apps = []
|
||||
let i = 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue