Gitea big step 1.27.3 -> 28.2.0 (bench + box + undo proven); repository import only from github.com, codeberg.org, gitlab.com (D57, operator); Gitea fixture commits a file and posts the whole installer form (felhom.eu R-1315)
gates / gates (push) Successful in 21s
gates / gates (push) Successful in 21s
This commit is contained in:
1 parent
9ef06a7a89
commit
0baf8f9485
7 files changed
+338
-19
No files matched your search
@@ -418,8 +418,6 @@ class Gitea:
|
||||
to the admin CLI (the old route). Its own REST API (basic auth) then creates a repository and reads it
|
||||
back. All of these are the app's own interfaces."""
|
||||
sub = "git"
|
||||
FORM_DEFAULTS = ("db_path", "app_name", "repo_root_path", "lfs_root_path", "run_user", "domain",
|
||||
"ssh_port", "http_port", "app_url", "log_root_path")
|
||||
|
||||
def seed(self, w, sub, say):
|
||||
if not w.wait_app(sub, "/", want=("200", "302")):
|
||||
@@ -428,11 +426,20 @@ class Gitea:
|
||||
pw = "Drill-" + secrets.token_hex(10)
|
||||
rc, code, page = w.app_curl(sub, "/")
|
||||
if 'name="db_type"' in (page or "") and 'name="admin_name"' in (page or ""):
|
||||
args = ["--data-urlencode", "db_type=sqlite3", "--data-urlencode", "password_algorithm=pbkdf2"]
|
||||
for n in self.FORM_DEFAULTS:
|
||||
m = re.search(r'name="%s" value="([^"]*)"' % n, page)
|
||||
if m:
|
||||
args += ["--data-urlencode", f"{n}={m.group(1)}"]
|
||||
# EVERY text/hidden field the page offers, with the page's own value — as a browser posts it. 28.x renamed the
|
||||
# form (app_data_path and no_reply_address in; repo_root_path, lfs_root_path, log_root_path, domain and
|
||||
# password_algorithm out): a fixed name list left a fresh 28.2.0 uninstalled (9202, 2026-10-28).
|
||||
args, seen = [], set()
|
||||
for m in re.finditer(r"<input([^>]*)>", page):
|
||||
a = m.group(1)
|
||||
n, v, t = (re.search(r'%s="([^"]*)"' % k, a) for k in ("name", "value", "type"))
|
||||
if not n or n.group(1).startswith("admin_") or (t and t.group(1) in ("checkbox", "password")):
|
||||
continue
|
||||
if n.group(1) not in seen:
|
||||
seen.add(n.group(1))
|
||||
args += ["--data-urlencode", f"{n.group(1)}={v.group(1) if v else ''}"]
|
||||
if "password_algorithm" in page and "password_algorithm" not in seen:
|
||||
args += ["--data-urlencode", "password_algorithm=pbkdf2"]
|
||||
args += ["--data-urlencode", f"admin_name={user}", "--data-urlencode", f"admin_passwd={pw}",
|
||||
"--data-urlencode", f"admin_confirm_passwd={pw}",
|
||||
"--data-urlencode", f"admin_email={user}@gate.invalid"]
|
||||
@@ -465,7 +472,18 @@ class Gitea:
|
||||
if code not in ("201", "200"):
|
||||
say(f" gitea: repo refused {body[:200]}")
|
||||
return None
|
||||
return {"user": user, "pw": pw, "repo": repo}
|
||||
# one commit through the app's own contents API (2026-10-28): the read-back reads the file's text, so a
|
||||
# conversion that keeps the repo row but loses the git data fails
|
||||
text = "drill " + secrets.token_hex(8) + "\n"
|
||||
rc, code, body = w.app_curl(sub, f"/api/v1/repos/{user}/{repo}/contents/drill.txt", "-u", f"{user}:{pw}",
|
||||
"-H", "Content-Type: application/json",
|
||||
data=json.dumps({"content": base64.b64encode(text.encode()).decode(),
|
||||
"message": "drill commit"}), method="POST")
|
||||
say(f" gitea: one commit (drill.txt) http={code}")
|
||||
if code not in ("201", "200"):
|
||||
say(f" gitea: commit refused {body[:200]}")
|
||||
return None
|
||||
return {"user": user, "pw": pw, "repo": repo, "text": text}
|
||||
|
||||
def verify(self, w, sub, t, say):
|
||||
if not w.wait_app(sub, "/", want=("200", "302"), tries=36):
|
||||
@@ -478,6 +496,15 @@ class Gitea:
|
||||
rc, code, body = w.app_curl(sub, f"/api/v1/repos/{t['user']}/{t['repo']}",
|
||||
"-u", f"{t['user']}:{t['pw']}")
|
||||
ok = code == "200" and t["repo"] in body
|
||||
if ok and t.get("text"):
|
||||
rc, c2, b2 = w.app_curl(sub, f"/api/v1/repos/{t['user']}/{t['repo']}/contents/drill.txt",
|
||||
"-u", f"{t['user']}:{t['pw']}")
|
||||
try:
|
||||
got = base64.b64decode(json.loads(b2).get("content") or "").decode()
|
||||
except (ValueError, TypeError):
|
||||
got = None
|
||||
ok = c2 == "200" and got == t["text"]
|
||||
say(f" gitea: the committed file read back http={c2} same={got == t['text']}")
|
||||
say(f" gitea: readback of the seeded repo http={code} ok={ok}")
|
||||
return ok
|
||||
|
||||
|
||||
Reference in new issue
Block a user