aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models/server
diff options
context:
space:
mode:
Diffstat (limited to 'shared/models/server')
-rw-r--r--shared/models/server/custom-config.model.ts1
-rw-r--r--shared/models/server/index.ts1
-rw-r--r--shared/models/server/job.model.ts1
-rw-r--r--shared/models/server/peertube-problem-document.model.ts32
-rw-r--r--shared/models/server/server-config.model.ts7
-rw-r--r--shared/models/server/server-error-code.enum.ts73
6 files changed, 111 insertions, 4 deletions
diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts
index 0bccd63e3..75d04423a 100644
--- a/shared/models/server/custom-config.model.ts
+++ b/shared/models/server/custom-config.model.ts
@@ -69,6 +69,7 @@ export interface CustomConfig {
69 enabled: boolean 69 enabled: boolean
70 limit: number 70 limit: number
71 requiresEmailVerification: boolean 71 requiresEmailVerification: boolean
72 minimumAge: number
72 } 73 }
73 74
74 admin: { 75 admin: {
diff --git a/shared/models/server/index.ts b/shared/models/server/index.ts
index b5163954a..06bf5c599 100644
--- a/shared/models/server/index.ts
+++ b/shared/models/server/index.ts
@@ -6,6 +6,7 @@ export * from './debug.model'
6export * from './emailer.model' 6export * from './emailer.model'
7export * from './job.model' 7export * from './job.model'
8export * from './log-level.type' 8export * from './log-level.type'
9export * from './peertube-problem-document.model'
9export * from './server-config.model' 10export * from './server-config.model'
10export * from './server-debug.model' 11export * from './server-debug.model'
11export * from './server-error-code.enum' 12export * from './server-error-code.enum'
diff --git a/shared/models/server/job.model.ts b/shared/models/server/job.model.ts
index e4acfee8d..4ab249e0b 100644
--- a/shared/models/server/job.model.ts
+++ b/shared/models/server/job.model.ts
@@ -53,7 +53,6 @@ export type ActivitypubHttpFetcherPayload = {
53 uri: string 53 uri: string
54 type: FetchType 54 type: FetchType
55 videoId?: number 55 videoId?: number
56 accountId?: number
57} 56}
58 57
59export type ActivitypubHttpUnicastPayload = { 58export type ActivitypubHttpUnicastPayload = {
diff --git a/shared/models/server/peertube-problem-document.model.ts b/shared/models/server/peertube-problem-document.model.ts
new file mode 100644
index 000000000..e391d5aad
--- /dev/null
+++ b/shared/models/server/peertube-problem-document.model.ts
@@ -0,0 +1,32 @@
1import { HttpStatusCode } from '../../core-utils'
2import { OAuth2ErrorCode, ServerErrorCode } from './server-error-code.enum'
3
4export interface PeerTubeProblemDocumentData {
5 'invalid-params'?: Record<string, Object>
6
7 originUrl?: string
8
9 keyId?: string
10
11 targetUrl?: string
12
13 actorUrl?: string
14
15 // Feeds
16 format?: string
17 url?: string
18}
19
20export interface PeerTubeProblemDocument extends PeerTubeProblemDocumentData {
21 type: string
22 title: string
23
24 detail: string
25 // Compat PeerTube <= 3.2
26 error: string
27
28 status: HttpStatusCode
29
30 docs?: string
31 code?: ServerErrorCode | OAuth2ErrorCode
32}
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts
index 85d84af44..585e99aca 100644
--- a/shared/models/server/server-config.model.ts
+++ b/shared/models/server/server-config.model.ts
@@ -84,6 +84,7 @@ export interface ServerConfig {
84 allowed: boolean 84 allowed: boolean
85 allowedForCurrentIP: boolean 85 allowedForCurrentIP: boolean
86 requiresEmailVerification: boolean 86 requiresEmailVerification: boolean
87 minimumAge: number
87 } 88 }
88 89
89 transcoding: { 90 transcoding: {
@@ -214,4 +215,10 @@ export interface ServerConfig {
214 level: BroadcastMessageLevel 215 level: BroadcastMessageLevel
215 dismissable: boolean 216 dismissable: boolean
216 } 217 }
218
219 homepage: {
220 enabled: boolean
221 }
217} 222}
223
224export type HTMLServerConfig = Omit<ServerConfig, 'signup'>
diff --git a/shared/models/server/server-error-code.enum.ts b/shared/models/server/server-error-code.enum.ts
index c02b0e6c7..115421d4d 100644
--- a/shared/models/server/server-error-code.enum.ts
+++ b/shared/models/server/server-error-code.enum.ts
@@ -1,5 +1,72 @@
1export const enum ServerErrorCode { 1export const enum ServerErrorCode {
2 DOES_NOT_RESPECT_FOLLOW_CONSTRAINTS = 1, 2 /**
3 MAX_INSTANCE_LIVES_LIMIT_REACHED = 2, 3 * The simplest form of payload too large: when the file size is over the
4 MAX_USER_LIVES_LIMIT_REACHED = 3, 4 * global file size limit
5 */
6 MAX_FILE_SIZE_REACHED = 'max_file_size_reached',
7
8 /**
9 * The payload is too large for the user quota set
10 */
11 QUOTA_REACHED = 'quota_reached',
12
13 /**
14 * Error yielded upon trying to access a video that is not federated, nor can
15 * be. This may be due to: remote videos on instances that are not followed by
16 * yours, and with your instance disallowing unknown instances being accessed.
17 */
18 DOES_NOT_RESPECT_FOLLOW_CONSTRAINTS = 'does_not_respect_follow_constraints',
19
20 LIVE_NOT_ENABLED = 'live_not_enabled',
21 LIVE_NOT_ALLOWING_REPLAY = 'live_not_allowing_replay',
22 LIVE_CONFLICTING_PERMANENT_AND_SAVE_REPLAY = 'live_conflicting_permanent_and_save_replay',
23 /**
24 * Pretty self-explanatory: the set maximum number of simultaneous lives was
25 * reached, and this error is typically there to inform the user trying to
26 * broadcast one.
27 */
28 MAX_INSTANCE_LIVES_LIMIT_REACHED = 'max_instance_lives_limit_reached',
29 /**
30 * Pretty self-explanatory: the set maximum number of simultaneous lives FOR
31 * THIS USER was reached, and this error is typically there to inform the user
32 * trying to broadcast one.
33 */
34 MAX_USER_LIVES_LIMIT_REACHED = 'max_user_lives_limit_reached',
35
36 /**
37 * A torrent should have at most one correct video file. Any more and we will
38 * not be able to choose automatically.
39 */
40 INCORRECT_FILES_IN_TORRENT = 'incorrect_files_in_torrent'
41}
42
43/**
44 * oauthjs/oauth2-server error codes
45 * @see https://datatracker.ietf.org/doc/html/rfc6749#section-5.2
46 **/
47export const enum OAuth2ErrorCode {
48 /**
49 * The provided authorization grant (e.g., authorization code, resource owner
50 * credentials) or refresh token is invalid, expired, revoked, does not match
51 * the redirection URI used in the authorization request, or was issued to
52 * another client.
53 *
54 * @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-grant-error.js
55 */
56 INVALID_GRANT = 'invalid_grant',
57
58 /**
59 * Client authentication failed (e.g., unknown client, no client authentication
60 * included, or unsupported authentication method).
61 *
62 * @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-client-error.js
63 */
64 INVALID_CLIENT = 'invalid_client',
65
66 /**
67 * The access token provided is expired, revoked, malformed, or invalid for other reasons
68 *
69 * @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-token-error.js
70 */
71 INVALID_TOKEN = 'invalid_token',
5} 72}