-
+
-
+
-
- Avec le parrainage des réserves de cyberdéfense
+
+ Avec le parrainage du commandement de la cyberdéfense française
diff --git a/dashboard/static/js/dashboard.js b/dashboard/static/js/dashboard.js
index bf23c9a2..951180f6 100644
--- a/dashboard/static/js/dashboard.js
+++ b/dashboard/static/js/dashboard.js
@@ -69,9 +69,11 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
.controller("DataController", function($scope, $http, $rootScope, $interval) {
var pathname = window.location.pathname;
if (pathname == "/")
- pathname = "/public0.html"
+ pathname = "/public0.html";
+ pathname = pathname.replace(".html", ".json");
+
var refreshScene = function() {
- $http.get(pathname.replace(".html", ".json")).then(function(response) {
+ $http.get(pathname).then(function(response) {
if ($scope.lastpublicetag != undefined && $scope.lastpublicetag == response.headers()["last-modified"])
return;
$scope.lastpublicetag = response.headers()["last-modified"];
@@ -79,7 +81,24 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
$scope.scene = response.data;
});
}
- var refreshData = function() {
+ refreshScene();
+ var refreshSceneInterval = $interval(refreshScene, 900);
+
+ var refreshSettings = function() {
+ $http.get("/settings.json").then(function(response) {
+ $rootScope.recvTime(response);
+ response.data.start = new Date(response.data.start);
+ response.data.end = new Date(response.data.end);
+ response.data.generation = new Date(response.data.generation);
+ response.data.awards = new Date("2019-01-23T15:00:00Z");
+ $rootScope.settings = response.data;
+ });
+ }
+ refreshSettings();
+ var refreshSettingsInterval = $interval(refreshSettings, 4200);
+
+
+ $rootScope.refresh = function() {
$http.get("/my.json").then(function(response) {
if ($scope.lastmyetag != undefined && $scope.lastmyetag == response.headers()["last-modified"])
return;
@@ -138,10 +157,8 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
$scope.pagesrank = Array(Math.ceil($scope.rank.length / 7)).fill(0).map(function(v, i){ return i; });
});
}
- refreshData();
- refreshScene();
- $interval(refreshData, 4200);
- $interval(refreshScene, 900);
+ $rootScope.refresh();
+ $interval($rootScope.refresh, 4200);
})
.controller("TeamController", function($scope, $http, $interval) {
$scope.mystats = null;
diff --git a/frontend/static/js/common.js b/frontend/static/js/common.js
index 5c276c26..1cea8b40 100644
--- a/frontend/static/js/common.js
+++ b/frontend/static/js/common.js
@@ -149,10 +149,10 @@ angular.module("FICApp")
$scope.time = {};
return
} else if ($rootScope.settings.start > srv_cur) {
- $rootScope.startIn = Math.floor(($rootScope.settings.start - srv_cur) / 1000);
+ $scope.startIn = Math.floor(($rootScope.settings.start - srv_cur) / 1000);
remain = $rootScope.settings.end - $rootScope.settings.start;
} else if ($rootScope.settings.end > srv_cur) {
- $rootScope.startIn = 0;
+ $scope.startIn = 0;
remain = $rootScope.settings.end - srv_cur;
}