Enable WebUI by default.

This commit is contained in:
Abdulmhsen B. A. A
2024-05-14 18:07:44 +03:00
parent ebb85fdd68
commit b119601a48
18 changed files with 473 additions and 207 deletions

View File

@@ -11,7 +11,6 @@ use App\Libs\Config;
use App\Libs\ConfigFile;
use App\Libs\DataUtil;
use App\Libs\HTTP_STATUS;
use App\Libs\Options;
use App\Libs\Traits\APITraits;
use JsonException;
use Psr\Http\Message\ResponseInterface as iResponse;
@@ -126,17 +125,14 @@ final class Update
],
];
$optionals = [
Options::DUMP_PAYLOAD => 'bool',
Options::LIBRARY_SEGMENT => 'int',
Options::IGNORE => 'string',
];
$spec = require __DIR__ . '/../../../config/backend.spec.php';
foreach ($optionals as $key => $type) {
if (null !== ($value = $data->get('options.' . $key))) {
settype($value, $type);
$newData = ag_set($newData, "options.{$key}", $value);
foreach ($data->get('options', []) as $key => $value) {
if (false === ag_exists($spec, "options.{$key}") || null === $value) {
continue;
}
$newData = ag_set($newData, "options.{$key}", $value);
}
return deepArrayMerge([$config, $client->fromRequest($newData, $request)]);

View File

@@ -15,7 +15,6 @@ use App\Libs\DataUtil;
use App\Libs\Exceptions\Backends\InvalidContextException;
use App\Libs\Exceptions\RuntimeException;
use App\Libs\HTTP_STATUS;
use App\Libs\Options;
use App\Libs\Traits\APITraits;
use App\Libs\Uri;
use Psr\Http\Message\ResponseInterface as iResponse;
@@ -149,17 +148,14 @@ final class Add
'options' => [],
];
$optionals = [
Options::DUMP_PAYLOAD => 'bool',
Options::LIBRARY_SEGMENT => 'int',
Options::IGNORE => 'string',
];
$spec = require __DIR__ . '/../../../config/backend.spec.php';
foreach ($optionals as $key => $type) {
if (null !== ($value = $data->get('options.' . $key))) {
settype($value, $type);
$config = ag_set($config, "options.{$key}", $value);
foreach ($data->get('options', []) as $key => $value) {
if (false === ag_exists($spec, "options.{$key}") || null === $value) {
continue;
}
$config = ag_set($config, "options.{$key}", $value);
}
return $client->fromRequest($config, $request);