Spaces:
Sleeping
Sleeping
update
Browse files
app.py
CHANGED
|
@@ -82,12 +82,12 @@ app.secret_key = os.environ.get("FLASK_SECRET_KEY", "dev-secret-please-change")
|
|
| 82 |
|
| 83 |
from werkzeug.middleware.proxy_fix import ProxyFix
|
| 84 |
|
| 85 |
-
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1
|
| 86 |
# supaya session tersimpan di browser saat lewat proxy/HTTPS (HF Spaces)
|
| 87 |
app.config.update(
|
| 88 |
SESSION_COOKIE_NAME="session",
|
| 89 |
SESSION_COOKIE_SAMESITE="None",
|
| 90 |
-
SESSION_COOKIE_SECURE=
|
| 91 |
SESSION_COOKIE_HTTPONLY=True,
|
| 92 |
SESSION_COOKIE_PATH="/",
|
| 93 |
PREFERRED_URL_SCHEME="https",
|
|
@@ -434,11 +434,14 @@ def auth_logout():
|
|
| 434 |
def about():
|
| 435 |
return render_template("about.html")
|
| 436 |
|
|
|
|
| 437 |
@app.route("/subjects")
|
| 438 |
@login_required
|
| 439 |
def subjects():
|
|
|
|
| 440 |
return render_template("home.html", subjects=SUBJECTS)
|
| 441 |
|
|
|
|
| 442 |
@app.route("/chat/<subject_key>")
|
| 443 |
@login_required
|
| 444 |
def chat_subject(subject_key: str):
|
|
|
|
| 82 |
|
| 83 |
from werkzeug.middleware.proxy_fix import ProxyFix
|
| 84 |
|
| 85 |
+
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1)
|
| 86 |
# supaya session tersimpan di browser saat lewat proxy/HTTPS (HF Spaces)
|
| 87 |
app.config.update(
|
| 88 |
SESSION_COOKIE_NAME="session",
|
| 89 |
SESSION_COOKIE_SAMESITE="None",
|
| 90 |
+
SESSION_COOKIE_SECURE=True,
|
| 91 |
SESSION_COOKIE_HTTPONLY=True,
|
| 92 |
SESSION_COOKIE_PATH="/",
|
| 93 |
PREFERRED_URL_SCHEME="https",
|
|
|
|
| 434 |
def about():
|
| 435 |
return render_template("about.html")
|
| 436 |
|
| 437 |
+
|
| 438 |
@app.route("/subjects")
|
| 439 |
@login_required
|
| 440 |
def subjects():
|
| 441 |
+
log.info(f"[SESSION DEBUG] logged_in={session.get('logged_in')} user_id={session.get('user_id')}")
|
| 442 |
return render_template("home.html", subjects=SUBJECTS)
|
| 443 |
|
| 444 |
+
|
| 445 |
@app.route("/chat/<subject_key>")
|
| 446 |
@login_required
|
| 447 |
def chat_subject(subject_key: str):
|