settings: new option to disable event fetch from server side

This commit is contained in:
nemunaire 2019-01-19 08:04:10 +01:00
parent a4e0a90adf
commit 24989c4cfa
3 changed files with 18 additions and 1 deletions

View File

@ -150,6 +150,13 @@
</label>
</div>
<div class="form-check">
<label class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" ng-model="config.eventKindness">
<span class="custom-control-label">Réduire la relève d'évènements côté navigateur</span>
</label>
</div>
</fieldset>
</div>
</form>

View File

@ -162,8 +162,16 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
response.data.end = new Date(response.data.end);
response.data.generation = new Date(response.data.generation);
response.data.activateTime = new Date(response.data.activateTime);
if (response.data.activateTime <= new Date(Date.now() + (time.cu - time.he)))
if (response.data.activateTime <= new Date(Date.now() + (time.cu - time.he))) {
$rootScope.settings = response.data;
if (response.data.eventKindness && refreshEventsInterval) {
$interval.cancel(refreshEventsInterval);
refreshEventsInterval = null;
}
else if (!response.data.eventKindness && !refreshEventsInterval) {
refreshEvents();
}
}
else
$rootScope.settings.activateTime = response.data.activateTime;
});

View File

@ -61,6 +61,8 @@ type FICSettings struct {
UnlockedChallengeDepth int `json:"unlockedChallengeDepth"`
// SubmissionUniqueness don't count multiple times identical tries.
SubmissionUniqueness bool `json:"submissionUniqueness"`
// EventKindness will ask browsers to delay notification interval.
EventKindness bool `json:"eventKindness"`
}
// ExistsSettings checks if the settings file can by found at the given path.