diff options
Diffstat (limited to 'shared')
-rw-r--r-- | shared/models/server/index.ts | 1 | ||||
-rw-r--r-- | shared/models/server/peertube-problem-document.model.ts | 32 | ||||
-rw-r--r-- | shared/models/server/server-error-code.enum.ts | 10 |
3 files changed, 42 insertions, 1 deletions
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' | |||
6 | export * from './emailer.model' | 6 | export * from './emailer.model' |
7 | export * from './job.model' | 7 | export * from './job.model' |
8 | export * from './log-level.type' | 8 | export * from './log-level.type' |
9 | export * from './peertube-problem-document.model' | ||
9 | export * from './server-config.model' | 10 | export * from './server-config.model' |
10 | export * from './server-debug.model' | 11 | export * from './server-debug.model' |
11 | export * from './server-error-code.enum' | 12 | export * from './server-error-code.enum' |
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..5e1c320f3 --- /dev/null +++ b/shared/models/server/peertube-problem-document.model.ts | |||
@@ -0,0 +1,32 @@ | |||
1 | import { HttpStatusCode } from '@shared/core-utils' | ||
2 | import { OAuth2ErrorCode, ServerErrorCode } from './server-error-code.enum' | ||
3 | |||
4 | export 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 | |||
20 | export 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-error-code.enum.ts b/shared/models/server/server-error-code.enum.ts index 93b9ce20d..43996e7aa 100644 --- a/shared/models/server/server-error-code.enum.ts +++ b/shared/models/server/server-error-code.enum.ts | |||
@@ -48,5 +48,13 @@ export const enum OAuth2ErrorCode { | |||
48 | * | 48 | * |
49 | * @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-client-error.js | 49 | * @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-client-error.js |
50 | */ | 50 | */ |
51 | INVALID_CLIENT = 'invalid_client' | 51 | INVALID_CLIENT = 'invalid_client', |
52 | |||
53 | |||
54 | /** | ||
55 | * The access token provided is expired, revoked, malformed, or invalid for other reasons | ||
56 | * | ||
57 | * @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-token-error.js | ||
58 | */ | ||
59 | INVALID_TOKEN = 'invalid_token', | ||
52 | } | 60 | } |