Update src/streamlit_app.py
Browse files138 unmodified lines13914014114214314429 unmodified lines17417517617717817918018118218 unmodified lines201202203204205206207208209296 unmodified lines506507508509510511512513514115 unmodified lines630631632633634635636138 unmodified linesst.rerun()except Exception as e:st.error(f"🛑 登入驗證失敗,請重新點擊登入。({e})")time.sleep(3)st.query_params.clear()st.rerun()29 unmodified linesif "JWT expired" in str(e) or "PGRST303" in str(e):try: supabase.auth.sign_out()except: pass# 💡 加上 key 解決 NoneType Bugcookie_manager.delete("user_email", key="del_load")st.session_state.clear()st.error("🔒 系統安全機制:登入時效已過期,請重新登入!")time.sleep(2)st.rerun()18 unmodified linesif "JWT expired" in str(e) or "PGRST303" in str(e):try: supabase.auth.sign_out()except: pass# 💡 加上 key 解決 NoneType Bugcookie_manager.delete("user_email", key="del_save")st.session_state.clear()st.rerun()else:raise e296 unmodified linesst.rerun()with c_out:if st.button("🚪", help="登出", use_container_width=True):# 💡 加上 key 解決 NoneType Bug,登出按鈕完美修復cookie_manager.delete("user_email", key="del_logout")st.session_state.clear()components.html("""<script>document.cookie = "user_email=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; setTimeout(function() {window.parent.location.reload();}, 300);</script>""", height=0)st.stop()115 unmodified linesst.divider()st.markdown("#### ⚖️ 資金手掌握")c1, c2 = st.columns(2)nb_twd = c1.number_input("台幣帳戶餘額 (TWD)", value=int(float(db.get("account_balance", 0))))138 unmodified lines13914014114214314414514629 unmodified lines17617717817918018118218318418 unmodified lines203204205206207208209210211296 unmodified lines508509510511512513514515516517518115 unmodified lines634635636637638639640138 unmodified linesst.rerun()except Exception as e:st.error(f"🛑 登入驗證失敗,請重新點擊登入。({e})")# 💡 失敗時強制清除機器人快取,恢復原廠設定!init_supabase.clear()time.sleep(3)st.query_params.clear()st.rerun()29 unmodified linesif "JWT expired" in str(e) or "PGRST303" in str(e):try: supabase.auth.sign_out()except: passcookie_manager.delete("user_email", key="del_load")st.session_state.clear()init_supabase.clear() # 💡 強制清除機器人快取st.error("🔒 系統安全機制:登入時效已過期,請重新登入!")time.sleep(2)st.rerun()18 unmodified linesif "JWT expired" in str(e) or "PGRST303" in str(e):try: supabase.auth.sign_out()except: passcookie_manager.delete("user_email", key="del_save")st.session_state.clear()init_supabase.clear() # 💡 強制清除機器人快取st.rerun()else:raise e296 unmodified linesst.rerun()with c_out:if st.button("🚪", help="登出", use_container_width=True):try: supabase.auth.sign_out()except: passcookie_manager.delete("user_email", key="del_logout")st.session_state.clear()init_supabase.clear() # 💡 登出時強制清除機器人快取,恢復原廠設定!components.html("""<script>document.cookie = "user_email=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; setTimeout(function() {window.parent.location.reload();}, 300);</script>""", height=0)st.stop()115 unmodified linesst.divider()st.markdown("#### ⚖️ 資金手動調整")c1, c2 = st.columns(2)nb_twd = c1.number_input("台幣帳戶餘額 (TWD)", value=int(float(db.get("account_balance", 0))))
src/streamlit_app.py+8-4