mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-02-13 02:42:45 +00:00
add repository status page
This commit is contained in:
@@ -51,6 +51,7 @@ module.exports.downloadRepoAndAnonymize = async (repoConfig) => {
|
||||
return true;
|
||||
} else if (repoConfig.options.mode == "stream") {
|
||||
// in stream mode only download the list of file from github
|
||||
await repoUtils.updateStatus(repoConfig, "downloading");
|
||||
await fileUtils.getFileList({ repoConfig });
|
||||
await repoUtils.updateStatus(repoConfig, "ready");
|
||||
return true;
|
||||
|
||||
@@ -139,11 +139,19 @@ module.exports.downloadRepoZip = async (repoConfig, target) => {
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.updateStatus = async (repoConfig, status) => {
|
||||
module.exports.updateStatus = async (repoConfig, status, errorMessage) => {
|
||||
repoConfig.status = status;
|
||||
repoConfig.errorMessage = errorMessage;
|
||||
const update = { $set: { status } };
|
||||
if (!errorMessage) {
|
||||
update["$unset"] = { errorMessage: "" };
|
||||
} else {
|
||||
update["$set"].errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
await db
|
||||
.get("anonymized_repositories")
|
||||
.updateOne({ repoId: repoConfig.repoId }, { $set: { status } });
|
||||
.updateOne({ repoId: repoConfig.repoId }, update);
|
||||
};
|
||||
|
||||
module.exports.downloadOriginalRepo = async (repoConfig, destination) => {
|
||||
|
||||
Reference in New Issue
Block a user