From d9c4c369924d1874e68b19ed93aa1aefa439b0cd Mon Sep 17 00:00:00 2001
From: Roman Sergienko <romasergienko@outlook.com>
Date: Fri, 04 Dec 2026 08:26:53 +0000
Subject: [PATCH] Add /panel command with deep link to open Mini App with chat context

---
 web/auth.py |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/web/auth.py b/web/auth.py
index 114c076..bf80c2d 100644
--- a/web/auth.py
+++ b/web/auth.py
@@ -103,7 +103,19 @@
     ) or request.path.startswith("/static")
     if request["user"] is None and not public:
         raise web.HTTPFound("/login")
-    return await handler(request)
+    try:
+        response = await handler(request)
+    except web.HTTPException as response:
+        if request.path.startswith("/miniapp") or request.path == "/auth/miniapp":
+            response.headers["Cache-Control"] = "no-store, no-cache, must-revalidate, max-age=0"
+            response.headers["Pragma"] = "no-cache"
+        raise
+    if request.path.startswith("/miniapp") or request.path == "/auth/miniapp":
+        response.headers["Cache-Control"] = "no-store, no-cache, must-revalidate, max-age=0"
+        response.headers["Pragma"] = "no-cache"
+    if request.path.startswith("/static/"):
+        response.headers["Cache-Control"] = "no-cache, must-revalidate, max-age=0"
+    return response
 
 
 async def login_page(request) -> web.Response:
@@ -163,8 +175,8 @@
         token,
         max_age=SESS_TTL,
         httponly=True,
-        samesite="Lax",
-        secure=base_url(request).startswith("https"),
+        samesite="None",
+        secure=True,
     )
     return resp
 

--
Gitblit v1.9.3