DmitrMakeev commited on
Commit
c894def
·
verified ·
1 Parent(s): ce176ce

Update settings.html

Browse files
Files changed (1) hide show
  1. settings.html +63 -0
settings.html CHANGED
@@ -18,12 +18,75 @@ input[type="number"]::-webkit-outer-spin-button {
18
  input[type="number"] {
19
  -moz-appearance: textfield;
20
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  </style>
23
 
24
 
25
  </head>
26
  <body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
 
29
  <nav class="navbar navbar-light bg-light">
 
18
  input[type="number"] {
19
  -moz-appearance: textfield;
20
  }
21
+ #protection-overlay {
22
+ position: fixed;
23
+ top: 0;
24
+ left: 0;
25
+ width: 100%;
26
+ height: 100%;
27
+ background: rgba(0, 0, 0, 0.5); /* Полупрозрачный чёрный */
28
+ z-index: 5; /* На передний план */
29
+ display: block; /* Включено по умолчанию */
30
+ pointer-events: auto; /* Блокирует клики */
31
+ }
32
+ /* Поднимаем SweetAlert2 выше */
33
+ .swal2-container {
34
+ z-index: 10 !important;
35
+ }
36
 
37
  </style>
38
 
39
 
40
  </head>
41
  <body>
42
+ <div id="protection-overlay"></div> <!-- Полупрозрачный фон -->
43
+ <script>
44
+ document.addEventListener("DOMContentLoaded", function () {
45
+ const overlay = document.getElementById("protection-overlay");
46
+ let pageKey = localStorage.getItem("page_key");
47
+ // Функция проверки ключа
48
+ function checkApiKey(apiKey) {
49
+ fetch(`/page_key?api_sys=${apiKey}`)
50
+ .then(response => response.json())
51
+ .then(data => {
52
+ if (data.status === "ok") {
53
+ overlay.style.display = "none"; // ✅ Убираем защиту
54
+ } else {
55
+ requestNewKey("Неверный код. Введите заново!");
56
+ }
57
+ })
58
+ .catch(() => requestNewKey("Ошибка сервера. Попробуйте снова."));
59
+ }
60
+ // Функция запроса нового ключа
61
+ function requestNewKey(message = "Введите код доступа:") {
62
+ Swal.fire({
63
+ title: "Внимание!",
64
+ text: message,
65
+ input: "text",
66
+ inputAttributes: { autocapitalize: "off" },
67
+ showCancelButton: false,
68
+ confirmButtonText: "Отправить",
69
+ confirmButtonColor: "#3085d6",
70
+ allowOutsideClick: false
71
+ }).then((result) => {
72
+ if (result.isConfirmed && result.value) {
73
+ localStorage.setItem("page_key", result.value); // 🔥 Сохраняем ключ
74
+ checkApiKey(result.value); // 🔥 Проверяем ключ
75
+ } else {
76
+ requestNewKey("Введите корректный код!"); // Повторяем ввод
77
+ }
78
+ });
79
+ }
80
+ // Если ключ есть → Проверяем его, иначе запрашиваем новый
81
+ if (pageKey) {
82
+ checkApiKey(pageKey);
83
+ } else {
84
+ requestNewKey();
85
+ }
86
+ });
87
+ </script>
88
+
89
+
90
 
91
 
92
  <nav class="navbar navbar-light bg-light">