Init public repo
This commit is contained in:
+188
@@ -0,0 +1,188 @@
|
||||
/* Общие стили для страницы */
|
||||
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;
|
||||
}
|
||||
|
||||
/* --- 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;
|
||||
}
|
||||
|
||||
.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 {
|
||||
color: #ff6600;
|
||||
}
|
||||
|
||||
/* Кнопка настроек */
|
||||
.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);
|
||||
}
|
||||
|
||||
/* --- ОСНОВНОЙ КОНТЕНТ --- */
|
||||
.main-content {
|
||||
width: 100%;
|
||||
max-width: 940px;
|
||||
padding: 40px 20px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #ff6600;
|
||||
margin-bottom: 30px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
border-bottom: 2px solid #ff6600;
|
||||
padding-bottom: 10px;
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
/* Контейнер для адаптивности таблицы */
|
||||
.table-container {
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
box-shadow: 0 4px 15px rgba(255, 102, 0, 0.15);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
/* Стили таблицы */
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
background-color: #1a1a1a;
|
||||
text-align: left;
|
||||
min-width: 600px;
|
||||
}
|
||||
|
||||
/* Шапка таблицы */
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Панель управления — Список пользователей</title>
|
||||
|
||||
<link rel="stylesheet" href="/root.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="top-bar">
|
||||
<div class="top-bar-container">
|
||||
<a href="#" class="logo">Admin<span>Panel</span></a>
|
||||
|
||||
<nav class="nav-links">
|
||||
<a href="#" class="nav-link">Главная</a>
|
||||
<a href="#" class="nav-link">Пользователи</a>
|
||||
<!-- Кнопка перехода в настройки -->
|
||||
<a href="settings" class="settings-btn">
|
||||
<!-- Иконка шестерёнки на чистом CSS -->
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle;">
|
||||
<circle cx="12" cy="12" r="3"></circle>
|
||||
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"></path>
|
||||
</svg>
|
||||
Настройки
|
||||
</a>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="main-content">
|
||||
<h1>Список пользователей</h1>
|
||||
|
||||
<div class="table-container">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>IP</th>
|
||||
<th>MAC</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="user-list">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
</body>
|
||||
<script src="/root.js"></script>
|
||||
</html>
|
||||
@@ -0,0 +1,39 @@
|
||||
function add_user(ip, mac)
|
||||
{
|
||||
const tabel = document.querySelector("#user-list");
|
||||
|
||||
const tr = document.createElement('tr');
|
||||
|
||||
const rdIP = document.createElement('td');
|
||||
rdIP.textContent = ip;
|
||||
|
||||
const rdMAC = document.createElement('td');
|
||||
rdMAC.textContent = mac;
|
||||
|
||||
tr.appendChild(rdIP);
|
||||
tr.appendChild(rdMAC);
|
||||
|
||||
tabel.appendChild(tr);
|
||||
}
|
||||
|
||||
async function update_user_list()
|
||||
{
|
||||
const res = await fetch("http://192.168.4.1/user_list", {
|
||||
method: "GET"
|
||||
});
|
||||
|
||||
if (res.ok)
|
||||
{
|
||||
const body = await res.json();
|
||||
|
||||
const tabel = document.querySelector("#user-list");
|
||||
tabel.textContent = '';
|
||||
|
||||
for (let i = 0; i < body.user_ip.length; i++) {
|
||||
add_user(body.user_ip[i], body.user_mac[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update_user_list();
|
||||
setInterval(update_user_list, 10000);
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
Mirror
|
||||
*$sd!Df^67_sS52d
|
||||
admin
|
||||
admin
|
||||
1000
|
||||
20
|
||||
192.168.4.1
|
||||
192.168.4.1
|
||||
255.255.255.0
|
||||
false
|
||||
@@ -0,0 +1,291 @@
|
||||
/* Общие стили для страницы */
|
||||
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;
|
||||
}
|
||||
|
||||
/* --- 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;
|
||||
}
|
||||
|
||||
.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 {
|
||||
color: #ff6600;
|
||||
}
|
||||
|
||||
.nav-link.active {
|
||||
color: #ff6600;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* --- ОСНОВНОЙ КОНТЕНТ --- */
|
||||
.main-content {
|
||||
width: 100%;
|
||||
max-width: 700px; /* Немного расширили для двух карточек */
|
||||
padding: 40px 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Ссылка назад к списку */
|
||||
.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;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #ff6600;
|
||||
margin: 0 0 30px 0;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
border-bottom: 2px solid #ff6600;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
/* Сетка для блоков настроек */
|
||||
.settings-grid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 30px;
|
||||
}
|
||||
|
||||
/* --- СТИЛИ КАРТОЧКИ --- */
|
||||
.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;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 25px;
|
||||
color: #ffffff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
label {
|
||||
color: #a0a0a0;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Поля ввода (универсальный стиль) */
|
||||
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;
|
||||
}
|
||||
|
||||
/* Состояние фокуса */
|
||||
input[type="text"]:focus,
|
||||
input[type="password"]:focus {
|
||||
border-color: #ff6600;
|
||||
box-shadow: 0 0 8px rgba(255, 102, 0, 0.2);
|
||||
}
|
||||
|
||||
/* --- СТИЛИ ДЛЯ ЧЕКБОКСА (CHECKBUTTON) --- */
|
||||
.checkbox-group {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
/* Скрываем дефолтный чекбокс, чтобы сделать красивый кастомный */
|
||||
.checkbox-group input[type="checkbox"] {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
height: 0;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
/* Наш кастомный чекбокс */
|
||||
.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;
|
||||
}
|
||||
|
||||
/* Эффект при наведении */
|
||||
.checkbox-group:hover input[type="checkbox"] ~ .checkmark {
|
||||
border-color: #ff6600;
|
||||
}
|
||||
|
||||
/* Когда чекбокс активен (выбран) */
|
||||
.checkbox-group input[type="checkbox"]:checked ~ .checkmark {
|
||||
background-color: #ff6600;
|
||||
border-color: #ff6600;
|
||||
}
|
||||
|
||||
/* Стрелочка внутри чекбокса */
|
||||
.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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Панель управления — Настройки сети</title>
|
||||
|
||||
<link rel="stylesheet" href="/settings.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- ВЕРХНЯЯ ПАНЕЛЬ (TOP BAR) -->
|
||||
<header class="top-bar">
|
||||
<div class="top-bar-container">
|
||||
<a href="#" class="logo">Admin<span>Panel</span></a>
|
||||
|
||||
<nav class="nav-links">
|
||||
<a href="/" class="nav-link">Главная</a>
|
||||
<a href="/" class="nav-link">Пользователи</a>
|
||||
<a href="#" class="nav-link active">Настройки</a>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="main-content">
|
||||
|
||||
<a href="/" class="back-link">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<line x1="19" y1="12" x2="5" y2="12"></line>
|
||||
<polyline points="12 19 5 12 12 5"></polyline>
|
||||
</svg>
|
||||
Назад к списку пользователей
|
||||
</a>
|
||||
|
||||
<h1>Настройки</h1>
|
||||
|
||||
<div class="settings-grid">
|
||||
|
||||
<!-- БЛОК 1: НАСТРОЙКИ СЕТИ (WI-FI) -->
|
||||
<div class="settings-card">
|
||||
<div class="card-title">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#ff6600" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M5 12.55a11 11 0 0 1 14.08 0"></path>
|
||||
<path d="M1.42 9a16 16 0 0 1 21.16 0"></path>
|
||||
<path d="M8.53 16.11a6 6 0 0 1 6.94 0"></path>
|
||||
<line x1="12" y1="20" x2="12.01" y2="20" stroke-width="3"></line>
|
||||
</svg>
|
||||
Параметры Wi-Fi сети
|
||||
</div>
|
||||
|
||||
<form action="#" method="POST">
|
||||
<!-- Имя сети (SSID) -->
|
||||
<div class="form-group">
|
||||
<label for="ap-ssid">Имя сети (SSID)</label>
|
||||
<input type="text" id="ap-ssid" name="ap_ssid" required placeholder="Например: Home_Network">
|
||||
</div>
|
||||
|
||||
<!-- Пароль сети -->
|
||||
<div class="form-group">
|
||||
<label for="ap-password">Пароль от Wi-Fi</label>
|
||||
<input type="password" id="ap-password" name="ap_password" required placeholder="Минимум 8 символов">
|
||||
</div>
|
||||
|
||||
<button id="ap_update" type="button" class="submit-btn">Обновить настройки сети</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="settings-card">
|
||||
<div class="card-title">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#ff6600" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M5 12.55a11 11 0 0 1 14.08 0"></path>
|
||||
<path d="M1.42 9a16 16 0 0 1 21.16 0"></path>
|
||||
<path d="M8.53 16.11a6 6 0 0 1 6.94 0"></path>
|
||||
<line x1="12" y1="20" x2="12.01" y2="20" stroke-width="3"></line>
|
||||
</svg>
|
||||
Основная сеть
|
||||
</div>
|
||||
|
||||
<form action="#" method="POST">
|
||||
<!-- Имя сети (SSID) -->
|
||||
<div class="form-group">
|
||||
<label for="sta-ssid">Имя сети (SSID)</label>
|
||||
<input type="text" id="sta-ssid" name="sta_ssid" required placeholder="Например: Home_Network">
|
||||
</div>
|
||||
|
||||
<!-- Пароль сети -->
|
||||
<div class="form-group">
|
||||
<label for="sta-password">Пароль от сети</label>
|
||||
<input type="password" id="sta-password" name="sta_password" required placeholder="Минимум 8 символов">
|
||||
</div>
|
||||
|
||||
<button id="sta_update" type="button" class="submit-btn">Обновить настройки сети</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- КАСТОМНЫЙ CHECKBUTTON: CONNECTION_OUT -->
|
||||
<label class="form-group checkbox-group">
|
||||
<input type="checkbox" id="connection-out" name="connection_out">
|
||||
<span class="checkmark"></span>
|
||||
<span class="checkbox-label">Подключение к внешней сети</span>
|
||||
</label>
|
||||
|
||||
<!-- БЛОК 2: БЕЗОПАСНОСТЬ (АДМИН) -->
|
||||
<div class="settings-card">
|
||||
<div class="card-title">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#ff6600" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect>
|
||||
<path d="M7 11V7a5 5 0 0 1 10 0v4"></path>
|
||||
</svg>
|
||||
Безопасность (Смена пароля администратора)
|
||||
</div>
|
||||
|
||||
<form action="#" method="POST">
|
||||
<div class="form-group">
|
||||
<label for="new-password">Новый пароль</label>
|
||||
<input type="password" id="new-password" name="new_password" required placeholder="Минимум 8 знаков">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="confirm-password">Подтвердите новый пароль</label>
|
||||
<input type="password" id="confirm-password" name="confirm_password" required placeholder="••••••••">
|
||||
</div>
|
||||
|
||||
<button id="admin_update" type="button" class="submit-btn">Сохранить изменения</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
</body>
|
||||
<script src="settings.js"></script>
|
||||
</html>
|
||||
@@ -0,0 +1,106 @@
|
||||
async function ap_update()
|
||||
{
|
||||
const ssid = document.querySelector('#ap-ssid');
|
||||
const pass = document.querySelector('#ap-password');
|
||||
|
||||
const response = await fetch("http://192.168.4.1/settings/ap_update", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=utf-8'
|
||||
},
|
||||
body: JSON.stringify({ssid: ssid.value, pass: pass.value})
|
||||
});
|
||||
|
||||
if (!response.ok)
|
||||
alert("Fail set AP settings");
|
||||
}
|
||||
async function sta_update()
|
||||
{
|
||||
const ssid = document.querySelector('#sta-ssid');
|
||||
const pass = document.querySelector('#sta-password');
|
||||
|
||||
const response = await fetch("http://192.168.4.1/settings/sta_update", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=utf-8'
|
||||
},
|
||||
body: JSON.stringify({ssid: ssid.value, pass: pass.value})
|
||||
});
|
||||
|
||||
if (!response.ok)
|
||||
alert("Fail set STA settings");
|
||||
}
|
||||
async function admin_update()
|
||||
{
|
||||
const new_pass = document.getElementById('new-password');
|
||||
const confirm_pass = document.getElementById('confirm-password');
|
||||
|
||||
if (new_pass.value !== confirm_pass.value)
|
||||
{
|
||||
alert("Пароли должны совпадать");
|
||||
return;
|
||||
}
|
||||
|
||||
const res = await fetch("http://192.168.4.1/settings/admin_update", {
|
||||
method: "POST",
|
||||
headers:{
|
||||
'Content-Type': 'application/json;charset=utf-8'
|
||||
},
|
||||
body:JSON.stringify({new_pass: new_pass.value})
|
||||
});
|
||||
|
||||
if (!res.ok)
|
||||
alert("Ошибка! Пароль не обновился");
|
||||
}
|
||||
|
||||
async function set_conn_out()
|
||||
{
|
||||
const checkbox = document.getElementById('connection-out');
|
||||
|
||||
const response = await fetch("http://192.168.4.1/settings/set_conn_out", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=utf-8'
|
||||
},
|
||||
body: JSON.stringify({is_conn_out: checkbox.checked})
|
||||
});
|
||||
|
||||
if (!response.ok)
|
||||
alert("Fail set CONN_TO_OUT settings");
|
||||
}
|
||||
|
||||
async function init()
|
||||
{
|
||||
try {
|
||||
const res = await fetch("http://192.168.4.1/settings/is_conn_out", {
|
||||
method: "GET"
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
|
||||
const conn_out = document.getElementById('connection-out');
|
||||
|
||||
conn_out.checked = data.is_conn_out;
|
||||
} else {
|
||||
console.warn("Сервер вернул ошибку:", res.status);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Ошибка при выполнении запроса:", error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
|
||||
button = document.querySelector('#ap_update');
|
||||
button.addEventListener('click', ap_update);
|
||||
|
||||
button = document.querySelector('#sta_update');
|
||||
button.addEventListener('click', sta_update);
|
||||
|
||||
button = document.querySelector('#admin_update');
|
||||
button.addEventListener('click', admin_update);
|
||||
|
||||
const checkbox = document.getElementById('connection-out');
|
||||
checkbox.addEventListener('change', set_conn_out);
|
||||
Reference in New Issue
Block a user