diff options
Diffstat (limited to 'shared/extra-utils')
-rw-r--r-- | shared/extra-utils/custom-pages/custom-pages.ts | 31 | ||||
-rw-r--r-- | shared/extra-utils/index.ts | 18 | ||||
-rw-r--r-- | shared/extra-utils/requests/requests.ts | 2 | ||||
-rw-r--r-- | shared/extra-utils/server/config.ts | 3 | ||||
-rw-r--r-- | shared/extra-utils/server/plugins.ts | 4 | ||||
-rw-r--r-- | shared/extra-utils/server/servers.ts | 3 |
6 files changed, 57 insertions, 4 deletions
diff --git a/shared/extra-utils/custom-pages/custom-pages.ts b/shared/extra-utils/custom-pages/custom-pages.ts new file mode 100644 index 000000000..bf2d16c70 --- /dev/null +++ b/shared/extra-utils/custom-pages/custom-pages.ts | |||
@@ -0,0 +1,31 @@ | |||
1 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
2 | import { makeGetRequest, makePutBodyRequest } from '../requests/requests' | ||
3 | |||
4 | function getInstanceHomepage (url: string, statusCodeExpected = HttpStatusCode.OK_200) { | ||
5 | const path = '/api/v1/custom-pages/homepage/instance' | ||
6 | |||
7 | return makeGetRequest({ | ||
8 | url, | ||
9 | path, | ||
10 | statusCodeExpected | ||
11 | }) | ||
12 | } | ||
13 | |||
14 | function updateInstanceHomepage (url: string, token: string, content: string) { | ||
15 | const path = '/api/v1/custom-pages/homepage/instance' | ||
16 | |||
17 | return makePutBodyRequest({ | ||
18 | url, | ||
19 | path, | ||
20 | token, | ||
21 | fields: { content }, | ||
22 | statusCodeExpected: HttpStatusCode.NO_CONTENT_204 | ||
23 | }) | ||
24 | } | ||
25 | |||
26 | // --------------------------------------------------------------------------- | ||
27 | |||
28 | export { | ||
29 | getInstanceHomepage, | ||
30 | updateInstanceHomepage | ||
31 | } | ||
diff --git a/shared/extra-utils/index.ts b/shared/extra-utils/index.ts index 898a92d43..3bc09ead5 100644 --- a/shared/extra-utils/index.ts +++ b/shared/extra-utils/index.ts | |||
@@ -1,15 +1,26 @@ | |||
1 | export * from './bulk/bulk' | 1 | export * from './bulk/bulk' |
2 | |||
2 | export * from './cli/cli' | 3 | export * from './cli/cli' |
4 | |||
5 | export * from './custom-pages/custom-pages' | ||
6 | |||
3 | export * from './feeds/feeds' | 7 | export * from './feeds/feeds' |
8 | |||
4 | export * from './mock-servers/mock-instances-index' | 9 | export * from './mock-servers/mock-instances-index' |
5 | export * from './miscs/miscs' | 10 | |
11 | export * from './miscs/email' | ||
6 | export * from './miscs/sql' | 12 | export * from './miscs/sql' |
13 | export * from './miscs/miscs' | ||
7 | export * from './miscs/stubs' | 14 | export * from './miscs/stubs' |
15 | |||
8 | export * from './moderation/abuses' | 16 | export * from './moderation/abuses' |
9 | export * from './plugins/mock-blocklist' | 17 | export * from './plugins/mock-blocklist' |
18 | |||
10 | export * from './requests/check-api-params' | 19 | export * from './requests/check-api-params' |
11 | export * from './requests/requests' | 20 | export * from './requests/requests' |
21 | |||
12 | export * from './search/videos' | 22 | export * from './search/videos' |
23 | |||
13 | export * from './server/activitypub' | 24 | export * from './server/activitypub' |
14 | export * from './server/clients' | 25 | export * from './server/clients' |
15 | export * from './server/config' | 26 | export * from './server/config' |
@@ -18,9 +29,14 @@ export * from './server/follows' | |||
18 | export * from './server/jobs' | 29 | export * from './server/jobs' |
19 | export * from './server/plugins' | 30 | export * from './server/plugins' |
20 | export * from './server/servers' | 31 | export * from './server/servers' |
32 | |||
21 | export * from './users/accounts' | 33 | export * from './users/accounts' |
34 | export * from './users/blocklist' | ||
22 | export * from './users/login' | 35 | export * from './users/login' |
36 | export * from './users/user-notifications' | ||
37 | export * from './users/user-subscriptions' | ||
23 | export * from './users/users' | 38 | export * from './users/users' |
39 | |||
24 | export * from './videos/live' | 40 | export * from './videos/live' |
25 | export * from './videos/services' | 41 | export * from './videos/services' |
26 | export * from './videos/video-blacklist' | 42 | export * from './videos/video-blacklist' |
diff --git a/shared/extra-utils/requests/requests.ts b/shared/extra-utils/requests/requests.ts index 8b5cddf4a..38e24d897 100644 --- a/shared/extra-utils/requests/requests.ts +++ b/shared/extra-utils/requests/requests.ts | |||
@@ -26,6 +26,7 @@ function makeGetRequest (options: { | |||
26 | contentType?: string | 26 | contentType?: string |
27 | range?: string | 27 | range?: string |
28 | redirects?: number | 28 | redirects?: number |
29 | accept?: string | ||
29 | }) { | 30 | }) { |
30 | if (!options.statusCodeExpected) options.statusCodeExpected = HttpStatusCode.BAD_REQUEST_400 | 31 | if (!options.statusCodeExpected) options.statusCodeExpected = HttpStatusCode.BAD_REQUEST_400 |
31 | if (options.contentType === undefined) options.contentType = 'application/json' | 32 | if (options.contentType === undefined) options.contentType = 'application/json' |
@@ -36,6 +37,7 @@ function makeGetRequest (options: { | |||
36 | if (options.token) req.set('Authorization', 'Bearer ' + options.token) | 37 | if (options.token) req.set('Authorization', 'Bearer ' + options.token) |
37 | if (options.query) req.query(options.query) | 38 | if (options.query) req.query(options.query) |
38 | if (options.range) req.set('Range', options.range) | 39 | if (options.range) req.set('Range', options.range) |
40 | if (options.accept) req.set('Accept', options.accept) | ||
39 | if (options.redirects) req.redirects(options.redirects) | 41 | if (options.redirects) req.redirects(options.redirects) |
40 | 42 | ||
41 | return req.expect(options.statusCodeExpected) | 43 | return req.expect(options.statusCodeExpected) |
diff --git a/shared/extra-utils/server/config.ts b/shared/extra-utils/server/config.ts index b70110852..9fcfb31fd 100644 --- a/shared/extra-utils/server/config.ts +++ b/shared/extra-utils/server/config.ts | |||
@@ -98,7 +98,8 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti | |||
98 | signup: { | 98 | signup: { |
99 | enabled: false, | 99 | enabled: false, |
100 | limit: 5, | 100 | limit: 5, |
101 | requiresEmailVerification: false | 101 | requiresEmailVerification: false, |
102 | minimumAge: 16 | ||
102 | }, | 103 | }, |
103 | admin: { | 104 | admin: { |
104 | email: 'superadmin1@example.com' | 105 | email: 'superadmin1@example.com' |
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' | |||
4 | import { readJSON, writeJSON } from 'fs-extra' | 4 | import { readJSON, writeJSON } from 'fs-extra' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { RegisteredServerSettings } from '@shared/models' | 6 | import { RegisteredServerSettings } from '@shared/models' |
7 | import { PeertubePluginIndexList } from '../../models/plugins/peertube-plugin-index-list.model' | 7 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' |
8 | import { PeertubePluginIndexList } from '../../models/plugins/plugin-index/peertube-plugin-index-list.model' | ||
8 | import { PluginType } from '../../models/plugins/plugin.type' | 9 | import { PluginType } from '../../models/plugins/plugin.type' |
9 | import { buildServerDirectory, root } from '../miscs/miscs' | 10 | import { buildServerDirectory, root } from '../miscs/miscs' |
10 | import { makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests' | 11 | import { makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests' |
11 | import { ServerInfo } from './servers' | 12 | import { ServerInfo } from './servers' |
12 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
13 | 13 | ||
14 | function listPlugins (parameters: { | 14 | function 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 479f08e12..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?: { |