fix(security): update dependencies to avoid RCE and other exploits
Обновлены зависимости Node.js, которые были уязвимы с разной степенью критичности. Обновлен Next.js, так как его предыдущая используемая версия привнесла в production-среду постоянную борьбу с майнерами. К сожалению, в этом коммите парсер расписания сломан.
This commit is contained in:
@@ -14,18 +14,18 @@ async function handler(
|
||||
// Путь к файлу логов (в корне проекта)
|
||||
const logPath = path.join(process.cwd(), 'error.log')
|
||||
|
||||
// Проверяем существование файла
|
||||
// Проверяем существование файла (если нет — возвращаем пустую строку, UI покажет «Логи пусты»)
|
||||
if (!fs.existsSync(logPath)) {
|
||||
res.status(200).json({ success: true, logs: 'Файл логов пуст или не существует.' })
|
||||
res.status(200).json({ success: true, logs: '' })
|
||||
return
|
||||
}
|
||||
|
||||
// Читаем файл
|
||||
const logs = fs.readFileSync(logPath, 'utf8')
|
||||
|
||||
// Если файл пуст
|
||||
|
||||
// Если файл пуст — возвращаем пустую строку
|
||||
if (!logs || logs.trim().length === 0) {
|
||||
res.status(200).json({ success: true, logs: 'Файл логов пуст.' })
|
||||
res.status(200).json({ success: true, logs: '' })
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ async function handler(
|
||||
const currentSettings = loadSettings(true)
|
||||
|
||||
// Обновление настроек
|
||||
const { weekNavigationEnabled, showAddGroupButton, vacationModeEnabled, vacationModeContent, debug } = req.body
|
||||
const { weekNavigationEnabled, showAddGroupButton, showTeachersButton, vacationModeEnabled, vacationModeContent, debug } = req.body
|
||||
|
||||
if (typeof weekNavigationEnabled !== 'boolean') {
|
||||
res.status(400).json({ error: 'weekNavigationEnabled must be a boolean' })
|
||||
@@ -36,6 +36,11 @@ async function handler(
|
||||
return
|
||||
}
|
||||
|
||||
if (showTeachersButton !== undefined && typeof showTeachersButton !== 'boolean') {
|
||||
res.status(400).json({ error: 'showTeachersButton must be a boolean' })
|
||||
return
|
||||
}
|
||||
|
||||
if (vacationModeEnabled !== undefined && typeof vacationModeEnabled !== 'boolean') {
|
||||
res.status(400).json({ error: 'vacationModeEnabled must be a boolean' })
|
||||
return
|
||||
@@ -77,6 +82,7 @@ async function handler(
|
||||
...currentSettings,
|
||||
weekNavigationEnabled,
|
||||
showAddGroupButton: showAddGroupButton !== undefined ? showAddGroupButton : (currentSettings.showAddGroupButton ?? true),
|
||||
showTeachersButton: showTeachersButton !== undefined ? showTeachersButton : (currentSettings.showTeachersButton ?? true),
|
||||
vacationModeEnabled: vacationModeEnabled !== undefined ? vacationModeEnabled : (currentSettings.vacationModeEnabled ?? false),
|
||||
vacationModeContent: vacationModeContent !== undefined ? vacationModeContent : (currentSettings.vacationModeContent || ''),
|
||||
...(validatedDebug !== undefined && { debug: validatedDebug })
|
||||
|
||||
Reference in New Issue
Block a user