From a539bedbbd7caffa1cb176bbdffecb6db4ce26e8 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sun, 1 Jun 2025 12:28:48 +0200 Subject: [PATCH] Update repository description and fetch updated clone URL in main.js --- main.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index fd55f71..d63c845 100644 --- a/main.js +++ b/main.js @@ -2310,8 +2310,20 @@ ipcMain.handle('push-to-gitea', async (_evt, folderPath) => { const created = await createResp.json(); repoUrl = created.clone_url; } else if (checkResp.ok) { - // 4b) Repo already exists → use its clone_url - const existing = await checkResp.json(); + // Repo already exists → first update its description + await fetch(`${GITEA_BASE}/repos/${username}/${repoName}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + Authorization: `token ${GITEA_TOKEN}` + }, + body: JSON.stringify({ description }) + }); + + // Now fetch the repo data so we get the up‐to‐date clone_url + const existing = await (await fetch(`${GITEA_BASE}/repos/${username}/${repoName}`, { + headers: { Authorization: `token ${GITEA_TOKEN}` } + })).json(); repoUrl = existing.clone_url; } else { const txt = await checkResp.text();