From 77dda509ca4f04c4f47f9fba7b53a8c5b5898c54 Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Thu, 2 Jan 2025 18:17:38 +0530 Subject: [PATCH] fix: look for 303s on successful form submissions --- scripts/gitea.py | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/scripts/gitea.py b/scripts/gitea.py index 255687f..601c81c 100755 --- a/scripts/gitea.py +++ b/scripts/gitea.py @@ -30,46 +30,6 @@ def check_online(): count += 1 continue - -def install(): - INSTALL_PAYLOAD = { - "db_type": "sqlite3", - "db_host": "localhost:3306", - "db_user": "root", - "db_passwd": "", - "db_name": "gitea", - "ssl_mode": "disable", - "db_schema": "", - "charset": "utf8", - "db_path": "/data/gitea/gitea.db", - "app_name": "Gitea:+Git+with+a+cup+of+tea", - "repo_root_path": "/data/git/repositories", - "lfs_root_path": "/data/git/lfs", - "run_user": "git", - "domain": "localhost", - "ssh_port": "2221", - "http_port": "3000", - "app_url": "http://localhost:3000/", - "log_root_path": "/data/gitea/log", - "smtp_host": "", - "smtp_from": "", - "smtp_user": "", - "smtp_passwd": "", - "enable_federated_avatar": "on", - "enable_open_id_sign_in": "on", - "enable_open_id_sign_up": "on", - "default_allow_create_organization": "on", - "default_enable_timetracking": "on", - "no_reply_address": "noreply.localhost", - "password_algorithm": "pbkdf2", - "admin_name": "", - "admin_passwd": "", - "admin_confirm_passwd": "", - "admin_email": "", - } - requests.post(f"http://localhost:3000", data=INSTALL_PAYLOAD) - - class ParseCSRFGiteaForm(HTMLParser): token: str = None @@ -141,7 +101,7 @@ def login(client: HTMLClient): } resp = client.session.post(url, data=payload, allow_redirects=False) print(f"login {client.session.cookies}") - if resp.status_code == 302: + if resp.status_code == 303: print("User logged in") return @@ -196,8 +156,6 @@ if __name__ == "__main__": REPOS.append(f"repository_{i}") check_online() print("Instance online") - install() - print("Instance configured and installed") client = HTMLClient() count = 0 while True: