Skydata001 commited on
Commit
5aa5791
·
verified ·
1 Parent(s): 5dcbdcb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -22,7 +22,6 @@ if 'authenticated' not in st.session_state:
22
  st.session_state.authenticated = False
23
 
24
  # كود HTML/JavaScript الذي سيتم حقنه في Streamlit "للاستماع"
25
- # هذا الكود يعمل داخل الـ iframe (في Hugging Face)
26
  auth_listener_html = """
27
  <script>
28
  // الاستماع للرسائل القادمة من النافذة "الأب"
@@ -52,12 +51,11 @@ window.addEventListener('message', (event) => {
52
  """
53
 
54
  # تشغيل "المستمع" كعنصر HTML غير مرئي
55
- # ستقوم هذه الدالة بإرجاع القيمة (authenticated: true) عند نجاح الاستماع
56
  auth_result = components.html(auth_listener_html, height=0, width=0)
57
 
58
- # --- <<< هذا هو السطر الذي تم تصحيحه ---
59
  # إذا أرسل المستمع نتيجة إيجابية، قم بتحديث حالة الجلسة
60
- if auth_result and "authenticated" in auth_result and auth_result["authenticated"]:
61
  st.session_state.authenticated = True
62
  # --- نهاية خطوة المصادقة ---
63
 
 
22
  st.session_state.authenticated = False
23
 
24
  # كود HTML/JavaScript الذي سيتم حقنه في Streamlit "للاستماع"
 
25
  auth_listener_html = """
26
  <script>
27
  // الاستماع للرسائل القادمة من النافذة "الأب"
 
51
  """
52
 
53
  # تشغيل "المستمع" كعنصر HTML غير مرئي
 
54
  auth_result = components.html(auth_listener_html, height=0, width=0)
55
 
56
+ # --- <<< هذا هو السطر الذي تم تصحيحه (السطر 60) ---
57
  # إذا أرسل المستمع نتيجة إيجابية، قم بتحديث حالة الجلسة
58
+ if auth_result and isinstance(auth_result, dict) and auth_result.get("authenticated") == True:
59
  st.session_state.authenticated = True
60
  # --- نهاية خطوة المصادقة ---
61