frontend: allow partial settings (used when publicly published)

This commit is contained in:
nemunaire 2019-02-18 18:00:54 +01:00
parent 15d108497e
commit 536dc0eb6b
2 changed files with 10 additions and 6 deletions

View File

@ -172,11 +172,15 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$http.get("settings.json").then(function(response) { $http.get("settings.json").then(function(response) {
var time = $rootScope.recvTime(response); var time = $rootScope.recvTime(response);
if (response.data.start)
response.data.start = new Date(response.data.start); response.data.start = new Date(response.data.start);
if (response.data.end)
response.data.end = new Date(response.data.end); response.data.end = new Date(response.data.end);
if (response.data.generation)
response.data.generation = new Date(response.data.generation); response.data.generation = new Date(response.data.generation);
if (response.data.activateTime)
response.data.activateTime = new Date(response.data.activateTime); response.data.activateTime = new Date(response.data.activateTime);
if (response.data.activateTime <= new Date(Date.now() + (time.cu - time.he))) { if ($rootScope.settings === undefined || response.data.activateTime === undefined || response.data.activateTime <= new Date(Date.now() + (time.cu - time.he))) {
$rootScope.settings = response.data; $rootScope.settings = response.data;
if (response.data.eventKindness && refreshEventsInterval) { if (response.data.eventKindness && refreshEventsInterval) {
$interval.cancel(refreshEventsInterval); $interval.cancel(refreshEventsInterval);

View File

@ -162,7 +162,7 @@ angular.module("FICApp")
$rootScope.refresh(true, true); $rootScope.refresh(true, true);
var remain = 0; var remain = 0;
if ($rootScope.settings.start == 0) { if ($rootScope.settings.start === undefined || $rootScope.settings.start == 0) {
$scope.time = {}; $scope.time = {};
return return
} else if ($rootScope.settings.start > srv_cur) { } else if ($rootScope.settings.start > srv_cur) {