diff options
Diffstat (limited to 'shared/extra-utils/server')
-rw-r--r-- | shared/extra-utils/server/config.ts | 15 | ||||
-rw-r--r-- | shared/extra-utils/server/debug.ts | 18 | ||||
-rw-r--r-- | shared/extra-utils/server/jobs.ts | 4 | ||||
-rw-r--r-- | shared/extra-utils/server/servers.ts | 2 |
4 files changed, 33 insertions, 6 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 | ||
226 | function 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 | |||
226 | function deleteCustomConfig (url: string, token: string, statusCodeExpected = HttpStatusCode.OK_200) { | 238 | function 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 @@ | |||
1 | import { makeGetRequest } from '../requests/requests' | 1 | import { makeGetRequest, makePostBodyRequest } from '../requests/requests' |
2 | import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes' | 2 | import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes' |
3 | import { SendDebugCommand } from '@shared/models' | ||
3 | 4 | ||
4 | function getDebug (url: string, token: string) { | 5 | function 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 | ||
16 | function 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 | ||
17 | export { | 30 | export { |
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: { | |||
55 | async function waitJobs (serversArg: ServerInfo[] | ServerInfo) { | 55 | async 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/servers.ts b/shared/extra-utils/server/servers.ts index 779a3cc36..479f08e12 100644 --- a/shared/extra-utils/server/servers.ts +++ b/shared/extra-utils/server/servers.ts | |||
@@ -274,7 +274,7 @@ async function reRunServer (server: ServerInfo, configOverride?: any) { | |||
274 | } | 274 | } |
275 | 275 | ||
276 | async function checkTmpIsEmpty (server: ServerInfo) { | 276 | async function checkTmpIsEmpty (server: ServerInfo) { |
277 | await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls' ]) | 277 | await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ]) |
278 | 278 | ||
279 | if (await pathExists(join('test' + server.internalServerNumber, 'tmp', 'hls'))) { | 279 | if (await pathExists(join('test' + server.internalServerNumber, 'tmp', 'hls'))) { |
280 | await checkDirectoryIsEmpty(server, 'tmp/hls') | 280 | await checkDirectoryIsEmpty(server, 'tmp/hls') |