Upload folder via GUI - src
This commit is contained in:
@@ -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
|
GITHUB API FUNCTIONS
|
||||||
==================================================== */
|
==================================================== */
|
||||||
@@ -1949,6 +1967,30 @@ async function updateGithubRepoTopics({ token, owner, repo, topics }) {
|
|||||||
return response.data;
|
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 }) {
|
async function deleteGithubRepo({ token, owner, repo }) {
|
||||||
await axiosInstance.delete(
|
await axiosInstance.delete(
|
||||||
`${GITHUB_API}/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`,
|
`${GITHUB_API}/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`,
|
||||||
@@ -1988,6 +2030,7 @@ module.exports = {
|
|||||||
updateGiteaRepoAvatar,
|
updateGiteaRepoAvatar,
|
||||||
updateGiteaRepoVisibility,
|
updateGiteaRepoVisibility,
|
||||||
updateGiteaRepoTopics,
|
updateGiteaRepoTopics,
|
||||||
|
updateGiteaRepoArchived,
|
||||||
migrateRepoToGitea,
|
migrateRepoToGitea,
|
||||||
listGiteaTopicsCatalog,
|
listGiteaTopicsCatalog,
|
||||||
getGiteaCurrentUser,
|
getGiteaCurrentUser,
|
||||||
@@ -2032,5 +2075,6 @@ module.exports = {
|
|||||||
updateGithubRepoVisibility,
|
updateGithubRepoVisibility,
|
||||||
updateGithubRepoDefaultBranch,
|
updateGithubRepoDefaultBranch,
|
||||||
updateGithubRepoTopics,
|
updateGithubRepoTopics,
|
||||||
|
updateGithubRepoArchived,
|
||||||
deleteGithubRepo
|
deleteGithubRepo
|
||||||
};
|
};
|
||||||
@@ -13,7 +13,7 @@ const ppath = require('path');
|
|||||||
const LOG_LEVELS = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
|
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 currentLogLevel = process.env.NODE_ENV === 'production' ? LOG_LEVELS.INFO : LOG_LEVELS.DEBUG;
|
||||||
let logQueue = [];
|
let logQueue = [];
|
||||||
const MAX_LOG_BUFFER = 100;
|
const MAX_LOG_BUFFER = 2000;
|
||||||
|
|
||||||
function formatLog(level, context, message, details = null) {
|
function formatLog(level, context, message, details = null) {
|
||||||
const timestamp = new Date().toISOString();
|
const timestamp = new Date().toISOString();
|
||||||
|
|||||||
Reference in New Issue
Block a user