ifw-arz commited on
Commit
655c3fa
1 Parent(s): 362b95f
Files changed (2) hide show
  1. app.py +28 -1
  2. processing/cloud_access.py +1 -2
app.py CHANGED
@@ -19,6 +19,7 @@ from processing.cloud_access import auto_download
19
  sprint_data_folder = "Messungen"
20
 
21
 
 
22
  def get_csv_files(data_folder):
23
  csv_files = []
24
  for file in os.listdir(data_folder):
@@ -28,6 +29,32 @@ def get_csv_files(data_folder):
28
  return csv_files
29
 
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  def main():
33
 
@@ -123,7 +150,7 @@ def main():
123
  if __name__ == "__main__":
124
  main()
125
 
126
- t1 = threading.Thread(target=auto_download())
127
  t1.start()
128
 
129
 
 
19
  sprint_data_folder = "Messungen"
20
 
21
 
22
+
23
  def get_csv_files(data_folder):
24
  csv_files = []
25
  for file in os.listdir(data_folder):
 
29
  return csv_files
30
 
31
 
32
+ def check_password():
33
+ """Returns `True` if the user had the correct password."""
34
+
35
+ def password_entered():
36
+ """Checks whether a password entered by the user is correct."""
37
+ if hmac.compare_digest(st.session_state["password"], st.secrets["password"]):
38
+ st.session_state["password_correct"] = True
39
+ del st.session_state["password"] # Don't store the password.
40
+ else:
41
+ st.session_state["password_correct"] = False
42
+
43
+ # Return True if the password is validated.
44
+ if st.session_state.get("password_correct", False):
45
+ return True
46
+
47
+ # Show input for password.
48
+ st.text_input(
49
+ "Password", type="password", on_change=password_entered, key="password"
50
+ )
51
+ if "password_correct" in st.session_state:
52
+ st.error("😕 Password incorrect")
53
+ return False
54
+
55
+ if not check_password():
56
+ st.stop() # Do not continue if check_password is not True.
57
+
58
 
59
  def main():
60
 
 
150
  if __name__ == "__main__":
151
  main()
152
 
153
+ t1 = threading.Thread(target=auto_download(st.secrets("seafile_token")))
154
  t1.start()
155
 
156
 
processing/cloud_access.py CHANGED
@@ -31,8 +31,7 @@ def seafile_download_file(seafile_token, library_id, folder_path, file, target_f
31
  print(f"File downloaded successfully to {target_folder}/{file_name}")
32
 
33
  def auto_download(seafile_token):
34
-
35
- seafile_token = "4cc2946501b19d995fed6a663989cd3d808d6660"
36
  library_id = "a6911db9-9ec6-42d3-9c2f-ce36b121c5e7"
37
  folder_path = "Messungen"
38
  target_folder = "Messungen"
 
31
  print(f"File downloaded successfully to {target_folder}/{file_name}")
32
 
33
  def auto_download(seafile_token):
34
+
 
35
  library_id = "a6911db9-9ec6-42d3-9c2f-ce36b121c5e7"
36
  folder_path = "Messungen"
37
  target_folder = "Messungen"