Skip to content

Commit 2dad4fe

Browse files
committed
Add logic to store and retrieve the UserSubDomainsEnabled property from the frontend.
1 parent 18ee49c commit 2dad4fe

3 files changed

Lines changed: 24 additions & 14 deletions

File tree

solid/js/settings-admin.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
$(document).ready(function() {
1+
$(document).ready(function () {
2+
$('#solid-enable-user-subdomains').change(function (el) {
3+
OCP.AppConfig.setValue('solid', 'userSubDomainsEnabled', this.checked ? true : false)
4+
})
5+
26
$('#solid-private-key').change(function(el) {
37
OCP.AppConfig.setValue('solid', 'privateKey', this.value);
48
});

solid/lib/Settings/SolidAdmin.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,11 @@ class SolidAdmin implements ISettings {
1111
private IL10N $l;
1212
private IConfig $config;
1313
private BaseServerConfig $serverConfig;
14-
// private Bool $userDomains;
1514

16-
public function __construct(IConfig $config, IL10N $l
17-
// , bool $userDomains
18-
) {
15+
public function __construct(IConfig $config, IL10N $l) {
1916
$this->config = $config;
2017
$this->l = $l;
2118
$this->serverConfig = new BaseServerConfig($config);
22-
// $this->userDomains = $userDomains;
2319
}
2420

2521
/**
@@ -29,10 +25,10 @@ public function getForm() {
2925
$allClients = $this->serverConfig->getClients();
3026

3127
$parameters = [
32-
'privateKey' => $this->serverConfig->getPrivateKey(),
33-
'encryptionKey' => $this->serverConfig->getEncryptionKey(),
34-
'clients' => $allClients,
35-
// 'userDomains' => (int) $this->userDomains
28+
'clients' => $allClients,
29+
'encryptionKey' => $this->serverConfig->getEncryptionKey(),
30+
'privateKey' => $this->serverConfig->getPrivateKey(),
31+
'userSubDomainsEnabled' => $this->serverConfig->getUserSubDomainsEnabled(),
3632
];
3733

3834
return new TemplateResponse('solid', 'admin', $parameters, '');

solid/templates/admin.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
<?php
22
// phpcs:ignoreFile
33
// Let codesniffer ignore this file, as we are heavily mixing php and HTML together.
4-
script('solid', 'settings-admin');
5-
style('solid', 'settings-admin');
4+
/**
5+
* @var IL10N $l
6+
* @var array $_
7+
*/
8+
9+
use OCA\Solid\AppInfo\Application;
10+
use OCP\IL10N;
11+
use OCP\Util;
12+
13+
Util::addScript(Application::APP_ID, 'settings-admin');
14+
Util::addStyle(Application::APP_ID, 'settings-admin');
615
?>
716

817
<div id="solid-admin" class="section">
9-
<h2 class="inlineblock"><?php p($l->t('Solid Server Settings')); ?></h2>
18+
<h2 class="inlineblock"><?php
19+
p($l->t('Solid Server Settings')); ?></h2>
1020
<p>
1121
<label>
12-
<input type="checkbox" id="solid-user-subdomains" class="textaligned" value="1" <?php if ($_['userDomains']); ?> checked="checked" <?php endif; ?>>
22+
<input type="checkbox" id="solid-enable-user-subdomains" class="textaligned" value="1" <?php if ($_['userSubDomainsEnabled']) { ?> checked="checked" <?php } ?>>
1323
<span><?php p($l->t('Enable User Subdomains')); ?></span>
1424
</label>
1525
</p>

0 commit comments

Comments
 (0)