Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,11 @@ import shutil # Make sure this is imported at the top
|
|
| 9 |
TOPICS_DIR = "topics"
|
| 10 |
TEMP_DIR = "temp_build"
|
| 11 |
os.makedirs(TEMP_DIR, exist_ok=True)
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
st.set_page_config(page_title="Physics Topics", layout="wide")
|
| 14 |
|
| 15 |
# ==========================================
|
|
@@ -169,7 +173,7 @@ def compile_latex(file_path):
|
|
| 169 |
st.sidebar.title(f"Physics Archive ({current_role.title()})")
|
| 170 |
|
| 171 |
# ADMIN ONLY: Sync Button
|
| 172 |
-
if current_role == 'admin'
|
| 173 |
if st.sidebar.button("🔄 Pull from GitHub"):
|
| 174 |
with st.spinner("Downloading latest files..."):
|
| 175 |
success, msg = pull_from_github()
|
|
|
|
| 9 |
TOPICS_DIR = "topics"
|
| 10 |
TEMP_DIR = "temp_build"
|
| 11 |
os.makedirs(TEMP_DIR, exist_ok=True)
|
| 12 |
+
# Auto-load files if the container restarted
|
| 13 |
+
if not os.path.exists(TOPICS_DIR) or not os.listdir(TOPICS_DIR):
|
| 14 |
+
print("System restart detected. Auto-pulling files from GitHub...")
|
| 15 |
+
pull_from_github()
|
| 16 |
+
|
| 17 |
st.set_page_config(page_title="Physics Topics", layout="wide")
|
| 18 |
|
| 19 |
# ==========================================
|
|
|
|
| 173 |
st.sidebar.title(f"Physics Archive ({current_role.title()})")
|
| 174 |
|
| 175 |
# ADMIN ONLY: Sync Button
|
| 176 |
+
if current_role == 'admin':
|
| 177 |
if st.sidebar.button("🔄 Pull from GitHub"):
|
| 178 |
with st.spinner("Downloading latest files..."):
|
| 179 |
success, msg = pull_from_github()
|