shaheerawan3 commited on
Commit
4c90e82
·
verified ·
1 Parent(s): 103f0ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -10
app.py CHANGED
@@ -8,22 +8,35 @@ from views import (
8
  show_security_settings_page
9
  )
10
  from models import initialize_database
11
- from services import EmailService, CryptoService, MonitoringService
12
- from utils.localization import setup_localization
 
 
 
 
 
 
 
 
 
 
13
 
14
  def main():
15
- # Initialize core services
 
 
16
  if 'app_state' not in st.session_state:
17
  st.session_state.app_state = init_app()
18
  initialize_database()
19
- setup_localization()
20
 
21
- # Handle authentication and session management
22
- if not st.session_state.get('user'):
 
 
 
 
23
  show_login_page()
24
  else:
25
- # Route to appropriate page based on session state
26
- page = st.session_state.get('page', 'dashboard')
27
  pages = {
28
  'dashboard': show_dashboard,
29
  'add_account': show_add_account_page,
@@ -31,8 +44,9 @@ def main():
31
  'security': show_security_settings_page
32
  }
33
 
34
- if page in pages:
35
- pages[page]()
 
36
  else:
37
  st.error("Page not found")
38
 
 
8
  show_security_settings_page
9
  )
10
  from models import initialize_database
11
+ from creator import Creator
12
+ import sqlite3
13
+
14
+ def initialize_session_state():
15
+ if 'initialized' not in st.session_state:
16
+ st.session_state.initialized = True
17
+ st.session_state.db = sqlite3.connect('digital_heir.db', check_same_thread=False)
18
+ st.session_state.creator = Creator.get_info()
19
+ if 'page' not in st.session_state:
20
+ st.session_state.page = 'dashboard'
21
+ if 'user' not in st.session_state:
22
+ st.session_state.user = None
23
 
24
  def main():
25
+ initialize_session_state()
26
+
27
+ # Initialize core services only if not already present
28
  if 'app_state' not in st.session_state:
29
  st.session_state.app_state = init_app()
30
  initialize_database()
 
31
 
32
+ # Display creator info in sidebar
33
+ with st.sidebar:
34
+ st.write(f"Created by: {st.session_state.creator['name']}")
35
+ st.write(f"Version: {st.session_state.creator['version']}")
36
+
37
+ if not st.session_state.user:
38
  show_login_page()
39
  else:
 
 
40
  pages = {
41
  'dashboard': show_dashboard,
42
  'add_account': show_add_account_page,
 
44
  'security': show_security_settings_page
45
  }
46
 
47
+ current_page = st.session_state.get('page', 'dashboard')
48
+ if current_page in pages:
49
+ pages[current_page]()
50
  else:
51
  st.error("Page not found")
52