FauziIsyrinApridal commited on
Commit
daebd12
·
1 Parent(s): 2b85412
Files changed (1) hide show
  1. app.py +0 -37
app.py CHANGED
@@ -2,7 +2,6 @@ import streamlit as st
2
  import os
3
  from dotenv import load_dotenv
4
  from langsmith import traceable
5
- from streamlit.components.v1 import html
6
 
7
  from app.chat import (
8
  initialize_session_state,
@@ -38,42 +37,6 @@ def main():
38
  page_title="PNP-Bot",
39
  page_icon="assets/favicon.ico",
40
  )
41
- # Handle Supabase recovery links globally: migrate hash to query params and short-circuit to auth view
42
- # Always inject the script; it only runs when there is a hash.
43
- html(
44
- """
45
- <script>
46
- (function(){
47
- const hash = window.location.hash && window.location.hash.startsWith('#')
48
- ? window.location.hash.substring(1)
49
- : window.location.hash;
50
- if (hash && !window.__hashMigratedMain) {
51
- const h = new URLSearchParams(hash);
52
- const qp = new URLSearchParams(window.location.search);
53
- for (const [k,v] of h.entries()) { qp.set(k, v); }
54
- const newUrl = window.location.pathname + '?' + qp.toString();
55
- window.history.replaceState(null, '', newUrl);
56
- window.location.hash = '';
57
- window.__hashMigratedMain = true;
58
- window.location.reload();
59
- }
60
- })();
61
- </script>
62
- """,
63
- height=0,
64
- )
65
-
66
- # If recovery params are present, show the reset password view regardless of current auth state
67
- try:
68
- qp = st.query_params # Streamlit >= 1.30
69
- get_q = lambda k: qp.get(k, None)
70
- except Exception:
71
- qp = st.experimental_get_query_params()
72
- get_q = lambda k: (qp.get(k, [None])[0] if isinstance(qp.get(k, None), list) else qp.get(k, None))
73
- if get_q("type") == "recovery":
74
- auth.auth_view()
75
- return
76
-
77
  # Try restore Supabase session if user missing
78
  restore_user_session_if_needed()
79
  # Authentication gate
 
2
  import os
3
  from dotenv import load_dotenv
4
  from langsmith import traceable
 
5
 
6
  from app.chat import (
7
  initialize_session_state,
 
37
  page_title="PNP-Bot",
38
  page_icon="assets/favicon.ico",
39
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  # Try restore Supabase session if user missing
41
  restore_user_session_if_needed()
42
  # Authentication gate