diff options
Diffstat (limited to 'shared/server-commands/server')
-rw-r--r-- | shared/server-commands/server/config-command.ts | 50 | ||||
-rw-r--r-- | shared/server-commands/server/server.ts | 3 |
2 files changed, 46 insertions, 7 deletions
diff --git a/shared/server-commands/server/config-command.ts b/shared/server-commands/server/config-command.ts index 1c2315ed1..51267b85b 100644 --- a/shared/server-commands/server/config-command.ts +++ b/shared/server-commands/server/config-command.ts | |||
@@ -18,6 +18,33 @@ export class ConfigCommand extends AbstractCommand { | |||
18 | } | 18 | } |
19 | } | 19 | } |
20 | 20 | ||
21 | // --------------------------------------------------------------------------- | ||
22 | |||
23 | static getEmailOverrideConfig (emailPort: number) { | ||
24 | return { | ||
25 | smtp: { | ||
26 | hostname: '127.0.0.1', | ||
27 | port: emailPort | ||
28 | } | ||
29 | } | ||
30 | } | ||
31 | |||
32 | // --------------------------------------------------------------------------- | ||
33 | |||
34 | enableSignup (requiresApproval: boolean) { | ||
35 | return this.updateExistingSubConfig({ | ||
36 | newConfig: { | ||
37 | signup: { | ||
38 | enabled: true, | ||
39 | requiresApproval, | ||
40 | limit: -1 | ||
41 | } | ||
42 | } | ||
43 | }) | ||
44 | } | ||
45 | |||
46 | // --------------------------------------------------------------------------- | ||
47 | |||
21 | disableImports () { | 48 | disableImports () { |
22 | return this.setImportsEnabled(false) | 49 | return this.setImportsEnabled(false) |
23 | } | 50 | } |
@@ -44,6 +71,16 @@ export class ConfigCommand extends AbstractCommand { | |||
44 | }) | 71 | }) |
45 | } | 72 | } |
46 | 73 | ||
74 | // --------------------------------------------------------------------------- | ||
75 | |||
76 | enableChannelSync () { | ||
77 | return this.setChannelSyncEnabled(true) | ||
78 | } | ||
79 | |||
80 | disableChannelSync () { | ||
81 | return this.setChannelSyncEnabled(false) | ||
82 | } | ||
83 | |||
47 | private setChannelSyncEnabled (enabled: boolean) { | 84 | private setChannelSyncEnabled (enabled: boolean) { |
48 | return this.updateExistingSubConfig({ | 85 | return this.updateExistingSubConfig({ |
49 | newConfig: { | 86 | newConfig: { |
@@ -56,13 +93,7 @@ export class ConfigCommand extends AbstractCommand { | |||
56 | }) | 93 | }) |
57 | } | 94 | } |
58 | 95 | ||
59 | enableChannelSync () { | 96 | // --------------------------------------------------------------------------- |
60 | return this.setChannelSyncEnabled(true) | ||
61 | } | ||
62 | |||
63 | disableChannelSync () { | ||
64 | return this.setChannelSyncEnabled(false) | ||
65 | } | ||
66 | 97 | ||
67 | enableLive (options: { | 98 | enableLive (options: { |
68 | allowReplay?: boolean | 99 | allowReplay?: boolean |
@@ -142,6 +173,8 @@ export class ConfigCommand extends AbstractCommand { | |||
142 | }) | 173 | }) |
143 | } | 174 | } |
144 | 175 | ||
176 | // --------------------------------------------------------------------------- | ||
177 | |||
145 | enableStudio () { | 178 | enableStudio () { |
146 | return this.updateExistingSubConfig({ | 179 | return this.updateExistingSubConfig({ |
147 | newConfig: { | 180 | newConfig: { |
@@ -152,6 +185,8 @@ export class ConfigCommand extends AbstractCommand { | |||
152 | }) | 185 | }) |
153 | } | 186 | } |
154 | 187 | ||
188 | // --------------------------------------------------------------------------- | ||
189 | |||
155 | getConfig (options: OverrideCommandOptions = {}) { | 190 | getConfig (options: OverrideCommandOptions = {}) { |
156 | const path = '/api/v1/config' | 191 | const path = '/api/v1/config' |
157 | 192 | ||
@@ -304,6 +339,7 @@ export class ConfigCommand extends AbstractCommand { | |||
304 | signup: { | 339 | signup: { |
305 | enabled: false, | 340 | enabled: false, |
306 | limit: 5, | 341 | limit: 5, |
342 | requiresApproval: true, | ||
307 | requiresEmailVerification: false, | 343 | requiresEmailVerification: false, |
308 | minimumAge: 16 | 344 | minimumAge: 16 |
309 | }, | 345 | }, |
diff --git a/shared/server-commands/server/server.ts b/shared/server-commands/server/server.ts index ae1395a74..793fae3a8 100644 --- a/shared/server-commands/server/server.ts +++ b/shared/server-commands/server/server.ts | |||
@@ -18,6 +18,7 @@ import { | |||
18 | BlocklistCommand, | 18 | BlocklistCommand, |
19 | LoginCommand, | 19 | LoginCommand, |
20 | NotificationsCommand, | 20 | NotificationsCommand, |
21 | RegistrationsCommand, | ||
21 | SubscriptionsCommand, | 22 | SubscriptionsCommand, |
22 | TwoFactorCommand, | 23 | TwoFactorCommand, |
23 | UsersCommand | 24 | UsersCommand |
@@ -147,6 +148,7 @@ export class PeerTubeServer { | |||
147 | views?: ViewsCommand | 148 | views?: ViewsCommand |
148 | twoFactor?: TwoFactorCommand | 149 | twoFactor?: TwoFactorCommand |
149 | videoToken?: VideoTokenCommand | 150 | videoToken?: VideoTokenCommand |
151 | registrations?: RegistrationsCommand | ||
150 | 152 | ||
151 | constructor (options: { serverNumber: number } | { url: string }) { | 153 | constructor (options: { serverNumber: number } | { url: string }) { |
152 | if ((options as any).url) { | 154 | if ((options as any).url) { |
@@ -430,5 +432,6 @@ export class PeerTubeServer { | |||
430 | this.views = new ViewsCommand(this) | 432 | this.views = new ViewsCommand(this) |
431 | this.twoFactor = new TwoFactorCommand(this) | 433 | this.twoFactor = new TwoFactorCommand(this) |
432 | this.videoToken = new VideoTokenCommand(this) | 434 | this.videoToken = new VideoTokenCommand(this) |
435 | this.registrations = new RegistrationsCommand(this) | ||
433 | } | 436 | } |
434 | } | 437 | } |