diff --git a/data/base.css b/data/base.css new file mode 100644 index 0000000..bb9246d --- /dev/null +++ b/data/base.css @@ -0,0 +1,127 @@ +/* ========================================== + ОБЩИЕ СТИЛИ (ШРИФТЫ, БАЗОВЫЕ СЕЛЕКТОРЫ) + ========================================== */ +body { + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + background-color: #121212; /* Глубокий черный фон */ + color: #ffffff; + margin: 0; + padding: 0; + display: flex; + flex-direction: column; + align-items: center; +} + +h1 { + color: #ff6600; + margin: 0 0 30px 0; + text-transform: uppercase; + letter-spacing: 2px; + border-bottom: 2px solid #ff6600; + padding-bottom: 10px; +} + +/* ========================================== + ШАПКА (TOP BAR) — ПРИСУТСТВУЕТ ВЕЗДЕ + ========================================== */ +.top-bar { + width: 100%; + background-color: #1a1a1a; + border-bottom: 2px solid #ff6600; /* Оранжевая полоса снизу */ + box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); + position: sticky; + top: 0; + z-index: 1000; +} + +.top-bar-container { + max-width: 1200px; + margin: 0 auto; + padding: 0 20px; + height: 60px; + display: flex; + justify-content: space-between; + align-items: center; +} + +.logo { + font-size: 20px; + font-weight: bold; + color: #ffffff; + text-decoration: none; + text-transform: uppercase; + letter-spacing: 1px; +} + +.logo span { + color: #ff6600; +} + +.nav-links { + display: flex; + align-items: center; + gap: 20px; +} + +.nav-link { + color: #e0e0e0; + text-decoration: none; + font-size: 15px; + transition: color 0.2s ease; +} + +.nav-link:hover, +.nav-link.active { + color: #ff6600; +} + +.nav-link.active { + font-weight: 600; +} + +/* Общий контейнер контента */ +.main-content { + width: 100%; + padding: 40px 20px; + box-sizing: border-box; +} + +/* ========================================== + АДАПТИВНОСТЬ ДЛЯ ШАПКИ И БАЗОВЫХ ЭЛЕМЕНТОВ + ========================================== */ +@media (max-width: 768px) { + .top-bar-container { + height: auto; + padding: 12px 16px; + flex-direction: column; + align-items: flex-start; + gap: 12px; + } + + .nav-links { + width: 100%; + justify-content: space-between; + flex-wrap: wrap; + gap: 10px; + } + + .main-content { + padding: 24px 14px; + } + + h1 { + font-size: 24px; + letter-spacing: 1px; + } +} + +/* --- СТИЛИ ДЛЯ ЧЕКБОКСА (CHECKBUTTON) --- */ +.checkbox-group { + display: flex; + flex-direction: row; + align-items: center; + gap: 12px; + cursor: pointer; + user-select: none; + margin-bottom: 25px; +} \ No newline at end of file diff --git a/data/root.css b/data/root.css index 90d6368..f93171b 100644 --- a/data/root.css +++ b/data/root.css @@ -1,188 +1,94 @@ - /* Общие стили для страницы */ - body { - font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; - background-color: #121212; /* Глубокий черный фон */ - color: #ffffff; - margin: 0; - padding: 0; - display: flex; - flex-direction: column; - align-items: center; - } +/* Кнопка настроек в шапке (уникальна для списка пользователей) */ +.settings-btn { + display: flex; + align-items: center; + gap: 8px; + background-color: transparent; + color: #ff6600; + border: 1px solid #ff6600; + padding: 8px 16px; + border-radius: 4px; + cursor: pointer; + font-weight: 600; + text-decoration: none; + font-size: 14px; + transition: all 0.3s ease; +} - /* --- TOP BAR STYLE --- */ - .top-bar { - width: 100%; - background-color: #1a1a1a; /* Темно-серый фон панели */ - border-bottom: 2px solid #ff6600; /* Оранжевая полоса снизу */ - box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); - position: sticky; - top: 0; - z-index: 1000; - } +.settings-btn:hover { + background-color: #ff6600; + color: #000000; + box-shadow: 0 0 10px rgba(255, 102, 0, 0.4); +} - .top-bar-container { - max-width: 1200px; - margin: 0 auto; - padding: 0 20px; - height: 60px; - display: flex; - justify-content: space-between; - align-items: center; - } +/* Специфичное выравнивание для страницы таблицы */ +.main-content { + max-width: 940px; + display: flex; + flex-direction: column; + align-items: center; +} - /* Логотип / Название проекта */ - .logo { - font-size: 20px; - font-weight: bold; - color: #ffffff; - text-decoration: none; - text-transform: uppercase; - letter-spacing: 1px; - } - .logo span { - color: #ff6600; /* Оранжевый акцент */ - } +h1 { + align-self: flex-start; +} - /* Навигация и кнопка настроек */ - .nav-links { - display: flex; - align-items: center; - gap: 20px; - } +/* Контейнер для адаптивности таблицы */ +.table-container { + width: 100%; + overflow-x: auto; + box-shadow: 0 4px 15px rgba(255, 102, 0, 0.15); + border-radius: 8px; +} - .nav-link { - color: #e0e0e0; - text-decoration: none; - font-size: 15px; - transition: color 0.2s ease; - } - .nav-link:hover { - color: #ff6600; - } +/* Стили таблицы */ +table { + width: 100%; + border-collapse: collapse; + background-color: #1a1a1a; + text-align: left; + min-width: 600px; +} - /* Кнопка настроек */ - .settings-btn { - display: flex; - align-items: center; - gap: 8px; - background-color: transparent; - color: #ff6600; - border: 1px solid #ff6600; - padding: 8px 16px; - border-radius: 4px; - cursor: pointer; - font-weight: 600; - text-decoration: none; - font-size: 14px; - transition: all 0.3s ease; - } - .settings-btn:hover { - background-color: #ff6600; - color: #000000; - box-shadow: 0 0 10px rgba(255, 102, 0, 0.4); - } +/* Шапка таблицы */ +th { + background-color: #ff6600; + color: #000000; + padding: 15px; + font-weight: bold; + text-transform: uppercase; + font-size: 14px; +} - /* --- ОСНОВНОЙ КОНТЕНТ --- */ - .main-content { - width: 100%; - max-width: 940px; - padding: 40px 20px; - box-sizing: border-box; - display: flex; - flex-direction: column; - align-items: center; - } +/* Ячейки таблицы */ +td { + padding: 15px; + border-bottom: 1px solid #333333; + color: #e0e0e0; + font-size: 15px; +} - h1 { - color: #ff6600; - margin-bottom: 30px; - text-transform: uppercase; - letter-spacing: 2px; - border-bottom: 2px solid #ff6600; - padding-bottom: 10px; - align-self: flex-start; - } +/* Чередование цветов строк (зебра) */ +tr:nth-child(even) { + background-color: #222222; +} - /* Контейнер для адаптивности таблицы */ - .table-container { - width: 100%; - overflow-x: auto; - box-shadow: 0 4px 15px rgba(255, 102, 0, 0.15); - border-radius: 8px; - } +/* Эффект наведения на строку */ +tr:hover td { + background-color: #2a2a2a; + color: #ff8533; + transition: all 0.2s ease; +} - /* Стили таблицы */ - table { - width: 100%; - border-collapse: collapse; - background-color: #1a1a1a; - text-align: left; - min-width: 600px; - } +/* Адаптивность элементов таблицы */ +@media (max-width: 680px) { + .settings-btn { + width: 100%; + justify-content: center; + } - /* Шапка таблицы */ - th { - background-color: #ff6600; - color: #000000; - padding: 15px; - font-weight: bold; - text-transform: uppercase; - font-size: 14px; - } - - /* Ячейки таблицы */ - td { - padding: 15px; - border-bottom: 1px solid #333333; - color: #e0e0e0; - font-size: 15px; - } - - /* Чередование цветов строк (зебра) */ - tr:nth-child(even) { - background-color: #222222; - } - - /* Эффект наведения на строку */ - tr:hover td { - background-color: #2a2a2a; - color: #ff8533; - transition: all 0.2s ease; - } - - @media (max-width: 680px) { - .top-bar-container { - height: auto; - padding: 12px 16px; - flex-direction: column; - align-items: flex-start; - gap: 12px; - } - - .nav-links { - width: 100%; - justify-content: space-between; - flex-wrap: wrap; - gap: 10px; - } - - .settings-btn { - width: 100%; - justify-content: center; - } - - .main-content { - padding: 24px 14px; - } - - h1 { - font-size: 24px; - letter-spacing: 1px; - } - - th, td { - padding: 10px 8px; - font-size: 12px; - } - } + th, td { + padding: 10px 8px; + font-size: 12px; + } +} diff --git a/data/root.html b/data/root.html index 2079afc..d567148 100644 --- a/data/root.html +++ b/data/root.html @@ -4,26 +4,23 @@ Панель управления — Список пользователей - + + +
- - +
@@ -32,7 +29,7 @@

Список пользователей

- +
@@ -46,5 +43,5 @@ - - \ No newline at end of file + + diff --git a/data/settings.css b/data/settings.css index 80c8bcd..29be58c 100644 --- a/data/settings.css +++ b/data/settings.css @@ -1,291 +1,174 @@ - /* Общие стили для страницы */ - body { - font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; - background-color: #121212; /* Глубокий черный фон */ - color: #ffffff; - margin: 0; - padding: 0; - display: flex; - flex-direction: column; - align-items: center; - } +/* Специфичное ограничение ширины для карточек настроек */ +.main-content { + max-width: 700px; +} - /* --- TOP BAR STYLE --- */ - .top-bar { - width: 100%; - background-color: #1a1a1a; - border-bottom: 2px solid #ff6600; /* Оранжевая полоса снизу */ - box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); - position: sticky; - top: 0; - z-index: 1000; - } +/* Ссылка назад к списку */ +.back-link { + display: inline-flex; + align-items: center; + gap: 8px; + color: #a0a0a0; + text-decoration: none; + font-size: 14px; + margin-bottom: 20px; + transition: color 0.2s ease; +} - .top-bar-container { - max-width: 1200px; - margin: 0 auto; - padding: 0 20px; - height: 60px; - display: flex; - justify-content: space-between; - align-items: center; - } +.back-link:hover { + color: #ff6600; +} - .logo { - font-size: 20px; - font-weight: bold; - color: #ffffff; - text-decoration: none; - text-transform: uppercase; - letter-spacing: 1px; - } - .logo span { - color: #ff6600; - } +/* Сетка для блоков настроек */ +.settings-grid { + display: flex; + flex-direction: column; + gap: 30px; +} - .nav-links { - display: flex; - align-items: center; - gap: 20px; - } +/* Карточка настроек */ +.settings-card { + background-color: #1a1a1a; + border-radius: 8px; + padding: 30px; + box-shadow: 0 4px 15px rgba(255, 102, 0, 0.05); + border: 1px solid #2a2a2a; +} - .nav-link { - color: #e0e0e0; - text-decoration: none; - font-size: 15px; - transition: color 0.2s ease; - } - .nav-link:hover { - color: #ff6600; - } +.card-title { + font-size: 18px; + font-weight: 600; + margin-bottom: 25px; + color: #ffffff; + display: flex; + align-items: center; + gap: 10px; +} - .nav-link.active { - color: #ff6600; - font-weight: 600; - } +.form-group { + margin-bottom: 20px; + display: flex; + flex-direction: column; + gap: 8px; +} - /* --- ОСНОВНОЙ КОНТЕНТ --- */ - .main-content { - width: 100%; - max-width: 700px; /* Немного расширили для двух карточек */ - padding: 40px 20px; - box-sizing: border-box; - } +label { + color: #a0a0a0; + font-size: 14px; + font-weight: 500; +} - /* Ссылка назад к списку */ - .back-link { - display: inline-flex; - align-items: center; - gap: 8px; - color: #a0a0a0; - text-decoration: none; - font-size: 14px; - margin-bottom: 20px; - transition: color 0.2s ease; - } - .back-link:hover { - color: #ff6600; - } +/* Поля ввода */ +input[type="text"], +input[type="password"] { + width: 100%; + box-sizing: border-box; + background-color: #121212; + border: 1px solid #333333; + color: #ffffff; + padding: 12px 16px; + border-radius: 4px; + font-size: 15px; + outline: none; + transition: all 0.3s ease; +} - h1 { - color: #ff6600; - margin: 0 0 30px 0; - text-transform: uppercase; - letter-spacing: 2px; - border-bottom: 2px solid #ff6600; - padding-bottom: 10px; - } +input[type="text"]:focus, +input[type="password"]:focus { + border-color: #ff6600; + box-shadow: 0 0 8px rgba(255, 102, 0, 0.2); +} - /* Сетка для блоков настроек */ - .settings-grid { - display: flex; - flex-direction: column; - gap: 30px; - } +.checkbox-group input[type="checkbox"] { + position: absolute; + opacity: 0; + cursor: pointer; + height: 0; + width: 0; +} - /* --- СТИЛИ КАРТОЧКИ --- */ - .settings-card { - background-color: #1a1a1a; /* Темный фон карточки */ - border-radius: 8px; - padding: 30px; - box-shadow: 0 4px 15px rgba(255, 102, 0, 0.05); - border: 1px solid #2a2a2a; - } +.checkmark { + height: 20px; + width: 20px; + background-color: #121212; + border: 1px solid #333333; + border-radius: 4px; + display: inline-block; + position: relative; + transition: all 0.2s ease; +} - .card-title { - font-size: 18px; - font-weight: 600; - margin-bottom: 25px; - color: #ffffff; - display: flex; - align-items: center; - gap: 10px; - } +.checkbox-group:hover input[type="checkbox"] ~ .checkmark { + border-color: #ff6600; +} - .form-group { - margin-bottom: 20px; - display: flex; - flex-direction: column; - gap: 8px; - } +.checkbox-group input[type="checkbox"]:checked ~ .checkmark { + background-color: #ff6600; + border-color: #ff6600; +} - label { - color: #a0a0a0; - font-size: 14px; - font-weight: 500; - } +.checkmark:after { + content: ""; + position: absolute; + display: none; + left: 6px; + top: 2px; + width: 5px; + height: 10px; + border: solid #000000; + border-width: 0 2px 2px 0; + transform: rotate(45deg); +} - /* Поля ввода (универсальный стиль) */ - input[type="text"], - input[type="password"] { - width: 100%; - box-sizing: border-box; - background-color: #121212; - border: 1px solid #333333; - color: #ffffff; - padding: 12px 16px; - border-radius: 4px; - font-size: 15px; - outline: none; - transition: all 0.3s ease; - } +.checkbox-group input[type="checkbox"]:checked ~ .checkmark:after { + display: block; +} - /* Состояние фокуса */ - input[type="text"]:focus, - input[type="password"]:focus { - border-color: #ff6600; - box-shadow: 0 0 8px rgba(255, 102, 0, 0.2); - } +.checkbox-label { + color: #e0e0e0; + font-size: 14px; + font-weight: 600; + letter-spacing: 0.5px; +} - /* --- СТИЛИ ДЛЯ ЧЕКБОКСА (CHECKBUTTON) --- */ - .checkbox-group { - flex-direction: row; - align-items: center; - gap: 12px; - cursor: pointer; - user-select: none; - margin-bottom: 25px; - } +/* Кнопка отправки формы */ +.submit-btn { + background-color: #ff6600; + color: #000000; + border: none; + padding: 14px; + border-radius: 4px; + font-size: 16px; + font-weight: bold; + cursor: pointer; + width: 100%; + margin-top: 10px; + transition: all 0.3s ease; + text-transform: uppercase; + letter-spacing: 1px; +} - /* Скрываем дефолтный чекбокс, чтобы сделать красивый кастомный */ - .checkbox-group input[type="checkbox"] { - position: absolute; - opacity: 0; - cursor: pointer; - height: 0; - width: 0; - } +.submit-btn:hover { + background-color: #ff8533; + box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3); +} - /* Наш кастомный чекбокс */ - .checkmark { - height: 20px; - width: 20px; - background-color: #121212; - border: 1px solid #333333; - border-radius: 4px; - display: inline-block; - position: relative; - transition: all 0.2s ease; - } +/* Адаптивность для карточек и инпутов */ +@media (max-width: 768px) { + .settings-card { + padding: 20px 16px; + } - /* Эффект при наведении */ - .checkbox-group:hover input[type="checkbox"] ~ .checkmark { - border-color: #ff6600; - } + .form-group { + margin-bottom: 16px; + } - /* Когда чекбокс активен (выбран) */ - .checkbox-group input[type="checkbox"]:checked ~ .checkmark { - background-color: #ff6600; - border-color: #ff6600; - } + .checkbox-group { + margin-bottom: 20px; + } - /* Стрелочка внутри чекбокса */ - .checkmark:after { - content: ""; - position: absolute; - display: none; - left: 6px; - top: 2px; - width: 5px; - height: 10px; - border: solid #000000; - border-width: 0 2px 2px 0; - transform: rotate(45deg); - } - - /* Показываем стрелочку при выборе */ - .checkbox-group input[type="checkbox"]:checked ~ .checkmark:after { - display: block; - } - - .checkbox-label { - color: #e0e0e0; - font-size: 14px; - font-weight: 600; - letter-spacing: 0.5px; - } - - /* Кнопка отправки формы */ - .submit-btn { - background-color: #ff6600; - color: #000000; - border: none; - padding: 14px; - border-radius: 4px; - font-size: 16px; - font-weight: bold; - cursor: pointer; - width: 100%; - margin-top: 10px; - transition: all 0.3s ease; - text-transform: uppercase; - letter-spacing: 1px; - } - - .submit-btn:hover { - background-color: #ff8533; - box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3); - } - - @media (max-width: 768px) { - .top-bar-container { - height: auto; - padding: 12px 16px; - flex-direction: column; - align-items: flex-start; - gap: 12px; - } - - .nav-links { - width: 100%; - justify-content: space-between; - flex-wrap: wrap; - gap: 10px; - } - - .main-content { - padding: 24px 14px; - } - - h1 { - font-size: 24px; - letter-spacing: 1px; - } - - .settings-card { - padding: 20px 16px; - } - - .form-group { - margin-bottom: 16px; - } - - .checkbox-group { - margin-bottom: 20px; - } - - .submit-btn { - padding: 12px 10px; - font-size: 14px; - } - } + .submit-btn { + padding: 12px 10px; + font-size: 14px; + } +} diff --git a/data/settings.html b/data/settings.html index d5d8cc0..37c1418 100644 --- a/data/settings.html +++ b/data/settings.html @@ -4,7 +4,8 @@ Панель управления — Настройки сети - + + diff --git a/data/settings.js b/data/settings.js index c966386..3fd0c7e 100644 --- a/data/settings.js +++ b/data/settings.js @@ -72,7 +72,7 @@ async function set_conn_out() async function init() { try { - const res = await fetch("h/settings/is_conn_out", { + const res = await fetch("/settings/is_conn_out", { method: "GET" }); diff --git a/src/WebServer.cpp b/src/WebServer.cpp index d6b1698..c0692c7 100644 --- a/src/WebServer.cpp +++ b/src/WebServer.cpp @@ -9,6 +9,24 @@ extern "C" { #include "user_interface.h" } +void WebServer::css_base() +{ + if (web_server.authenticate(settings_.getAdminLogin().c_str(), settings_.getAdminPass().c_str()) == false) + { + web_server.requestAuthentication(); + return; + } + + File css = LittleFS.open("/base.css", "r"); + if (!css) + { + web_server.send(404); + return; + } + web_server.streamFile(css, "text/css"); + css.close(); +} + void WebServer::root_call() { if (web_server.authenticate(settings_.getAdminLogin().c_str(), settings_.getAdminPass().c_str()) == false) @@ -302,6 +320,9 @@ settings_(settings) web_server.on("/", [this](){ root_call(); }); + web_server.on("/base.css", [this](){ + css_base(); + }); web_server.on("/root.js", [this](){ js_root_call(); }); diff --git a/src/WebServer.h b/src/WebServer.h index 1fd943f..734bfd5 100644 --- a/src/WebServer.h +++ b/src/WebServer.h @@ -8,6 +8,8 @@ class WebServer ESP8266WebServer web_server; Settings& settings_; + void css_base(); + void root_call(); void js_root_call(); void css_root_call();
IP