fix: Gitea tree loading + auth system overhaul (v2.5.0)
ROOT CAUSE: Local accounts ([email protected]) had no Gitea token linked, so /api/gitea/.../tree returned 401 → loadGiteaTree() failed silently. FIXES: 1. _require_gitea() now falls back to admin token for read ops → Any logged-in user can browse Gitea repos without linking account 2. get_user_gitea_client() filters by provider='gitea' → Prevents using wrong token if user has GitHub+Gitrea linked 3. OAuth callback now stores auth_method correctly → gitea_bruno gets auth_method='gitea' instead of 'local' 4. Linked Gitea token to [email protected] (user_id=127) → Local account can now use personal token for Gitea API PREVIOUS FIXES (from prior commit): - loadGiteaTree: skip if giteaWorkspace already loaded, error logging, .bind(this) - gitea_workspace.html: use captured 'self' instead of querySelector('[x-data]') - 12 test assertions updated to reflect admin fallback behavior
This commit is contained in:
+4
-4
@@ -295,11 +295,11 @@ async def callback(
|
||||
login_id = f"{provider_name}_{oauth_user['login']}"
|
||||
with get_conn() as conn:
|
||||
conn.execute(
|
||||
"""INSERT INTO users (login, full_name, email, avatar_url)
|
||||
VALUES (?, ?, ?, ?)
|
||||
"""INSERT INTO users (login, full_name, email, avatar_url, auth_method)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
ON CONFLICT(login)
|
||||
DO UPDATE SET full_name=excluded.full_name, email=excluded.email, avatar_url=excluded.avatar_url""",
|
||||
(login_id, oauth_user.get("full_name", ""), oauth_user.get("email", ""), oauth_user.get("avatar_url", "")),
|
||||
DO UPDATE SET full_name=excluded.full_name, email=excluded.email, avatar_url=excluded.avatar_url, auth_method=excluded.auth_method""",
|
||||
(login_id, oauth_user.get("full_name", ""), oauth_user.get("email", ""), oauth_user.get("avatar_url", ""), provider_name),
|
||||
)
|
||||
conn.commit()
|
||||
# Store OAuth token
|
||||
|
||||
Reference in New Issue
Block a user