aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/extra-utils/server/config-command.ts12
-rw-r--r--shared/extra-utils/server/plugins-command.ts5
-rw-r--r--shared/extra-utils/server/server.ts12
-rw-r--r--shared/extra-utils/users/blocklist-command.ts25
-rw-r--r--shared/extra-utils/videos/videos.ts1
-rw-r--r--shared/models/moderation/block-status.model.ts15
-rw-r--r--shared/models/moderation/index.ts1
-rw-r--r--shared/models/plugins/client/plugin-selector-id.type.ts11
-rw-r--r--shared/models/plugins/server/api/install-plugin.model.ts1
-rw-r--r--shared/models/server/custom-config.model.ts14
-rw-r--r--shared/models/server/server-config.model.ts6
11 files changed, 95 insertions, 8 deletions
diff --git a/shared/extra-utils/server/config-command.ts b/shared/extra-utils/server/config-command.ts
index 7a768b4df..a061ca89e 100644
--- a/shared/extra-utils/server/config-command.ts
+++ b/shared/extra-utils/server/config-command.ts
@@ -194,6 +194,18 @@ export class ConfigCommand extends AbstractCommand {
194 whitelisted: true 194 whitelisted: true
195 } 195 }
196 }, 196 },
197 client: {
198 videos: {
199 miniature: {
200 preferAuthorDisplayName: false
201 }
202 },
203 menu: {
204 login: {
205 redirectOnSingleExternalAuth: false
206 }
207 }
208 },
197 cache: { 209 cache: {
198 previews: { 210 previews: {
199 size: 2 211 size: 2
diff --git a/shared/extra-utils/server/plugins-command.ts b/shared/extra-utils/server/plugins-command.ts
index b944475a2..9bf24afff 100644
--- a/shared/extra-utils/server/plugins-command.ts
+++ b/shared/extra-utils/server/plugins-command.ts
@@ -158,15 +158,16 @@ export class PluginsCommand extends AbstractCommand {
158 install (options: OverrideCommandOptions & { 158 install (options: OverrideCommandOptions & {
159 path?: string 159 path?: string
160 npmName?: string 160 npmName?: string
161 pluginVersion?: string
161 }) { 162 }) {
162 const { npmName, path } = options 163 const { npmName, path, pluginVersion } = options
163 const apiPath = '/api/v1/plugins/install' 164 const apiPath = '/api/v1/plugins/install'
164 165
165 return this.postBodyRequest({ 166 return this.postBodyRequest({
166 ...options, 167 ...options,
167 168
168 path: apiPath, 169 path: apiPath,
169 fields: { npmName, path }, 170 fields: { npmName, path, pluginVersion },
170 implicitToken: true, 171 implicitToken: true,
171 defaultExpectedStatus: HttpStatusCode.OK_200 172 defaultExpectedStatus: HttpStatusCode.OK_200
172 }) 173 })
diff --git a/shared/extra-utils/server/server.ts b/shared/extra-utils/server/server.ts
index 31224ebe9..9da293877 100644
--- a/shared/extra-utils/server/server.ts
+++ b/shared/extra-utils/server/server.ts
@@ -220,10 +220,11 @@ export class PeerTubeServer {
220 220
221 return new Promise<void>((res, rej) => { 221 return new Promise<void>((res, rej) => {
222 const self = this 222 const self = this
223 let aggregatedLogs = ''
223 224
224 this.app = fork(join(root(), 'dist', 'server.js'), options.peertubeArgs || [], forkOptions) 225 this.app = fork(join(root(), 'dist', 'server.js'), options.peertubeArgs || [], forkOptions)
225 226
226 const onPeerTubeExit = () => rej(new Error('Process exited')) 227 const onPeerTubeExit = () => rej(new Error('Process exited:\n' + aggregatedLogs))
227 const onParentExit = () => { 228 const onParentExit = () => {
228 if (!this.app || !this.app.pid) return 229 if (!this.app || !this.app.pid) return
229 230
@@ -238,10 +239,13 @@ export class PeerTubeServer {
238 this.app.stdout.on('data', function onStdout (data) { 239 this.app.stdout.on('data', function onStdout (data) {
239 let dontContinue = false 240 let dontContinue = false
240 241
242 const log: string = data.toString()
243 aggregatedLogs += log
244
241 // Capture things if we want to 245 // Capture things if we want to
242 for (const key of Object.keys(regexps)) { 246 for (const key of Object.keys(regexps)) {
243 const regexp = regexps[key] 247 const regexp = regexps[key]
244 const matches = data.toString().match(regexp) 248 const matches = log.match(regexp)
245 if (matches !== null) { 249 if (matches !== null) {
246 if (key === 'client_id') self.store.client.id = matches[1] 250 if (key === 'client_id') self.store.client.id = matches[1]
247 else if (key === 'client_secret') self.store.client.secret = matches[1] 251 else if (key === 'client_secret') self.store.client.secret = matches[1]
@@ -252,7 +256,7 @@ export class PeerTubeServer {
252 256
253 // Check if all required sentences are here 257 // Check if all required sentences are here
254 for (const key of Object.keys(serverRunString)) { 258 for (const key of Object.keys(serverRunString)) {
255 if (data.toString().indexOf(key) !== -1) serverRunString[key] = true 259 if (log.includes(key)) serverRunString[key] = true
256 if (serverRunString[key] === false) dontContinue = true 260 if (serverRunString[key] === false) dontContinue = true
257 } 261 }
258 262
@@ -260,7 +264,7 @@ export class PeerTubeServer {
260 if (dontContinue === true) return 264 if (dontContinue === true) return
261 265
262 if (options.hideLogs === false) { 266 if (options.hideLogs === false) {
263 console.log(data.toString()) 267 console.log(log)
264 } else { 268 } else {
265 process.removeListener('exit', onParentExit) 269 process.removeListener('exit', onParentExit)
266 self.app.stdout.removeListener('data', onStdout) 270 self.app.stdout.removeListener('data', onStdout)
diff --git a/shared/extra-utils/users/blocklist-command.ts b/shared/extra-utils/users/blocklist-command.ts
index 14491a1ae..2e7ed074d 100644
--- a/shared/extra-utils/users/blocklist-command.ts
+++ b/shared/extra-utils/users/blocklist-command.ts
@@ -1,6 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import { AccountBlock, HttpStatusCode, ResultList, ServerBlock } from '@shared/models' 3import { AccountBlock, BlockStatus, HttpStatusCode, ResultList, ServerBlock } from '@shared/models'
4import { AbstractCommand, OverrideCommandOptions } from '../shared' 4import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 5
6type ListBlocklistOptions = OverrideCommandOptions & { 6type ListBlocklistOptions = OverrideCommandOptions & {
@@ -37,6 +37,29 @@ export class BlocklistCommand extends AbstractCommand {
37 37
38 // --------------------------------------------------------------------------- 38 // ---------------------------------------------------------------------------
39 39
40 getStatus (options: OverrideCommandOptions & {
41 accounts?: string[]
42 hosts?: string[]
43 }) {
44 const { accounts, hosts } = options
45
46 const path = '/api/v1/blocklist/status'
47
48 return this.getRequestBody<BlockStatus>({
49 ...options,
50
51 path,
52 query: {
53 accounts,
54 hosts
55 },
56 implicitToken: false,
57 defaultExpectedStatus: HttpStatusCode.OK_200
58 })
59 }
60
61 // ---------------------------------------------------------------------------
62
40 addToMyBlocklist (options: OverrideCommandOptions & { 63 addToMyBlocklist (options: OverrideCommandOptions & {
41 account?: string 64 account?: string
42 server?: string 65 server?: string
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts
index 4d2784dde..c05c2be6c 100644
--- a/shared/extra-utils/videos/videos.ts
+++ b/shared/extra-utils/videos/videos.ts
@@ -217,6 +217,7 @@ async function completeVideoCheck (
217 expect(torrent.files).to.be.an('array') 217 expect(torrent.files).to.be.an('array')
218 expect(torrent.files.length).to.equal(1) 218 expect(torrent.files.length).to.equal(1)
219 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 219 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
220 expect(torrent.files[0].name).to.equal(`${videoDetails.name} ${file.resolution.id}p${extension}`)
220 } 221 }
221 222
222 expect(videoDetails.thumbnailPath).to.exist 223 expect(videoDetails.thumbnailPath).to.exist
diff --git a/shared/models/moderation/block-status.model.ts b/shared/models/moderation/block-status.model.ts
new file mode 100644
index 000000000..597312757
--- /dev/null
+++ b/shared/models/moderation/block-status.model.ts
@@ -0,0 +1,15 @@
1export interface BlockStatus {
2 accounts: {
3 [ handle: string ]: {
4 blockedByServer: boolean
5 blockedByUser?: boolean
6 }
7 }
8
9 hosts: {
10 [ host: string ]: {
11 blockedByServer: boolean
12 blockedByUser?: boolean
13 }
14 }
15}
diff --git a/shared/models/moderation/index.ts b/shared/models/moderation/index.ts
index 8b6042e97..f8e6d351c 100644
--- a/shared/models/moderation/index.ts
+++ b/shared/models/moderation/index.ts
@@ -1,3 +1,4 @@
1export * from './abuse' 1export * from './abuse'
2export * from './block-status.model'
2export * from './account-block.model' 3export * from './account-block.model'
3export * from './server-block.model' 4export * from './server-block.model'
diff --git a/shared/models/plugins/client/plugin-selector-id.type.ts b/shared/models/plugins/client/plugin-selector-id.type.ts
index b74dffbef..8d23314b5 100644
--- a/shared/models/plugins/client/plugin-selector-id.type.ts
+++ b/shared/models/plugins/client/plugin-selector-id.type.ts
@@ -1 +1,10 @@
1export type PluginSelectorId = 'login-form' 1export type PluginSelectorId =
2 'login-form' |
3 'menu-user-dropdown-language-item' |
4 'about-instance-features' |
5 'about-instance-statistics' |
6 'about-instance-moderation' |
7 'about-menu-instance' |
8 'about-menu-peertube' |
9 'about-menu-network' |
10 'about-instance-other-information'
diff --git a/shared/models/plugins/server/api/install-plugin.model.ts b/shared/models/plugins/server/api/install-plugin.model.ts
index 5a268ebe1..a1d009a00 100644
--- a/shared/models/plugins/server/api/install-plugin.model.ts
+++ b/shared/models/plugins/server/api/install-plugin.model.ts
@@ -1,4 +1,5 @@
1export interface InstallOrUpdatePlugin { 1export interface InstallOrUpdatePlugin {
2 npmName?: string 2 npmName?: string
3 pluginVersion?: string
3 path?: string 4 path?: string
4} 5}
diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts
index 3ed932494..52d3d9588 100644
--- a/shared/models/server/custom-config.model.ts
+++ b/shared/models/server/custom-config.model.ts
@@ -52,6 +52,20 @@ export interface CustomConfig {
52 } 52 }
53 } 53 }
54 54
55 client: {
56 videos: {
57 miniature: {
58 preferAuthorDisplayName: boolean
59 }
60 }
61
62 menu: {
63 login: {
64 redirectOnSingleExternalAuth: boolean
65 }
66 }
67 }
68
55 cache: { 69 cache: {
56 previews: { 70 previews: {
57 size: number 71 size: number
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts
index e75eefd47..9f17276e0 100644
--- a/shared/models/server/server-config.model.ts
+++ b/shared/models/server/server-config.model.ts
@@ -39,6 +39,12 @@ export interface ServerConfig {
39 preferAuthorDisplayName: boolean 39 preferAuthorDisplayName: boolean
40 } 40 }
41 } 41 }
42
43 menu: {
44 login: {
45 redirectOnSingleExternalAuth: boolean
46 }
47 }
42 } 48 }
43 49
44 webadmin: { 50 webadmin: {