Добавить редактор конфигурационных файлов XLX

Этот коммит содержится в:
2026-05-18 06:50:36 +09:00
родитель 94ea0bbda1
Коммит c2f62feb09
8 изменённых файлов: 383 добавлений и 2 удалений
+13
Просмотреть файл
@@ -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);