diff options
-rw-r--r-- | client/src/app/about/about.component.html | 24 | ||||
-rw-r--r-- | client/src/app/about/about.component.scss | 2 | ||||
-rw-r--r-- | client/src/app/about/about.component.ts | 4 | ||||
-rw-r--r-- | server/controllers/api/config.ts | 13 |
4 files changed, 31 insertions, 12 deletions
diff --git a/client/src/app/about/about.component.html b/client/src/app/about/about.component.html index bcb4ed2be..bad90d161 100644 --- a/client/src/app/about/about.component.html +++ b/client/src/app/about/about.component.html | |||
@@ -13,14 +13,26 @@ | |||
13 | <div class="section-title">Terms</div> | 13 | <div class="section-title">Terms</div> |
14 | 14 | ||
15 | <div [innerHTML]="termsHTML"></div> | 15 | <div [innerHTML]="termsHTML"></div> |
16 | </div> | ||
17 | |||
18 | <div class="signup"> | ||
19 | <div class="section-title">Signup</div> | ||
20 | |||
21 | <div *ngIf="isSignupAllowed"> | ||
22 | User registration is allowed and | ||
23 | |||
24 | <ng-template [ngIf]="userVideoQuota !== -1"> | ||
25 | this instance provides a baseline quota of {{ userVideoQuota | bytes }} space for the videos of its users. | ||
26 | </ng-template> | ||
27 | |||
28 | <ng-template [ngIf]="userVideoQuota === -1"> | ||
29 | this instance provides unlimited space for the videos of its users. | ||
30 | </ng-template> | ||
31 | </div> | ||
16 | 32 | ||
17 | <div *ngIf="userVideoQuota !== -1;else noQuota"> | 33 | <div *ngIf="isSignupAllowed === false"> |
18 | This instance provides a baseline quota of {{ userVideoQuota | bytes: 0 }} space for the videos of its users. | 34 | User registration is currently not allowed. |
19 | </div> | 35 | </div> |
20 | |||
21 | <ng-template #noQuota> | ||
22 | This instance provides unlimited space for the videos of its users. | ||
23 | </ng-template> | ||
24 | </div> | 36 | </div> |
25 | 37 | ||
26 | <div id="p2p-privacy"> | 38 | <div id="p2p-privacy"> |
diff --git a/client/src/app/about/about.component.scss b/client/src/app/about/about.component.scss index 09e9c68cb..2a22b9528 100644 --- a/client/src/app/about/about.component.scss +++ b/client/src/app/about/about.component.scss | |||
@@ -7,6 +7,6 @@ | |||
7 | margin-bottom: 5px; | 7 | margin-bottom: 5px; |
8 | } | 8 | } |
9 | 9 | ||
10 | .description, .terms { | 10 | .description, .terms, .signup { |
11 | margin-bottom: 30px; | 11 | margin-bottom: 30px; |
12 | } | 12 | } |
diff --git a/client/src/app/about/about.component.ts b/client/src/app/about/about.component.ts index 7edc013e1..2fd48f0d3 100644 --- a/client/src/app/about/about.component.ts +++ b/client/src/app/about/about.component.ts | |||
@@ -27,6 +27,10 @@ export class AboutComponent implements OnInit { | |||
27 | return this.serverService.getConfig().user.videoQuota | 27 | return this.serverService.getConfig().user.videoQuota |
28 | } | 28 | } |
29 | 29 | ||
30 | get isSignupAllowed () { | ||
31 | return this.serverService.getConfig().signup.allowed | ||
32 | } | ||
33 | |||
30 | ngOnInit () { | 34 | ngOnInit () { |
31 | this.serverService.getAbout() | 35 | this.serverService.getAbout() |
32 | .subscribe( | 36 | .subscribe( |
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 8d7fc8cf1..88f047adc 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -117,14 +117,17 @@ async function deleteCustomConfig (req: express.Request, res: express.Response, | |||
117 | async function updateCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { | 117 | async function updateCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { |
118 | const toUpdate: CustomConfig = req.body | 118 | const toUpdate: CustomConfig = req.body |
119 | 119 | ||
120 | // Need to change the videoQuota key a little bit | 120 | // Force number conversion |
121 | const toUpdateJSON = omit(toUpdate, 'videoQuota') | 121 | toUpdate.cache.previews.size = parseInt('' + toUpdate.cache.previews.size, 10) |
122 | toUpdate.signup.limit = parseInt('' + toUpdate.signup.limit, 10) | ||
123 | toUpdate.user.videoQuota = parseInt('' + toUpdate.user.videoQuota, 10) | ||
124 | toUpdate.transcoding.threads = parseInt('' + toUpdate.transcoding.threads, 10) | ||
125 | |||
126 | // camelCase to snake_case key | ||
127 | const toUpdateJSON = omit(toUpdate, 'user.videoQuota', 'instance.defaultClientRoute', 'instance.shortDescription') | ||
122 | toUpdateJSON.user['video_quota'] = toUpdate.user.videoQuota | 128 | toUpdateJSON.user['video_quota'] = toUpdate.user.videoQuota |
123 | toUpdateJSON.instance['default_client_route'] = toUpdate.instance.defaultClientRoute | 129 | toUpdateJSON.instance['default_client_route'] = toUpdate.instance.defaultClientRoute |
124 | toUpdateJSON.instance['short_description'] = toUpdate.instance.shortDescription | 130 | toUpdateJSON.instance['short_description'] = toUpdate.instance.shortDescription |
125 | delete toUpdate.user.videoQuota | ||
126 | delete toUpdate.instance.defaultClientRoute | ||
127 | delete toUpdate.instance.shortDescription | ||
128 | 131 | ||
129 | await writeFilePromise(CONFIG.CUSTOM_FILE, JSON.stringify(toUpdateJSON, undefined, 2)) | 132 | await writeFilePromise(CONFIG.CUSTOM_FILE, JSON.stringify(toUpdateJSON, undefined, 2)) |
130 | 133 | ||