Kgshop commited on
Commit
3271f75
·
verified ·
1 Parent(s): 4f89fbf

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +148 -25
index.html CHANGED
@@ -3,7 +3,7 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Anvico - приложение </title>
7
  <link rel="manifest" href="/manifest.json">
8
  <link rel="stylesheet" href="style.css">
9
  <link rel="apple-touch-icon" href="/icon.png">
@@ -13,36 +13,161 @@
13
  <link rel="icon" href="icon.png" type="image/png">
14
  <meta name="google-site-verification" content="V6EqDTA9Oj9V1OfNbnBHj5RKrdcXlABD8tqfEFVUHJY" />
15
  <meta name="description" content=" ">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  </head>
17
  <body>
18
- <iframe
19
- src="https://metastore-full.hf.space/219382/catalog"
20
- frameborder="0"
21
- allowfullscreen
22
- allow="cross-origin-isolated; cookies"></iframe>
23
-
24
- <button id="installButton">Установить приложение</button>
25
- <button id="iosInstallPrompt">Установить приложение</button>
26
-
27
- <div id="iosInstallModal">
28
- <div class="modal-content">
29
- <h2>Установите приложение Anvico</h2>
30
- <a href="#" id="openZoomModal">
31
- <img src="https://huggingface.co/spaces/Morshen/alpha/resolve/main/pwa_ios.png" alt="Инструкция по установке PWA на iOS">
32
- </a>
33
- <p>1. Нажмите кнопку "Поделиться" внизу Safari.</p>
34
- <p>2. Выберите "На экран «Домой»".</p>
35
- <p>3. Подтвердите установку.</p>
36
- <button id="closeIosModal">Закрыть</button>
37
  </div>
38
  </div>
39
 
40
- <div id="imageZoomModal">
41
- <span id="closeZoomModal">×</span>
42
- <img id="zoomedImage" src="" alt="Увеличенное изображение">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  </div>
44
 
45
  <script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  let deferredPrompt;
47
  const installButton = document.getElementById('installButton');
48
  const iosInstallPrompt = document.getElementById('iosInstallPrompt');
@@ -130,8 +255,6 @@
130
  });
131
  }
132
 
133
- // Отладка сообщений от iframe -- УДАЛЕНО, так как не решает проблему авторизации и не несет полезной нагрузки в данном контексте. Для отладки лучше использовать инструменты разработчика в браузере.
134
-
135
  // Перехват ошибок
136
  window.addEventListener('error', (event) => {
137
  console.error('Произошла ошибка:', event.message, event.filename, event.lineno);
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Anvico - приложение</title>
7
  <link rel="manifest" href="/manifest.json">
8
  <link rel="stylesheet" href="style.css">
9
  <link rel="apple-touch-icon" href="/icon.png">
 
13
  <link rel="icon" href="icon.png" type="image/png">
14
  <meta name="google-site-verification" content="V6EqDTA9Oj9V1OfNbnBHj5RKrdcXlABD8tqfEFVUHJY" />
15
  <meta name="description" content=" ">
16
+ <style>
17
+ /* Базовые стили для экрана пароля, чтобы он выглядел аккуратно */
18
+ #passwordScreen {
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: center;
22
+ justify-content: center;
23
+ height: 100vh;
24
+ width: 100%;
25
+ background-color: #f4f4f9;
26
+ font-family: Arial, sans-serif;
27
+ position: fixed;
28
+ top: 0;
29
+ left: 0;
30
+ z-index: 9999;
31
+ }
32
+ .password-container {
33
+ background: white;
34
+ padding: 30px;
35
+ border-radius: 12px;
36
+ box-shadow: 0 4px 15px rgba(0,0,0,0.1);
37
+ text-align: center;
38
+ max-width: 90%;
39
+ width: 320px;
40
+ }
41
+ .password-container h2 {
42
+ margin-top: 0;
43
+ color: #333;
44
+ }
45
+ .password-container input {
46
+ width: 100%;
47
+ padding: 12px;
48
+ margin: 15px 0;
49
+ border: 1px solid #ccc;
50
+ border-radius: 8px;
51
+ box-sizing: border-box;
52
+ font-size: 16px;
53
+ }
54
+ .password-container button {
55
+ width: 100%;
56
+ padding: 12px;
57
+ background-color: #007bff;
58
+ color: white;
59
+ border: none;
60
+ border-radius: 8px;
61
+ font-size: 16px;
62
+ cursor: pointer;
63
+ transition: background-color 0.3s;
64
+ }
65
+ .password-container button:hover {
66
+ background-color: #0056b3;
67
+ }
68
+ #errorMessage {
69
+ color: red;
70
+ font-size: 14px;
71
+ display: none;
72
+ margin-top: 10px;
73
+ }
74
+ /* Скрываем основной контент до ввода пароля */
75
+ #mainContent {
76
+ display: none;
77
+ height: 100vh;
78
+ width: 100%;
79
+ }
80
+ </style>
81
  </head>
82
  <body>
83
+
84
+ <!-- ЭКРАН ВВОДА ПАРОЛЯ -->
85
+ <div id="passwordScreen">
86
+ <div class="password-container">
87
+ <h2>Доступ закрыт</h2>
88
+ <p style="color: #666; font-size: 14px;">Введите пароль для входа в приложение</p>
89
+ <input type="password" id="passwordInput" placeholder="Введите пароль">
90
+ <button id="loginButton">Войти</button>
91
+ <div id="errorMessage">Неверный пароль. Попробуйте еще раз.</div>
 
 
 
 
 
 
 
 
 
 
92
  </div>
93
  </div>
94
 
95
+ <!-- ОСНОВНОЕ СОДЕРЖИМОЕ ПРИЛОЖЕНИЯ -->
96
+ <div id="mainContent">
97
+ <!-- Атрибут src заменен на data-src, чтобы страница не загружалась в фоне до ввода пароля -->
98
+ <iframe
99
+ id="appIframe"
100
+ data-src="https://metastore-full.hf.space/219382/catalog"
101
+ frameborder="0"
102
+ allowfullscreen
103
+ allow="cross-origin-isolated; cookies"
104
+ style="width: 100%; height: 100%; border: none;"></iframe>
105
+
106
+ <button id="installButton">Установить приложение</button>
107
+ <button id="iosInstallPrompt">Установить приложение</button>
108
+
109
+ <div id="iosInstallModal">
110
+ <div class="modal-content">
111
+ <h2>Установите приложение Anvico</h2>
112
+ <a href="#" id="openZoomModal">
113
+ <img src="https://huggingface.co/spaces/Morshen/alpha/resolve/main/pwa_ios.png" alt="Инструкция по установке PWA на iOS">
114
+ </a>
115
+ <p>1. Нажмите кнопку "Поделиться" внизу Safari.</p>
116
+ <p>2. Выберите "На экран «Домой»".</p>
117
+ <p>3. Подтвердите установку.</p>
118
+ <button id="closeIosModal">Закрыть</button>
119
+ </div>
120
+ </div>
121
+
122
+ <div id="imageZoomModal">
123
+ <span id="closeZoomModal">×</span>
124
+ <img id="zoomedImage" src="" alt="Увеличенное изображение">
125
+ </div>
126
  </div>
127
 
128
  <script>
129
+ // === ЛОГИКА АВТОРИЗАЦИИ ===
130
+ const passwordScreen = document.getElementById('passwordScreen');
131
+ const mainContent = document.getElementById('mainContent');
132
+ const passwordInput = document.getElementById('passwordInput');
133
+ const loginButton = document.getElementById('loginButton');
134
+ const errorMessage = document.getElementById('errorMessage');
135
+ const appIframe = document.getElementById('appIframe');
136
+
137
+ // Функция для разблокировки приложения
138
+ function unlockApp() {
139
+ passwordScreen.style.display = 'none';
140
+ mainContent.style.display = 'block';
141
+ // Загружаем iframe только после успешного входа
142
+ if (!appIframe.src) {
143
+ appIframe.src = appIframe.getAttribute('data-src');
144
+ }
145
+ }
146
+
147
+ // Проверяем, сохранен ли пароль на этом устройстве
148
+ if (localStorage.getItem('isAnvicoAuthenticated') === 'true') {
149
+ unlockApp();
150
+ }
151
+
152
+ // Обработчик кнопки "Войти"
153
+ loginButton.addEventListener('click', () => {
154
+ if (passwordInput.value === '99988808') {
155
+ localStorage.setItem('isAnvicoAuthenticated', 'true');
156
+ unlockApp();
157
+ } else {
158
+ errorMessage.style.display = 'block';
159
+ }
160
+ });
161
+
162
+ // Вход по нажатию Enter на клавиатуре
163
+ passwordInput.addEventListener('keypress', (event) => {
164
+ if (event.key === 'Enter') {
165
+ loginButton.click();
166
+ }
167
+ });
168
+
169
+
170
+ // === ОРИГИНАЛЬНАЯ ЛОГИКА PWA ===
171
  let deferredPrompt;
172
  const installButton = document.getElementById('installButton');
173
  const iosInstallPrompt = document.getElementById('iosInstallPrompt');
 
255
  });
256
  }
257
 
 
 
258
  // Перехват ошибок
259
  window.addEventListener('error', (event) => {
260
  console.error('Произошла ошибка:', event.message, event.filename, event.lineno);