admin: Use relative path to call API

This commit is contained in:
nemunaire 2021-07-21 23:17:47 +02:00
parent 8f1b44e3dd
commit 29607981e4
5 changed files with 87 additions and 87 deletions

View File

@ -63,7 +63,7 @@ const indextpl = `<!DOCTYPE html>
} }
</style> </style>
<base href="{{.urlbase}}"> <base href="{{.urlbase}}">
<script src="/js/d3.v3.min.js"></script> <script src="js/d3.v3.min.js"></script>
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<nav class="navbar sticky-top navbar-expand-lg navbar-dark bg-dark text-light"> <nav class="navbar sticky-top navbar-expand-lg navbar-dark bg-dark text-light">

View File

@ -178,161 +178,161 @@ angular.module("FICApp")
angular.module("FICApp") angular.module("FICApp")
.factory("Version", function($resource) { .factory("Version", function($resource) {
return $resource("/api/version") return $resource("api/version")
}) })
.factory("Timestamp", function($resource) { .factory("Timestamp", function($resource) {
return $resource("/api/timestamps.json") return $resource("api/timestamps.json")
}) })
.factory("Health", function($resource) { .factory("Health", function($resource) {
return $resource("/api/health.json") return $resource("api/health.json")
}) })
.factory("Monitor", function($resource) { .factory("Monitor", function($resource) {
return $resource("/api/monitor/:machineId", { machineId: '@id' }) return $resource("api/monitor/:machineId", { machineId: '@id' })
}) })
.factory("Event", function($resource) { .factory("Event", function($resource) {
return $resource("/api/events/:eventId", { eventId: '@id' }, { return $resource("api/events/:eventId", { eventId: '@id' }, {
'update': {method: 'PUT'}, 'update': {method: 'PUT'},
}) })
}) })
.factory("Claim", function($resource) { .factory("Claim", function($resource) {
return $resource("/api/claims/:claimId", { claimId: '@id' }, { return $resource("api/claims/:claimId", { claimId: '@id' }, {
'update': {method: 'PUT'}, 'update': {method: 'PUT'},
}) })
}) })
.factory("ClaimAssignee", function($resource) { .factory("ClaimAssignee", function($resource) {
return $resource("/api/claims-assignees/:assigneeId", { assigneeId: '@id' }, { return $resource("api/claims-assignees/:assigneeId", { assigneeId: '@id' }, {
'update': {method: 'PUT'}, 'update': {method: 'PUT'},
}) })
}) })
.factory("Certificate", function($resource) { .factory("Certificate", function($resource) {
return $resource("/api/certs/:serial", { serial: '@id' }, { return $resource("api/certs/:serial", { serial: '@id' }, {
'update': {method: 'PUT'}, 'update': {method: 'PUT'},
}) })
}) })
.factory("CACertificate", function($resource) { .factory("CACertificate", function($resource) {
return $resource("/api/ca/:serial", { serial: '@id' }) return $resource("api/ca/:serial", { serial: '@id' })
}) })
.factory("File", function($resource) { .factory("File", function($resource) {
return $resource("/api/files/:fileId", { fileId: '@id' }) return $resource("api/files/:fileId", { fileId: '@id' })
}) })
.factory("ROSettings", function($resource) { .factory("ROSettings", function($resource) {
return $resource("/api/settings-ro.json") return $resource("api/settings-ro.json")
}) })
.factory("Settings", function($resource) { .factory("Settings", function($resource) {
return $resource("/api/settings.json", null, { return $resource("api/settings.json", null, {
'update': {method: 'PUT'}, 'update': {method: 'PUT'},
}) })
}) })
.factory("Scene", function($resource) { .factory("Scene", function($resource) {
return $resource("/api/public/:screenId", { screenId: '@id' }, { return $resource("api/public/:screenId", { screenId: '@id' }, {
'update': {method: 'PUT'}, 'update': {method: 'PUT'},
}) })
}) })
.factory("Team", function($resource) { .factory("Team", function($resource) {
return $resource("/api/teams/:teamId", { teamId: '@id' }, { return $resource("api/teams/:teamId", { teamId: '@id' }, {
'update': {method: 'PUT'}, 'update': {method: 'PUT'},
}) })
}) })
.factory("TeamCertificate", function($resource) { .factory("TeamCertificate", function($resource) {
return $resource("/api/teams/:teamId/certificates", { teamId: '@id' }) return $resource("api/teams/:teamId/certificates", { teamId: '@id' })
}) })
.factory("TeamAssociation", function($resource) { .factory("TeamAssociation", function($resource) {
return $resource("/api/teams/:teamId/associations/:assoc", { teamId: '@teamId', assoc: '@assoc' }) return $resource("api/teams/:teamId/associations/:assoc", { teamId: '@teamId', assoc: '@assoc' })
}) })
.factory("TeamMember", function($resource) { .factory("TeamMember", function($resource) {
return $resource("/api/teams/:teamId/members", { teamId: '@id' }, { return $resource("api/teams/:teamId/members", { teamId: '@id' }, {
'save': {method: 'PUT'}, 'save': {method: 'PUT'},
}) })
}) })
.factory("TeamMy", function($resource) { .factory("TeamMy", function($resource) {
return $resource("/api/teams/:teamId/my.json", { teamId: '@id' }) return $resource("api/teams/:teamId/my.json", { teamId: '@id' })
}) })
.factory("Teams", function($resource) { .factory("Teams", function($resource) {
return $resource("/api/teams.json") return $resource("api/teams.json")
}) })
.factory("TeamHistory", function($resource) { .factory("TeamHistory", function($resource) {
return $resource("/api/teams/:teamId/history.json", { teamId: '@id' }) return $resource("api/teams/:teamId/history.json", { teamId: '@id' })
}) })
.factory("TeamScore", function($resource) { .factory("TeamScore", function($resource) {
return $resource("/api/teams/:teamId/score-grid.json", { teamId: '@id' }) return $resource("api/teams/:teamId/score-grid.json", { teamId: '@id' })
}) })
.factory("TeamStats", function($resource) { .factory("TeamStats", function($resource) {
return $resource("/api/teams/:teamId/stats.json", { teamId: '@id' }) return $resource("api/teams/:teamId/stats.json", { teamId: '@id' })
}) })
.factory("TeamPresence", function($resource) { .factory("TeamPresence", function($resource) {
return $resource("/api/teams/:teamId/tries", { teamId: '@id' }) return $resource("api/teams/:teamId/tries", { teamId: '@id' })
}) })
.factory("Theme", function($resource) { .factory("Theme", function($resource) {
return $resource("/api/themes/:themeId", { themeId: '@id' }, { return $resource("api/themes/:themeId", { themeId: '@id' }, {
update: {method: 'PUT'} update: {method: 'PUT'}
}); });
}) })
.factory("Themes", function($resource) { .factory("Themes", function($resource) {
return $resource("/api/themes.json", null, { return $resource("api/themes.json", null, {
'get': {method: 'GET'}, 'get': {method: 'GET'},
}) })
}) })
.factory("ThemedExercice", function($resource) { .factory("ThemedExercice", function($resource) {
return $resource("/api/themes/:themeId/exercices/:exerciceId", { themeId: '@id', exerciceId: '@idExercice' }, { return $resource("api/themes/:themeId/exercices/:exerciceId", { themeId: '@id', exerciceId: '@idExercice' }, {
update: {method: 'PUT'} update: {method: 'PUT'}
}) })
}) })
.factory("Exercice", function($resource) { .factory("Exercice", function($resource) {
return $resource("/api/exercices/:exerciceId", { exerciceId: '@id' }, { return $resource("api/exercices/:exerciceId", { exerciceId: '@id' }, {
update: {method: 'PUT'}, update: {method: 'PUT'},
patch: {method: 'PATCH'} patch: {method: 'PATCH'}
}) })
}) })
.factory("ExerciceClaims", function($resource) { .factory("ExerciceClaims", function($resource) {
return $resource("/api/exercices/:exerciceId/claims", { exerciceId: '@idExercice'}) return $resource("api/exercices/:exerciceId/claims", { exerciceId: '@idExercice'})
}) })
.factory("ExerciceTags", function($resource) { .factory("ExerciceTags", function($resource) {
return $resource("/api/exercices/:exerciceId/tags", { exerciceId: '@idExercice'}, { return $resource("api/exercices/:exerciceId/tags", { exerciceId: '@idExercice'}, {
update: {method: 'PUT'} update: {method: 'PUT'}
}) })
}) })
.factory("ExerciceHistory", function($resource) { .factory("ExerciceHistory", function($resource) {
return $resource("/api/exercices/:exerciceId/history.json", { exerciceId: '@id' }) return $resource("api/exercices/:exerciceId/history.json", { exerciceId: '@id' })
}) })
.factory("ExercicesStats", function($resource) { .factory("ExercicesStats", function($resource) {
return $resource("/api/themes/:themeId/exercices_stats.json", { themeId: '@id' }) return $resource("api/themes/:themeId/exercices_stats.json", { themeId: '@id' })
}) })
.factory("ExerciceStats", function($resource) { .factory("ExerciceStats", function($resource) {
return $resource("/api/exercices/:exerciceId/stats.json", { exerciceId: '@id' }) return $resource("api/exercices/:exerciceId/stats.json", { exerciceId: '@id' })
}) })
.factory("ExerciceFile", function($resource) { .factory("ExerciceFile", function($resource) {
return $resource("/api/exercices/:exerciceId/files/:fileId", { exerciceId: '@idExercice', fileId: '@id' }, { return $resource("api/exercices/:exerciceId/files/:fileId", { exerciceId: '@idExercice', fileId: '@id' }, {
update: {method: 'PUT'} update: {method: 'PUT'}
}) })
}) })
.factory("ExerciceHint", function($resource) { .factory("ExerciceHint", function($resource) {
return $resource("/api/exercices/:exerciceId/hints/:hintId", { exerciceId: '@idExercice', hintId: '@id' }, { return $resource("api/exercices/:exerciceId/hints/:hintId", { exerciceId: '@idExercice', hintId: '@id' }, {
update: {method: 'PUT'} update: {method: 'PUT'}
}) })
}) })
.factory("ExerciceHintDeps", function($resource) { .factory("ExerciceHintDeps", function($resource) {
return $resource("/api/exercices/:exerciceId/hints/:hintId/dependancies", { exerciceId: '@idExercice', hintId: '@id' }) return $resource("api/exercices/:exerciceId/hints/:hintId/dependancies", { exerciceId: '@idExercice', hintId: '@id' })
}) })
.factory("ExerciceFlag", function($resource) { .factory("ExerciceFlag", function($resource) {
return $resource("/api/exercices/:exerciceId/flags/:flagId", { exerciceId: '@idExercice', flagId: '@id' }, { return $resource("api/exercices/:exerciceId/flags/:flagId", { exerciceId: '@idExercice', flagId: '@id' }, {
update: {method: 'PUT'} update: {method: 'PUT'}
}) })
}) })
.factory("ExerciceFlagChoices", function($resource) { .factory("ExerciceFlagChoices", function($resource) {
return $resource("/api/exercices/:exerciceId/flags/:flagId/choices/:choiceId", { exerciceId: '@idExercice', flagId: '@idFlag', choiceId: '@id' }, { return $resource("api/exercices/:exerciceId/flags/:flagId/choices/:choiceId", { exerciceId: '@idExercice', flagId: '@idFlag', choiceId: '@id' }, {
'update': {method: 'PUT'}, 'update': {method: 'PUT'},
}) })
}) })
.factory("ExerciceFlagDeps", function($resource) { .factory("ExerciceFlagDeps", function($resource) {
return $resource("/api/exercices/:exerciceId/flags/:flagId/dependancies", { exerciceId: '@idExercice', flagId: '@id' }) return $resource("api/exercices/:exerciceId/flags/:flagId/dependancies", { exerciceId: '@idExercice', flagId: '@id' })
}) })
.factory("ExerciceMCQFlag", function($resource) { .factory("ExerciceMCQFlag", function($resource) {
return $resource("/api/exercices/:exerciceId/quiz/:mcqId", { exerciceId: '@idExercice', mcqId: '@id' }, { return $resource("api/exercices/:exerciceId/quiz/:mcqId", { exerciceId: '@idExercice', mcqId: '@id' }, {
update: {method: 'PUT'} update: {method: 'PUT'}
}) })
}) })
.factory("ExerciceMCQDeps", function($resource) { .factory("ExerciceMCQDeps", function($resource) {
return $resource("/api/exercices/:exerciceId/quiz/:mcqId/dependancies", { exerciceId: '@idExercice', mcqId: '@id' }) return $resource("api/exercices/:exerciceId/quiz/:mcqId/dependancies", { exerciceId: '@idExercice', mcqId: '@id' })
}); });
angular.module("FICApp") angular.module("FICApp")
@ -431,7 +431,7 @@ angular.module("FICApp")
.run(function($rootScope, $http, $interval, Settings) { .run(function($rootScope, $http, $interval, Settings) {
function refresh() { function refresh() {
$http.get("/api/settings.json").then(function(response) { $http.get("api/settings.json").then(function(response) {
response.data.start = new Date(response.data.start); response.data.start = new Date(response.data.start);
response.data.end = new Date(response.data.end); response.data.end = new Date(response.data.end);
response.data.generation = new Date(response.data.generation); response.data.generation = new Date(response.data.generation);
@ -517,7 +517,7 @@ angular.module("FICApp")
refreshSyncReport() refreshSyncReport()
var progressInterval = $interval(function() { var progressInterval = $interval(function() {
$http.get("/api/sync/deep").then(function(response) { $http.get("api/sync/deep").then(function(response) {
if (response.data.progress && response.data.progress != 255) if (response.data.progress && response.data.progress != 255)
needRefreshSyncReportWhenReady = true; needRefreshSyncReportWhenReady = true;
else if (needRefreshSyncReportWhenReady) else if (needRefreshSyncReportWhenReady)
@ -586,7 +586,7 @@ angular.module("FICApp")
$scope.addToast('warning', txts[type], 'Êtes-vous sûr de vouloir continuer ?', $scope.addToast('warning', txts[type], 'Êtes-vous sûr de vouloir continuer ?',
function() { function() {
if (confirm("Êtes-vous vraiment sûr ?\n" + txts[type])) { if (confirm("Êtes-vous vraiment sûr ?\n" + txts[type])) {
$http.post("/api/reset", {"type": type}).then(function(time) { $http.post("api/reset", {"type": type}).then(function(time) {
$scope.addToast('success', type + 'reseted'); $scope.addToast('success', type + 'reseted');
$location.url("/"); $location.url("/");
}, function(response) { }, function(response) {
@ -600,10 +600,10 @@ angular.module("FICApp")
$scope.deepSync = function(theme) { $scope.deepSync = function(theme) {
if (theme) { if (theme) {
question = 'Faire une synchronisation intégrale du thème ' + theme.name + ' ?' question = 'Faire une synchronisation intégrale du thème ' + theme.name + ' ?'
url = "/api/sync/deep/" + theme.id url = "api/sync/deep/" + theme.id
} else { } else {
question = 'Faire une synchronisation intégrale ?' question = 'Faire une synchronisation intégrale ?'
url = "/api/sync/deep" url = "api/sync/deep"
} }
$scope.addToast('warning', question, '', $scope.addToast('warning', question, '',
function() { function() {
@ -621,7 +621,7 @@ angular.module("FICApp")
$scope.addToast('warning', 'Faire une synchronisation profonde rapide, sans s\'occuper des fichiers ?', '', $scope.addToast('warning', 'Faire une synchronisation profonde rapide, sans s\'occuper des fichiers ?', '',
function() { function() {
$scope.deepSyncInProgress = true; $scope.deepSyncInProgress = true;
$http.post("/api/sync/speed").then(function() { $http.post("api/sync/speed").then(function() {
$scope.deepSyncInProgress = false; $scope.deepSyncInProgress = false;
$scope.addToast('success', 'Synchronisation profonde rapide terminée.', '<a href="check_import.html">Voir le rapport</a>.', 15000); $scope.addToast('success', 'Synchronisation profonde rapide terminée.', '<a href="check_import.html">Voir le rapport</a>.', 15000);
}, function(response) { }, function(response) {
@ -699,7 +699,7 @@ angular.module("FICApp")
}; };
$scope.generateCA = function() { $scope.generateCA = function() {
$http.post("/api/ca/new", $scope.newca).then(function() { $http.post("api/ca/new", $scope.newca).then(function() {
$scope.ca = CACertificate.get(); $scope.ca = CACertificate.get();
}, function(response) { }, function(response) {
$scope.addToast('danger', 'An error occurs when generating CA:', response.data.errmsg); $scope.addToast('danger', 'An error occurs when generating CA:', response.data.errmsg);
@ -710,21 +710,21 @@ angular.module("FICApp")
}; };
$scope.generateCert = function() { $scope.generateCert = function() {
$http.post("/api/certs").then(function() { $http.post("api/certs").then(function() {
$scope.certificates = Certificate.query(); $scope.certificates = Certificate.query();
}, function(response) { }, function(response) {
$scope.addToast('danger', 'An error occurs when generating certificate:', response.data.errmsg); $scope.addToast('danger', 'An error occurs when generating certificate:', response.data.errmsg);
}); });
}; };
$scope.generateHtpasswd = function() { $scope.generateHtpasswd = function() {
$http.post("/api/htpasswd").then(function() { $http.post("api/htpasswd").then(function() {
$scope.addToast('success', 'Fichier htpasswd généré avec succès'); $scope.addToast('success', 'Fichier htpasswd généré avec succès');
}, function(response) { }, function(response) {
$scope.addToast('danger', 'An error occurs when generating htpasswd file:', response.data.errmsg); $scope.addToast('danger', 'An error occurs when generating htpasswd file:', response.data.errmsg);
}); });
}; };
$scope.removeHtpasswd = function() { $scope.removeHtpasswd = function() {
$http.delete("/api/htpasswd").then(function() { $http.delete("api/htpasswd").then(function() {
$scope.addToast('success', 'Fichier htpasswd supprimé avec succès'); $scope.addToast('success', 'Fichier htpasswd supprimé avec succès');
}, function(response) { }, function(response) {
$scope.addToast('danger', 'An error occurs when deleting htpasswd file:', response.data.errmsg); $scope.addToast('danger', 'An error occurs when deleting htpasswd file:', response.data.errmsg);
@ -1078,7 +1078,7 @@ angular.module("FICApp")
}; };
$scope.checksum = function(f) { $scope.checksum = function(f) {
$http({ $http({
url: "/api/files/" + f.id + "/check", url: "api/files/" + f.id + "/check",
method: "POST" method: "POST"
}).then(function(response) { }).then(function(response) {
f.err = true; f.err = true;
@ -1235,7 +1235,7 @@ angular.module("FICApp")
}) })
.controller("ClaimLastUpdateController", function($scope, $http) { .controller("ClaimLastUpdateController", function($scope, $http) {
$scope.init = function(claim) { $scope.init = function(claim) {
$http.get("/api/claims/" + claim.id + "/last_update").then(function(response) { $http.get("api/claims/" + claim.id + "/last_update").then(function(response) {
if (response.data) if (response.data)
$scope.last_update = response.data; $scope.last_update = response.data;
else else
@ -1301,7 +1301,7 @@ angular.module("FICApp")
} }
$scope.updateDescription = function(description) { $scope.updateDescription = function(description) {
$http({ $http({
url: "/api/claims/" + $scope.claim.id + "/descriptions", url: "api/claims/" + $scope.claim.id + "/descriptions",
method: "PUT", method: "PUT",
data: description data: description
}).then(function(response) { }).then(function(response) {
@ -1314,7 +1314,7 @@ angular.module("FICApp")
} }
$scope.saveDescription = function() { $scope.saveDescription = function() {
$http({ $http({
url: "/api/claims/" + $scope.claim.id, url: "api/claims/" + $scope.claim.id,
method: "POST", method: "POST",
data: { data: {
"id_assignee": $scope.whoami, "id_assignee": $scope.whoami,
@ -1387,7 +1387,7 @@ angular.module("FICApp")
$scope.sync = function() { $scope.sync = function() {
$scope.inSync = true; $scope.inSync = true;
$http({ $http({
url: "/api/sync/themes", url: "api/sync/themes",
method: "POST" method: "POST"
}).then(function(response) { }).then(function(response) {
$scope.inSync = false; $scope.inSync = false;
@ -1429,7 +1429,7 @@ angular.module("FICApp")
.controller("AllExercicesListController", function($scope, Exercice, Theme, $routeParams, $location, $rootScope, $http, $filter) { .controller("AllExercicesListController", function($scope, Exercice, Theme, $routeParams, $location, $rootScope, $http, $filter) {
$http({ $http({
url: "/api/themes.json", url: "api/themes.json",
method: "GET" method: "GET"
}).then(function(response) { }).then(function(response) {
$scope.themes = response.data $scope.themes = response.data
@ -1504,11 +1504,11 @@ angular.module("FICApp")
angular.forEach($scope.exercices, function(ex) { angular.forEach($scope.exercices, function(ex) {
if ($scope.syncFiles) if ($scope.syncFiles)
work.push("/api/sync/exercices/" + ex.id + "/files"); work.push("api/sync/exercices/" + ex.id + "/files");
if ($scope.syncHints) if ($scope.syncHints)
work.push("/api/sync/exercices/" + ex.id + "/hints"); work.push("api/sync/exercices/" + ex.id + "/hints");
if ($scope.syncFlags) if ($scope.syncFlags)
work.push("/api/sync/exercices/" + ex.id + "/flags"); work.push("api/sync/exercices/" + ex.id + "/flags");
}); });
$scope.total = work.length; $scope.total = work.length;
go(); go();
@ -1530,7 +1530,7 @@ angular.module("FICApp")
$scope.syncExo = function() { $scope.syncExo = function() {
$scope.inSync = true; $scope.inSync = true;
$http({ $http({
url: "/api/sync/themes/" + $scope.theme.id + "/exercices", url: "api/sync/themes/" + $scope.theme.id + "/exercices",
method: "POST" method: "POST"
}).then(function(response) { }).then(function(response) {
$scope.inSync = false; $scope.inSync = false;
@ -1553,7 +1553,7 @@ angular.module("FICApp")
$scope.exercice = Exercice.get({ exerciceId: $routeParams.exerciceId }); $scope.exercice = Exercice.get({ exerciceId: $routeParams.exerciceId });
} }
$http({ $http({
url: "/api/themes.json", url: "api/themes.json",
method: "GET" method: "GET"
}).then(function(response) { }).then(function(response) {
$scope.themes = response.data $scope.themes = response.data
@ -1574,7 +1574,7 @@ angular.module("FICApp")
$scope.syncExo = function() { $scope.syncExo = function() {
$scope.inSync = true; $scope.inSync = true;
$http({ $http({
url: "/api/sync/themes/" + $scope.exercice.id_theme + "/exercices/" + $routeParams.exerciceId, url: "api/sync/themes/" + $scope.exercice.id_theme + "/exercices/" + $routeParams.exerciceId,
method: "POST" method: "POST"
}).then(function(response) { }).then(function(response) {
$scope.inSync = false; $scope.inSync = false;
@ -1666,7 +1666,7 @@ angular.module("FICApp")
}; };
if (target) { if (target) {
$http({ $http({
url: "/api/exercices/" + $routeParams.exerciceId + "/history.json", url: "api/exercices/" + $routeParams.exerciceId + "/history.json",
method: "PATCH", method: "PATCH",
data: target data: target
}).then(function(response) { }).then(function(response) {
@ -1680,7 +1680,7 @@ angular.module("FICApp")
} }
$scope.delHistory = function(row) { $scope.delHistory = function(row) {
$http({ $http({
url: "/api/exercices/" + $routeParams.exerciceId + "/history.json", url: "api/exercices/" + $routeParams.exerciceId + "/history.json",
method: "DELETE", method: "DELETE",
data: row data: row
}).then(function(response) { }).then(function(response) {
@ -1704,7 +1704,7 @@ angular.module("FICApp")
} }
$scope.deleteFileDep = function() { $scope.deleteFileDep = function() {
$http({ $http({
url: "/api//files/" + this.file.id + "/dependancies/" + this.dep.id, url: "api//files/" + this.file.id + "/dependancies/" + this.dep.id,
method: "DELETE" method: "DELETE"
}).then(function(response) { }).then(function(response) {
$scope.files = ExerciceFile.query({ exerciceId: $routeParams.exerciceId }); $scope.files = ExerciceFile.query({ exerciceId: $routeParams.exerciceId });
@ -1722,7 +1722,7 @@ angular.module("FICApp")
$scope.syncFiles = function() { $scope.syncFiles = function() {
$scope.inSync = true; $scope.inSync = true;
$http({ $http({
url: "/api/sync/exercices/" + $routeParams.exerciceId + "/files", url: "api/sync/exercices/" + $routeParams.exerciceId + "/files",
method: "POST" method: "POST"
}).then(function(response) { }).then(function(response) {
$scope.inSync = false; $scope.inSync = false;
@ -1765,7 +1765,7 @@ angular.module("FICApp")
$scope.syncHints = function() { $scope.syncHints = function() {
$scope.inSync = true; $scope.inSync = true;
$http({ $http({
url: "/api/sync/exercices/" + $routeParams.exerciceId + "/hints", url: "api/sync/exercices/" + $routeParams.exerciceId + "/hints",
method: "POST" method: "POST"
}).then(function(response) { }).then(function(response) {
$scope.inSync = false; $scope.inSync = false;
@ -1830,7 +1830,7 @@ angular.module("FICApp")
if (flag.test_str) { if (flag.test_str) {
$http({ $http({
url: "/api/exercices/" + $routeParams.exerciceId + "/flags/" + flag.id + "/try", url: "api/exercices/" + $routeParams.exerciceId + "/flags/" + flag.id + "/try",
data: {"flag": flag.test_str}, data: {"flag": flag.test_str},
method: "POST" method: "POST"
}).then(function(response) { }).then(function(response) {
@ -1846,7 +1846,7 @@ angular.module("FICApp")
$scope.syncFlags = function() { $scope.syncFlags = function() {
$scope.inSync = true; $scope.inSync = true;
$http({ $http({
url: "/api/sync/exercices/" + $routeParams.exerciceId + "/flags", url: "api/sync/exercices/" + $routeParams.exerciceId + "/flags",
method: "POST" method: "POST"
}).then(function(response) { }).then(function(response) {
$scope.inSync = false; $scope.inSync = false;
@ -1962,7 +1962,7 @@ angular.module("FICApp")
}; };
$scope.desactiveTeams = function() { $scope.desactiveTeams = function() {
$http.post("/api/disableinactiveteams").then(function() { $http.post("api/disableinactiveteams").then(function() {
$scope.teams = Team.query(); $scope.teams = Team.query();
}, function(response) { }, function(response) {
$scope.addToast('danger', 'An error occurs when disabling inactive teams:', response.data.errmsg); $scope.addToast('danger', 'An error occurs when disabling inactive teams:', response.data.errmsg);
@ -2032,7 +2032,7 @@ angular.module("FICApp")
$scope.dissociateCertificate = function(certificate) { $scope.dissociateCertificate = function(certificate) {
$http({ $http({
url: "/api/certs/" + certificate.id, url: "api/certs/" + certificate.id,
method: "PUT", method: "PUT",
data: { data: {
id_team: null id_team: null
@ -2087,7 +2087,7 @@ angular.module("FICApp")
}; };
if (target) { if (target) {
$http({ $http({
url: "/api/exercices/" + $("#updHistory").data("primary") + "/history.json", url: "api/exercices/" + $("#updHistory").data("primary") + "/history.json",
method: "PATCH", method: "PATCH",
data: target data: target
}).then(function(response) { }).then(function(response) {
@ -2101,7 +2101,7 @@ angular.module("FICApp")
} }
$scope.delHistory = function(row) { $scope.delHistory = function(row) {
$http({ $http({
url: "/api/teams/" + $routeParams.teamId + "/history.json", url: "api/teams/" + $routeParams.teamId + "/history.json",
method: "DELETE", method: "DELETE",
data: row data: row
}).then(function(response) { }).then(function(response) {

View File

@ -1 +1 @@
../../frontend/static/fonts/ ../../admin/static/fonts/

View File

@ -535,8 +535,8 @@
<div class="carousel-inner" style="height: inherit"> <div class="carousel-inner" style="height: inherit">
<div class="carousel-item"> <div class="carousel-item">
<div class="carousel-caption" style="display: table; width: 100%"> <div class="carousel-caption" style="display: table; width: 100%">
<a href="http://www.epita.fr/" class="align-middle text-center" style="display: table-cell; width: 55%"><img src="/img/epita.png" alt="Epita" style="height:100px"></a> <a href="http://www.epita.fr/" class="align-middle text-center" style="display: table-cell; width: 55%"><img src="img/epita.png" alt="Epita" style="height:100px"></a>
<a href="http://www.epita.fr/" class="align-middle text-center" style="display: table-cell; width: 45%"><img src="/img/comcyber.png" alt="Réserves de cyberdéfense" style="height:100px"></a> <a href="http://www.epita.fr/" class="align-middle text-center" style="display: table-cell; width: 45%"><img src="img/comcyber.png" alt="Réserves de cyberdéfense" style="height:100px"></a>
</div> </div>
</div> </div>
<div class="carousel-item"> <div class="carousel-item">
@ -563,7 +563,7 @@
<div class="carousel-item active"> <div class="carousel-item active">
<div class="carousel-caption" style="padding: 5px; display: table;"> <div class="carousel-caption" style="padding: 5px; display: table;">
<div class="align-middle" style="display: table-cell; width: 30%"> <div class="align-middle" style="display: table-cell; width: 30%">
<a href="https://srs.epita.fr/"><img src="/img/srs.png" alt="Laboratoire SRS" style="max-width:100%; max-height:90px"></a> <a href="https://srs.epita.fr/"><img src="img/srs.png" alt="Laboratoire SRS" style="max-width:100%; max-height:90px"></a>
</div> </div>
<p class="text-bold align-middle" style="font-size: 110%; display: table-cell; width: 70%;"> <p class="text-bold align-middle" style="font-size: 110%; display: table-cell; width: 70%;">
Les challenges ont été réalisés par les étudiants de la Les challenges ont été réalisés par les étudiants de la
@ -577,7 +577,7 @@
Avec le parrainage du commandement de la cyberdéfense Avec le parrainage du commandement de la cyberdéfense
</p> </p>
<div class="align-middle" style="display: table-cell; width: 30%"> <div class="align-middle" style="display: table-cell; width: 30%">
<img src="/img/comcyber.png" alt="Réserves de cyberdéfense" style="max-width:100%; max-height: 80px"> <img src="img/comcyber.png" alt="Réserves de cyberdéfense" style="max-width:100%; max-height: 80px">
</div> </div>
</div> </div>
</div> </div>

View File

@ -12,7 +12,7 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
ev.since = now - ev.time; ev.since = now - ev.time;
}); });
$http.get("/events.json").then(function(response) { $http.get("../events.json").then(function(response) {
// Don't make anything if the page hasn't changed // Don't make anything if the page hasn't changed
if ($scope.lasteventsetag != undefined && $scope.lasteventsetag == response.headers()["last-modified"]) if ($scope.lasteventsetag != undefined && $scope.lasteventsetag == response.headers()["last-modified"])
return; return;
@ -90,7 +90,7 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
var refreshSceneInterval = $interval(refreshScene, 900); var refreshSceneInterval = $interval(refreshScene, 900);
var refreshSettings = function() { var refreshSettings = function() {
$http.get("/settings.json").then(function(response) { $http.get("../settings.json").then(function(response) {
$rootScope.recvTime(response); $rootScope.recvTime(response);
response.data.start = new Date(response.data.start); response.data.start = new Date(response.data.start);
response.data.end = new Date(response.data.end); response.data.end = new Date(response.data.end);
@ -104,14 +104,14 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
$rootScope.refresh = function() { $rootScope.refresh = function() {
$http.get("/my.json").then(function(response) { $http.get("../my.json").then(function(response) {
if ($scope.lastmyetag != undefined && $scope.lastmyetag == response.headers()["last-modified"]) if ($scope.lastmyetag != undefined && $scope.lastmyetag == response.headers()["last-modified"])
return; return;
$scope.lastmyetag = response.headers()["last-modified"]; $scope.lastmyetag = response.headers()["last-modified"];
$scope.my = response.data; $scope.my = response.data;
}); });
$http.get("/settings.json").then(function(response) { $http.get("../settings.json").then(function(response) {
$rootScope.recvTime(response); $rootScope.recvTime(response);
response.data.start = new Date(response.data.start); response.data.start = new Date(response.data.start);
response.data.end = new Date(response.data.end); response.data.end = new Date(response.data.end);
@ -119,7 +119,7 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
response.data.awards = new Date("2019-01-23T15:00:00Z"); response.data.awards = new Date("2019-01-23T15:00:00Z");
$rootScope.settings = response.data; $rootScope.settings = response.data;
}); });
$http.get("/themes.json").then(function(response) { $http.get("../themes.json").then(function(response) {
if ($scope.lastthemeetag != undefined && $scope.lastthemeetag == response.headers()["last-modified"]) if ($scope.lastthemeetag != undefined && $scope.lastthemeetag == response.headers()["last-modified"])
return; return;
$scope.lastthemeetag = response.headers()["last-modified"]; $scope.lastthemeetag = response.headers()["last-modified"];
@ -139,7 +139,7 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
$scope.max_gain += theme.gain; $scope.max_gain += theme.gain;
}, themes); }, themes);
}); });
$http.get("/teams.json").then(function(response) { $http.get("../teams.json").then(function(response) {
if ($scope.lastteametag != undefined && $scope.lastteametag == response.headers()["last-modified"]) if ($scope.lastteametag != undefined && $scope.lastteametag == response.headers()["last-modified"])
return; return;
$scope.lastteametag = response.headers()["last-modified"]; $scope.lastteametag = response.headers()["last-modified"];
@ -165,7 +165,7 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
}) })
.controller("TeamController", function($scope, $http, $interval) { .controller("TeamController", function($scope, $http, $interval) {
$scope.mystats = null; $scope.mystats = null;
$http.get("/api/teams/" + $scope.team.id + "/stats.json").then(function(response) { $http.get("../api/teams/" + $scope.team.id + "/stats.json").then(function(response) {
$scope.mystats = response.data; $scope.mystats = response.data;
}); });
}) })
@ -191,7 +191,7 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
$scope.s.params.teams.forEach(function (teamid) { $scope.s.params.teams.forEach(function (teamid) {
var deferred = $q.defer(); var deferred = $q.defer();
loopPromises.push(deferred.promise); loopPromises.push(deferred.promise);
d3.json("api/teams/" + teamid + "/score-grid.json", function (rows) { d3.json("../api/teams/" + teamid + "/score-grid.json", function (rows) {
if (rows == null) return; if (rows == null) return;
rows.sort(function (a,b) { return a.time > b.time ? 1 : -1 }) rows.sort(function (a,b) { return a.time > b.time ? 1 : -1 })
var nrows = {}; var nrows = {};