aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-27 16:12:41 +0200
committerChocobozzz <me@florianbigard.com>2021-05-27 16:12:41 +0200
commit8f608a4cb22ab232cfab20665050764b38bac9c7 (patch)
tree6a6785aae79bf5939ad7b7a50a1bd8031268d2b4 /shared/extra-utils/server
parent030ccfce59a8cb8f2fee6ea8dd363ba635c5c5c2 (diff)
parentc215e627b575d2c4085ccb222f4ca8d0237b7552 (diff)
downloadPeerTube-8f608a4cb22ab232cfab20665050764b38bac9c7.tar.gz
PeerTube-8f608a4cb22ab232cfab20665050764b38bac9c7.tar.zst
PeerTube-8f608a4cb22ab232cfab20665050764b38bac9c7.zip
Merge branch 'develop' into shorter-URLs-channels-accounts
Diffstat (limited to 'shared/extra-utils/server')
-rw-r--r--shared/extra-utils/server/config.ts15
-rw-r--r--shared/extra-utils/server/debug.ts18
-rw-r--r--shared/extra-utils/server/jobs.ts4
-rw-r--r--shared/extra-utils/server/plugins.ts4
-rw-r--r--shared/extra-utils/server/servers.ts5
5 files changed, 38 insertions, 8 deletions
diff --git a/shared/extra-utils/server/config.ts b/shared/extra-utils/server/config.ts
index 026a5e61c..b70110852 100644
--- a/shared/extra-utils/server/config.ts
+++ b/shared/extra-utils/server/config.ts
@@ -223,6 +223,18 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti
223 return updateCustomConfig(url, token, updateParams) 223 return updateCustomConfig(url, token, updateParams)
224} 224}
225 225
226function getCustomConfigResolutions (enabled: boolean) {
227 return {
228 '240p': enabled,
229 '360p': enabled,
230 '480p': enabled,
231 '720p': enabled,
232 '1080p': enabled,
233 '1440p': enabled,
234 '2160p': enabled
235 }
236}
237
226function deleteCustomConfig (url: string, token: string, statusCodeExpected = HttpStatusCode.OK_200) { 238function deleteCustomConfig (url: string, token: string, statusCodeExpected = HttpStatusCode.OK_200) {
227 const path = '/api/v1/config/custom' 239 const path = '/api/v1/config/custom'
228 240
@@ -242,5 +254,6 @@ export {
242 updateCustomConfig, 254 updateCustomConfig,
243 getAbout, 255 getAbout,
244 deleteCustomConfig, 256 deleteCustomConfig,
245 updateCustomSubConfig 257 updateCustomSubConfig,
258 getCustomConfigResolutions
246} 259}
diff --git a/shared/extra-utils/server/debug.ts b/shared/extra-utils/server/debug.ts
index 5cf80a5fb..f196812b7 100644
--- a/shared/extra-utils/server/debug.ts
+++ b/shared/extra-utils/server/debug.ts
@@ -1,5 +1,6 @@
1import { makeGetRequest } from '../requests/requests' 1import { makeGetRequest, makePostBodyRequest } from '../requests/requests'
2import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes' 2import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
3import { SendDebugCommand } from '@shared/models'
3 4
4function getDebug (url: string, token: string) { 5function getDebug (url: string, token: string) {
5 const path = '/api/v1/server/debug' 6 const path = '/api/v1/server/debug'
@@ -12,8 +13,21 @@ function getDebug (url: string, token: string) {
12 }) 13 })
13} 14}
14 15
16function sendDebugCommand (url: string, token: string, body: SendDebugCommand) {
17 const path = '/api/v1/server/debug/run-command'
18
19 return makePostBodyRequest({
20 url,
21 path,
22 token,
23 fields: body,
24 statusCodeExpected: HttpStatusCode.NO_CONTENT_204
25 })
26}
27
15// --------------------------------------------------------------------------- 28// ---------------------------------------------------------------------------
16 29
17export { 30export {
18 getDebug 31 getDebug,
32 sendDebugCommand
19} 33}
diff --git a/shared/extra-utils/server/jobs.ts b/shared/extra-utils/server/jobs.ts
index 704929bd4..763374e03 100644
--- a/shared/extra-utils/server/jobs.ts
+++ b/shared/extra-utils/server/jobs.ts
@@ -55,7 +55,7 @@ function getJobsListPaginationAndSort (options: {
55async function waitJobs (serversArg: ServerInfo[] | ServerInfo) { 55async function waitJobs (serversArg: ServerInfo[] | ServerInfo) {
56 const pendingJobWait = process.env.NODE_PENDING_JOB_WAIT 56 const pendingJobWait = process.env.NODE_PENDING_JOB_WAIT
57 ? parseInt(process.env.NODE_PENDING_JOB_WAIT, 10) 57 ? parseInt(process.env.NODE_PENDING_JOB_WAIT, 10)
58 : 500 58 : 250
59 59
60 let servers: ServerInfo[] 60 let servers: ServerInfo[]
61 61
@@ -115,7 +115,7 @@ async function waitJobs (serversArg: ServerInfo[] | ServerInfo) {
115 } 115 }
116 116
117 if (pendingRequests) { 117 if (pendingRequests) {
118 await wait(1000) 118 await wait(pendingJobWait)
119 } 119 }
120 } while (pendingRequests) 120 } while (pendingRequests)
121} 121}
diff --git a/shared/extra-utils/server/plugins.ts b/shared/extra-utils/server/plugins.ts
index 864954ee7..d53e5b382 100644
--- a/shared/extra-utils/server/plugins.ts
+++ b/shared/extra-utils/server/plugins.ts
@@ -4,12 +4,12 @@ import { expect } from 'chai'
4import { readJSON, writeJSON } from 'fs-extra' 4import { readJSON, writeJSON } from 'fs-extra'
5import { join } from 'path' 5import { join } from 'path'
6import { RegisteredServerSettings } from '@shared/models' 6import { RegisteredServerSettings } from '@shared/models'
7import { PeertubePluginIndexList } from '../../models/plugins/peertube-plugin-index-list.model' 7import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
8import { PeertubePluginIndexList } from '../../models/plugins/plugin-index/peertube-plugin-index-list.model'
8import { PluginType } from '../../models/plugins/plugin.type' 9import { PluginType } from '../../models/plugins/plugin.type'
9import { buildServerDirectory, root } from '../miscs/miscs' 10import { buildServerDirectory, root } from '../miscs/miscs'
10import { makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests' 11import { makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests'
11import { ServerInfo } from './servers' 12import { ServerInfo } from './servers'
12import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
13 13
14function listPlugins (parameters: { 14function listPlugins (parameters: {
15 url: string 15 url: string
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts
index 779a3cc36..d04757470 100644
--- a/shared/extra-utils/server/servers.ts
+++ b/shared/extra-utils/server/servers.ts
@@ -45,9 +45,12 @@ interface ServerInfo {
45 uuid: string 45 uuid: string
46 name?: string 46 name?: string
47 url?: string 47 url?: string
48
48 account?: { 49 account?: {
49 name: string 50 name: string
50 } 51 }
52
53 embedPath?: string
51 } 54 }
52 55
53 remoteVideo?: { 56 remoteVideo?: {
@@ -274,7 +277,7 @@ async function reRunServer (server: ServerInfo, configOverride?: any) {
274} 277}
275 278
276async function checkTmpIsEmpty (server: ServerInfo) { 279async function checkTmpIsEmpty (server: ServerInfo) {
277 await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls' ]) 280 await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ])
278 281
279 if (await pathExists(join('test' + server.internalServerNumber, 'tmp', 'hls'))) { 282 if (await pathExists(join('test' + server.internalServerNumber, 'tmp', 'hls'))) {
280 await checkDirectoryIsEmpty(server, 'tmp/hls') 283 await checkDirectoryIsEmpty(server, 'tmp/hls')