Upload folder via GUI - src

This commit is contained in:
Git Manager GUI
2026-05-07 22:16:10 +02:00
parent 60a685fdda
commit 32eeba859e
2 changed files with 45 additions and 1 deletions

View File

@@ -1310,6 +1310,24 @@ async function updateGiteaRepoTopics({ token, url, owner, repo, topics }) {
}
}
async function updateGiteaRepoArchived({ token, url, owner, repo, archived }) {
const base = normalizeAndValidateBaseUrl(url);
const endpoint = `${base}/api/v1/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`;
const res = await axiosInstance.patch(
endpoint,
{ archived: !!archived },
{
headers: {
Authorization: `token ${token}`,
'Content-Type': 'application/json',
'User-Agent': 'Git-Manager-GUI'
},
timeout: 15000
}
);
return res.data;
}
/* ====================================================
GITHUB API FUNCTIONS
==================================================== */
@@ -1949,6 +1967,30 @@ async function updateGithubRepoTopics({ token, owner, repo, topics }) {
return response.data;
}
async function updateGithubRepoArchived({ token, owner, repo, archived }) {
const repoPath = `${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`;
const archiveEndpoint = `${GITHUB_API}/repos/${repoPath}/archive`;
if (archived) {
await axiosInstance.put(
archiveEndpoint,
{},
{ headers: githubHeaders(token), timeout: 15000 }
);
} else {
await axiosInstance.delete(
archiveEndpoint,
{ headers: githubHeaders(token), timeout: 15000 }
);
}
const response = await axiosInstance.get(
`${GITHUB_API}/repos/${repoPath}`,
{ headers: githubHeaders(token), timeout: 15000 }
);
return response.data;
}
async function deleteGithubRepo({ token, owner, repo }) {
await axiosInstance.delete(
`${GITHUB_API}/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`,
@@ -1988,6 +2030,7 @@ module.exports = {
updateGiteaRepoAvatar,
updateGiteaRepoVisibility,
updateGiteaRepoTopics,
updateGiteaRepoArchived,
migrateRepoToGitea,
listGiteaTopicsCatalog,
getGiteaCurrentUser,
@@ -2032,5 +2075,6 @@ module.exports = {
updateGithubRepoVisibility,
updateGithubRepoDefaultBranch,
updateGithubRepoTopics,
updateGithubRepoArchived,
deleteGithubRepo
};

View File

@@ -13,7 +13,7 @@ const ppath = require('path');
const LOG_LEVELS = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
let currentLogLevel = process.env.NODE_ENV === 'production' ? LOG_LEVELS.INFO : LOG_LEVELS.DEBUG;
let logQueue = [];
const MAX_LOG_BUFFER = 100;
const MAX_LOG_BUFFER = 2000;
function formatLog(level, context, message, details = null) {
const timestamp = new Date().toISOString();