Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -200,13 +200,22 @@ def save_settings(settings_dict):
|
|
200 |
print(f"curators: {curators_ser}")
|
201 |
print(f"call_api_key: {call_api_key}")
|
202 |
|
203 |
-
|
204 |
@app.route('/settings', methods=['GET'])
|
205 |
def get_settings():
|
|
|
|
|
|
|
|
|
|
|
206 |
return jsonify(settings)
|
207 |
|
208 |
@app.route('/settings', methods=['POST'])
|
209 |
def save_settings_route():
|
|
|
|
|
|
|
|
|
|
|
210 |
data = request.json
|
211 |
if data:
|
212 |
for key, value in data.items():
|
@@ -217,6 +226,7 @@ def save_settings_route():
|
|
217 |
else:
|
218 |
return jsonify({'status': 'error', 'message': 'No data provided'}), 400
|
219 |
|
|
|
220 |
@app.route('/set')
|
221 |
def index_set():
|
222 |
return render_template('settings.html')
|
|
|
200 |
print(f"curators: {curators_ser}")
|
201 |
print(f"call_api_key: {call_api_key}")
|
202 |
|
|
|
203 |
@app.route('/settings', methods=['GET'])
|
204 |
def get_settings():
|
205 |
+
# Проверка заголовка Origin
|
206 |
+
origin = request.headers.get('Origin')
|
207 |
+
if origin != ALLOWED_ORIGIN:
|
208 |
+
return jsonify({"error": "Unauthorized access"}), 403
|
209 |
+
|
210 |
return jsonify(settings)
|
211 |
|
212 |
@app.route('/settings', methods=['POST'])
|
213 |
def save_settings_route():
|
214 |
+
# Проверка заголовка Origin
|
215 |
+
origin = request.headers.get('Origin')
|
216 |
+
if origin != ALLOWED_ORIGIN:
|
217 |
+
return jsonify({"error": "Unauthorized access"}), 403
|
218 |
+
|
219 |
data = request.json
|
220 |
if data:
|
221 |
for key, value in data.items():
|
|
|
226 |
else:
|
227 |
return jsonify({'status': 'error', 'message': 'No data provided'}), 400
|
228 |
|
229 |
+
|
230 |
@app.route('/set')
|
231 |
def index_set():
|
232 |
return render_template('settings.html')
|