diff --git a/app.py b/app.py
index 9c4f81e..d54b6bf 100644
--- a/app.py
+++ b/app.py
@@ -453,24 +453,36 @@ def admin_update_server():
return redirect(url_for("admin_login"))
try:
- output = subprocess.check_output(["git", "pull", "origin", "main"], cwd=os.getcwd()).decode()
- flash("✅ Server updated successfully!
" + html.escape(output) + "", "update") - except subprocess.CalledProcessError as e: - flash("❌ Failed to update server:
" + html.escape(e.output.decode()) + "", "update") - except Exception as ex: - flash("❌ An error occurred: " + str(ex), "update") + repo_dir = os.path.abspath(os.path.dirname(__file__)) # Dynamically get current project directory + repo_url = "https://github.com/TySP-Dev/PacCrypt.git" + + # Ensure directory is a git repo + if not os.path.exists(os.path.join(repo_dir, ".git")): + return redirect(url_for('500.html')) + + # Pull latest changes + subprocess.run(["git", "fetch"], cwd=repo_dir, check=True) + subprocess.run(["git", "reset", "--hard", "origin/main"], cwd=repo_dir, check=True) + subprocess.run(["git", "pull", repo_url, "main"], cwd=repo_dir, check=True) + + flash("Server updated from GitHub!", "clear-feedback") + except Exception as e: + flash(f"Update failed: {str(e)}", "clear-feedback") return redirect(url_for("admin_page")) -@app.route("/sitemap") + +@app.route("/sitemap", methods=["GET"]) def sitemap(): - output = ["