Update app.py
Browse files
app.py
CHANGED
@@ -228,7 +228,9 @@ def save_settings(settings_dict):
|
|
228 |
def get_settings():
|
229 |
# Проверка IP-адреса клиента
|
230 |
client_ip = request.remote_addr
|
231 |
-
|
|
|
|
|
232 |
return jsonify({"error": "Unauthorized access"}), 403
|
233 |
|
234 |
return jsonify(settings)
|
@@ -237,7 +239,9 @@ def get_settings():
|
|
237 |
def save_settings_route():
|
238 |
# Проверка IP-адреса клиента
|
239 |
client_ip = request.remote_addr
|
240 |
-
|
|
|
|
|
241 |
return jsonify({"error": "Unauthorized access"}), 403
|
242 |
|
243 |
data = request.json.get('data', {})
|
@@ -250,7 +254,6 @@ def save_settings_route():
|
|
250 |
else:
|
251 |
return jsonify({'status': 'error', 'message': 'No data provided'}), 400
|
252 |
|
253 |
-
|
254 |
@app.route('/set')
|
255 |
def index_set():
|
256 |
return render_template('settings.html')
|
@@ -262,6 +265,7 @@ def index_set():
|
|
262 |
|
263 |
|
264 |
|
|
|
265 |
mapping_template = {
|
266 |
"username": "name",
|
267 |
"phone": "phone",
|
|
|
228 |
def get_settings():
|
229 |
# Проверка IP-адреса клиента
|
230 |
client_ip = request.remote_addr
|
231 |
+
server_ip = get_ip_address()
|
232 |
+
print(f"Client IP: {client_ip}, Server IP: {server_ip}") # Отладочная информация
|
233 |
+
if client_ip != server_ip:
|
234 |
return jsonify({"error": "Unauthorized access"}), 403
|
235 |
|
236 |
return jsonify(settings)
|
|
|
239 |
def save_settings_route():
|
240 |
# Проверка IP-адреса клиента
|
241 |
client_ip = request.remote_addr
|
242 |
+
server_ip = get_ip_address()
|
243 |
+
print(f"Client IP: {client_ip}, Server IP: {server_ip}") # Отладочная информация
|
244 |
+
if client_ip != server_ip:
|
245 |
return jsonify({"error": "Unauthorized access"}), 403
|
246 |
|
247 |
data = request.json.get('data', {})
|
|
|
254 |
else:
|
255 |
return jsonify({'status': 'error', 'message': 'No data provided'}), 400
|
256 |
|
|
|
257 |
@app.route('/set')
|
258 |
def index_set():
|
259 |
return render_template('settings.html')
|
|
|
265 |
|
266 |
|
267 |
|
268 |
+
|
269 |
mapping_template = {
|
270 |
"username": "name",
|
271 |
"phone": "phone",
|