Добавить редактор конфигурационных файлов XLX
Этот коммит содержится в:
@@ -7,6 +7,7 @@ use Xlx\Domain\AccessExportService;
|
||||
use Xlx\Domain\IdAllocator;
|
||||
use Xlx\Domain\PaymentService;
|
||||
use Xlx\Domain\RegistrationService;
|
||||
use Xlx\Domain\XlxdConfigFileService;
|
||||
use Xlx\Domain\XlxdSettingsService;
|
||||
use Xlx\Domain\YooKassaClient;
|
||||
use Xlx\Support\Database;
|
||||
@@ -117,6 +118,18 @@ try {
|
||||
Response::json(['ok' => true, 'data' => $service->save($pdo, $input['settings'] ?? [], (bool) ($input['apply'] ?? false))]);
|
||||
}
|
||||
|
||||
if ($method === 'GET' && $path === '/api/admin/xlxd/config-files') {
|
||||
Security::requireAdminToken($config);
|
||||
Response::json(['ok' => true, 'data' => (new XlxdConfigFileService($config))->list()]);
|
||||
}
|
||||
|
||||
if ($method === 'POST' && $path === '/api/admin/xlxd/config-files') {
|
||||
Security::requireAdminToken($config);
|
||||
$input = Input::json();
|
||||
$service = new XlxdConfigFileService($config);
|
||||
Response::json(['ok' => true, 'data' => $service->save((string) ($input['file'] ?? ''), (string) ($input['content'] ?? ''))]);
|
||||
}
|
||||
|
||||
Response::error('Route not found.', 404);
|
||||
} catch (Throwable $throwable) {
|
||||
Response::error($throwable->getMessage(), 400);
|
||||
|
||||
Ссылка в новой задаче
Block a user