Spaces:
Runtime error
Runtime error
Update app/routes.py
Browse files- app/routes.py +40 -6
app/routes.py
CHANGED
|
@@ -419,16 +419,50 @@ def verify_email(token):
|
|
| 419 |
return redirect(url_for('auth.register'))
|
| 420 |
|
| 421 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 422 |
|
| 423 |
-
@auth.route('/docs')
|
| 424 |
-
def docs():
|
| 425 |
-
|
| 426 |
|
| 427 |
|
| 428 |
-
allowed_extensions = {'pdf', 'docx'}
|
| 429 |
|
| 430 |
-
def allowed_file(filename):
|
| 431 |
-
|
| 432 |
|
| 433 |
|
| 434 |
# @auth.route('/try-api', methods=['GET', 'POST'])
|
|
|
|
| 419 |
return redirect(url_for('auth.register'))
|
| 420 |
|
| 421 |
|
| 422 |
+
@auth.route('/api-docs')
|
| 423 |
+
def api_docs():
|
| 424 |
+
if 'user_id' not in session:
|
| 425 |
+
flash('Please log in to view the API documentation.')
|
| 426 |
+
return redirect(url_for('auth.login'))
|
| 427 |
+
|
| 428 |
+
# Optionally fetch user info (for personalization in template)
|
| 429 |
+
user_id = session['user_id']
|
| 430 |
+
user_res = requests.get(
|
| 431 |
+
f"{SUPABASE_URL}/rest/v1/users?id=eq.{user_id}&select=*",
|
| 432 |
+
headers=HEADERS
|
| 433 |
+
)
|
| 434 |
+
user = user_res.json()[0] if user_res.status_code == 200 and user_res.json() else {}
|
| 435 |
+
|
| 436 |
+
return render_template('api_docs.html', title="API Documentation", user=user)
|
| 437 |
+
|
| 438 |
+
|
| 439 |
+
|
| 440 |
+
@auth.route('/settings')
|
| 441 |
+
def settings():
|
| 442 |
+
if 'user_id' not in session:
|
| 443 |
+
flash('Please log in to access settings.')
|
| 444 |
+
return redirect(url_for('auth.login'))
|
| 445 |
+
|
| 446 |
+
user_id = session['user_id']
|
| 447 |
+
user_res = requests.get(
|
| 448 |
+
f"{SUPABASE_URL}/rest/v1/users?id=eq.{user_id}&select=*",
|
| 449 |
+
headers=HEADERS
|
| 450 |
+
)
|
| 451 |
+
user = user_res.json()[0] if user_res.status_code == 200 and user_res.json() else {}
|
| 452 |
+
|
| 453 |
+
return render_template('settings.html', title="User Settings", user=user)
|
| 454 |
+
|
| 455 |
+
|
| 456 |
|
| 457 |
+
# @auth.route('/docs')
|
| 458 |
+
# def docs():
|
| 459 |
+
# return render_template('docs.html', response=None)
|
| 460 |
|
| 461 |
|
| 462 |
+
# allowed_extensions = {'pdf', 'docx'}
|
| 463 |
|
| 464 |
+
# def allowed_file(filename):
|
| 465 |
+
# return '.' in filename and filename.rsplit('.', 1)[1].lower() in allowed_extensions
|
| 466 |
|
| 467 |
|
| 468 |
# @auth.route('/try-api', methods=['GET', 'POST'])
|