diff --git a/public/index.html b/public/index.html index 4803235..fca8996 100644 --- a/public/index.html +++ b/public/index.html @@ -51,9 +51,9 @@
-

Управление задачами 0.9

+

Управление задачами {{APP_VERSION}}

@@ -64,7 +64,7 @@
School CRM Logo -

School CRM - Управление задачами

+

{{SCHOOL_NAME}} - Управление задачами

School CRM Logo
diff --git a/public/loadMyCreatedTasks.js b/public/loadMyCreatedTasks.js index 03bad16..e2e6dc9 100644 --- a/public/loadMyCreatedTasks.js +++ b/public/loadMyCreatedTasks.js @@ -34,9 +34,9 @@ function startAutoUpdate() { // Запускаем новый интервал (каждые 15 секунд) updateInterval = setInterval(() => { autoUpdateTasks(); - }, 15000); // 15000 мс = 15 секунд + }, 120000); // 120000 мс = 2 минуты - console.log('🔄 Автообновление задач запущено (каждые 15 сек)'); + console.log('🔄 Автообновление задач запущено (каждые 2 минуты)'); } // Остановка автоматического обновления diff --git a/server.js b/server.js index c23c867..9437ac4 100644 --- a/server.js +++ b/server.js @@ -37,6 +37,27 @@ let serverReady = false; let adminRouter = null; let upload = null; +let cachedHtml = null; +app.get('/', (req, res) => { + if (cachedHtml) { + // Заменяем плейсхолдеры в закешированном HTML (на случай, если переменные окружения изменились – но обычно они не меняются во время работы) + let modifiedHtml = cachedHtml + .replace(/{{APP_NAME}}/g, process.env.APP_NAME) + .replace(/{{APP_VERSION}}/g, process.env.APP_VERSION) + .replace(/{{SCHOOL_NAME}}/g, process.env.SCHOOL_NAME); + return res.send(modifiedHtml); + } + + const filePath = path.join(__dirname, 'public', 'index.html'); + fs.readFile(filePath, 'utf8', (err, html) => { + if (err) { + return res.status(500).send('Ошибка'); + } + cachedHtml = html; + // ... отправка + }); +}); + // Инициализируем multer сразу с настройками по умолчанию const uploadsDir = path.join(__dirname, 'data', 'uploads'); const createDirIfNotExists = (dirPath) => {