Spaces:
Sleeping
Sleeping
File size: 7,651 Bytes
1e9310c 711291e 7a7b2a6 a39a88c 07b8412 b2bcd84 07b8412 b2bcd84 07b8412 b2bcd84 07b8412 b2bcd84 07b8412 e0f4703 a06d07d 07b8412 a06d07d 07b8412 d78ab40 07b8412 711291e 1e9310c 85a1ea9 711291e d174ede a06d07d 112c1c4 fc41627 6e54dc6 5700184 48b32f7 d60d099 f1f755c 202283d 727b107 2169a71 6d9d831 727b107 dd777e8 202283d b611780 5eda139 202283d 9db62d9 8851b07 f931191 8851b07 bd86e1e 202283d e426864 a06d07d 711291e 7a7b2a6 711291e 90c7bc4 681ef76 fe2f3fd 51068df 711291e 6e54dc6 8902381 727b107 2169a71 727b107 9db62d9 f931191 bd86e1e e426864 711291e fe2f3fd a34bd5e 711291e fe2f3fd a06d07d 7a7b2a6 38c0284 7a7b2a6 a06d07d 151a839 711291e 1e9310c b654efd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Settings</title>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
margin: 0;
padding: 0;
}
h1 {
background-color: #4CAF50;
color: white;
padding: 20px;
margin: 0;
border-bottom: 2px solid #388E3C;
text-align: left;
}
form {
padding: 20px;
}
label {
display: block;
margin-top: 10px;
color: #4CAF50;
text-align: left;
}
input[type="text"] {
width: 100%;
padding: 10px;
margin-top: 5px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
margin-top: 20px;
}
button.save {
background-color: #4CAF50;
color: white;
}
button.refresh {
background-color: #FFA500;
color: white;
margin-left: 10px;
}
button:hover {
opacity: 0.8;
}
.orange-text {
color: #FFA500;
}
</style>
</head>
<body>
<form id="settingsForm">
<label for="api_key_sys"><span class="orange-text">api_key_sys (Выдаётся администрацией сервиса):</span></label>
<input type="text" id="api_key_sys" name="api_key_sys" onblur="saveApiKeySys()"><br><br>
<label for="api_key_auth">api_key_auth (Ключ проверки подлинности запросов):</label>
<input type="text" id="api_key_auth" name="api_key_auth"><br><br>
<label for="api_key_apps_vk">apps_key (Объект, где ключ — это id приложения vk-mini-apps, а значение — защищённый ключ приложения vk-mini-apps.):</label>
<input type="text" id="api_key_apps_vk" name="api_key_apps_vk"><br><br>
<label for="vk_api_key">vk_api_key (Ключ ВК сообщества):</label>
<input type="text" id="vk_api_key" name="vk_api_key"><br><br>
<label for="vk_st_alone">vk_st_alone (Ключ ВК vk_st_alone):</label>
<input type="text" id="vk_st_alone" name="vk_st_alone"><br><br>
<label for="key_callback_vk">key_callback_vk (Ключ ВК key_callback_vk):</label>
<input type="text" id="key_callback_vk" name="key_callback_vk"><br><br>
<label for="senler_token">senler_token (Ключ проверки подлинности запросов к API Сенлер):</label>
<input type="text" id="senler_token" name="senler_token"><br><br>
<label for="wa_ak">wa_ak (id инстанса WhatsApp):</label>
<input type="text" id="wa_ak" name="wa_ak"><br><br>
<label for="wa_api_key">wa_api_key (Ключ проверки подлинности запросов к API WhatsApp):</label>
<input type="text" id="wa_api_key" name="wa_api_key"><br><br>
<label for="curators">curators (Список email кураторов):</label>
<input type="text" id="curators" name="curators"><br><br>
<label for="call_api_key">call_api_key (Ключ проверки подлинности запросов к API Звонобот):</label>
<input type="text" id="call_api_key" name="call_api_key"><br><br>
<button type="button" class="save" onclick="saveSettings()">Сохранить данные</button>
<button type="button" class="refresh" onclick="refreshSettings()">Обновить данные</button>
</form>
<script src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
<script>
function loadSettings() {
// Загружаем ключ из локального хранилища
const apiKeySys = localStorage.getItem('api_key_sys');
if (apiKeySys) {
document.getElementById('api_key_sys').value = apiKeySys;
}
fetch('/load_settings', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ action: 'load', api_key_sys: apiKeySys })
})
.then(response => response.json())
.then(data => {
document.getElementById('api_key_auth').value = data.api_key_auth;
document.getElementById('api_key_apps_vk').value = data.api_key_apps_vk;
document.getElementById('vk_api_key').value = data.vk_api_key;
document.getElementById('vk_st_alone').value = data.vk_st_alone;
document.getElementById('key_callback_vk').value = data.key_callback_vk;
document.getElementById('senler_token').value = data.senler_token;
document.getElementById('wa_ak').value = data.wa_ak;
document.getElementById('wa_api_key').value = data.wa_api_key;
document.getElementById('curators').value = data.curators;
document.getElementById('call_api_key').value = data.call_api_key;
})
.catch(error => console.error('Error:', error));
}
function saveSettings() {
const form = document.getElementById('settingsForm');
const formData = new FormData(form);
const data = {};
formData.forEach((value, key) => {
if (value !== '') {
data[key] = value;
}
});
fetch('/save_settings', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ action: 'save', data: data, api_key_sys: data.api_key_sys })
})
.then(response => response.json())
.then(data => {
console.log('Success:', data);
Toastify({
text: "Данные сохранены",
duration: 3000,
gravity: "top",
position: "right",
backgroundColor: "#4CAF50",
}).showToast();
})
.catch(error => {
console.error('Error:', error);
Toastify({
text: "Ошибка при сохранении данных",
duration: 3000,
gravity: "top",
position: "right",
backgroundColor: "#FF0000",
}).showToast();
});
}
function refreshSettings() {
loadSettings();
Toastify({
text: "Данные обновлены",
duration: 3000,
gravity: "top",
position: "right",
backgroundColor: "#FFA500",
}).showToast();
}
function saveApiKeySys() {
const apiKeySys = document.getElementById('api_key_sys').value;
localStorage.setItem('api_key_sys', apiKeySys);
}
window.onload = loadSettings;
</script>
</body>
</html> |