vite_deleteelectron

This commit is contained in:
2026-08-09 21:02:10 +03:00
parent 5d2fc5773c
commit 4ba9dd8012
99 changed files with 7080 additions and 48649 deletions
@@ -1,4 +1,4 @@
const fs = require('fs-extra');
const fs = require('fs').promises;
const path = require('path');
const logger = require('../logger');
@@ -131,7 +131,8 @@ const updateAdminServerSettings = async (req, res) => {
const getBackendServerSettings = async (req, res) => {
try {
const config = await fs.readJson(backendConfigPath);
const content = await fs.readFile(backendConfigPath, 'utf8');
const config = JSON.parse(content);
res.json({
host: config.server?.host || '',
port: config.server?.port || ''
@@ -148,11 +149,12 @@ const updateBackendServerSettings = async (req, res) => {
return res.status(400).json({ message: 'host и port обязательны' });
}
try {
const config = await fs.readJson(backendConfigPath);
const content = await fs.readFile(backendConfigPath, 'utf8');
const config = JSON.parse(content);
config.server = config.server || {};
config.server.host = host;
config.server.port = port;
await fs.writeJson(backendConfigPath, config, { spaces: 4 });
await fs.writeFile(backendConfigPath, JSON.stringify(config, null, 4));
res.json({ message: 'Параметры backend-server обновлены' });
} catch (e) {
logger.error('Ошибка записи backend/config.json:', e);