fix: look for 303s on successful form submissions
This commit is contained in:
parent
2f9ce4be5d
commit
77dda509ca
1 changed files with 1 additions and 43 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue