Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -166,35 +166,32 @@ for db in DATABASES:
|
|
166 |
|
167 |
init_settings_db()
|
168 |
DATABASE_NEW = 'data_gc.db'
|
|
|
|
|
169 |
def load_settings():
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
'vk_api_key': '',
|
181 |
-
'senler_token': '',
|
182 |
-
'wa_ak': '',
|
183 |
-
'wa_api_key': '',
|
184 |
-
'curators': '',
|
185 |
-
'call_api_key': ''
|
186 |
-
}
|
187 |
-
return {
|
188 |
-
'api_key_auth': settings[1] if settings[1] is not None else '',
|
189 |
-
'crypto_key_auth': settings[2] if settings[2] is not None else '',
|
190 |
-
'crypto_key_url': settings[3] if settings[3] is not None else '',
|
191 |
-
'vk_api_key': settings[4] if settings[4] is not None else '',
|
192 |
-
'senler_token': settings[5] if settings[5] is not None else '',
|
193 |
-
'wa_ak': settings[6] if settings[6] is not None else '',
|
194 |
-
'wa_api_key': settings[7] if settings[7] is not None else '',
|
195 |
-
'curators': settings[8] if settings[8] is not None else '',
|
196 |
-
'call_api_key': settings[9] if settings[9] is not None else ''
|
197 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
def save_settings(settings_dict):
|
199 |
# Удаляем api_key_sys из словаря перед сохранением
|
200 |
if 'api_key_sys' in settings_dict:
|
|
|
166 |
|
167 |
init_settings_db()
|
168 |
DATABASE_NEW = 'data_gc.db'
|
169 |
+
|
170 |
+
|
171 |
def load_settings():
|
172 |
+
default_settings = {
|
173 |
+
'api_key_auth': '',
|
174 |
+
'crypto_key_auth': '',
|
175 |
+
'crypto_key_url': '',
|
176 |
+
'vk_api_key': '',
|
177 |
+
'senler_token': '',
|
178 |
+
'wa_ak': '',
|
179 |
+
'wa_api_key': '',
|
180 |
+
'curators': '',
|
181 |
+
'call_api_key': ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
}
|
183 |
+
|
184 |
+
with sqlite3.connect(SETTINGS_DB) as conn:
|
185 |
+
cursor = conn.cursor()
|
186 |
+
cursor.execute('SELECT * FROM settings')
|
187 |
+
settings = cursor.fetchone()
|
188 |
+
|
189 |
+
if settings is None:
|
190 |
+
return default_settings
|
191 |
+
|
192 |
+
# Создание словаря с использованием значений по умолчанию
|
193 |
+
return {key: settings[i + 1] or '' for i, key in enumerate(default_settings)}
|
194 |
+
|
195 |
def save_settings(settings_dict):
|
196 |
# Удаляем api_key_sys из словаря перед сохранением
|
197 |
if 'api_key_sys' in settings_dict:
|