disable download mode for the moment

This commit is contained in:
tdurieux
2023-04-05 12:12:16 +02:00
parent d29d4281ab
commit e94a5f164a
5 changed files with 31 additions and 116 deletions

View File

@@ -56,8 +56,8 @@ export default class Repository {
this._model = data;
switch (data.source.type) {
case "GitHubDownload":
this.source = new GitHubDownload(data.source, this);
break;
// this.source = new GitHubDownload(data.source, this);
// break;
case "GitHubStream":
this.source = new GitHubStream(data.source, this);
break;

View File

@@ -468,28 +468,29 @@ router.post("/", async (req: express.Request, res: express.Response) => {
repo.owner = user.id;
updateRepoModel(repo, repoUpdate);
repo.source.type = "GitHubStream";
repo.source.accessToken = user.accessToken;
repo.source.repositoryId = repository.model.id;
repo.source.repositoryName = repoUpdate.fullName;
if (repo.source.type == "GitHubDownload") {
// details.size is in kilobytes
if (
repository.size === undefined ||
repository.size > config.MAX_REPO_SIZE
) {
throw new AnonymousError("invalid_mode", {
object: repository,
httpStatus: 400,
});
}
}
if (
repository.size !== undefined &&
repository.size < config.AUTO_DOWNLOAD_REPO_SIZE
) {
repo.source.type = "GitHubDownload";
}
// if (repo.source.type === "GitHubDownload") {
// // details.size is in kilobytes
// if (
// repository.size === undefined ||
// repository.size > config.MAX_REPO_SIZE
// ) {
// throw new AnonymousError("invalid_mode", {
// object: repository,
// httpStatus: 400,
// });
// }
// }
// if (
// repository.size !== undefined &&
// repository.size < config.AUTO_DOWNLOAD_REPO_SIZE
// ) {
// repo.source.type = "GitHubDownload";
// }
repo.conference = repoUpdate.conference;
await repo.save();

View File

@@ -91,7 +91,7 @@ export default class GitHubDownload extends GitHubBase implements SourceBase {
const that = this;
async function updateProgress() {
if (progress && that.repository.status) {
if (progress && that.repository.status == RepositoryStatus.DOWNLOAD) {
await that.repository.updateStatus(
that.repository.status,
progress.transferred.toString()