generator: Can perform synchronous generation

This commit is contained in:
nemunaire 2023-07-10 12:10:03 +02:00
parent ec98e521dc
commit 1769938205
13 changed files with 214 additions and 81 deletions

View file

@ -480,15 +480,16 @@ angular.module("FICApp")
}
$rootScope.staticFilesNeedUpdate = 0;
$rootScope.staticRegenerationInProgress = false;
$rootScope.regenerateStaticFiles = function() {
Settings.get().$promise.then(function(config) {
config.generation = (new Date()).toISOString();
config.$update(function() {
$rootScope.staticFilesNeedUpdate = 0;
$rootScope.addToast('success', "Regeneration in progress...");
}, function (response) {
$rootScope.addToast('success', 'An error occurs when saving settings:', response.data.errmsg);
})
$rootScope.staticRegenerationInProgress = true;
$http.post("api/full-generation").then(function(response) {
$rootScope.staticFilesNeedUpdate = 0;
$rootScope.staticRegenerationInProgress = false;
$rootScope.addToast('success', 'Regeneration ended');
}, function (response) {
$rootScope.staticRegenerationInProgress = false;
$rootScope.addToast('error', 'An error occurs when saving settings:', response.data.errmsg);
})
}
@ -633,11 +634,6 @@ angular.module("FICApp")
$scope.addToast('danger', 'An error occurs when saving settings:', response.data.errmsg);
});
}
$scope.regenerate = function() {
this.config.generation = (new Date()).toISOString();
$rootScope.settings.generation = new Date(this.config.generation);
$scope.saveSettings("Regeneration in progress...");
}
$scope.launchChallenge = function() {
var ts = Date.now() - Date.now() % 60000;
var d = new Date(ts + 120000);