frontend: rely on angular base path

This commit is contained in:
nemunaire 2019-02-04 17:38:12 +01:00
parent a35aa7be70
commit 921644deb4
5 changed files with 32 additions and 32 deletions

View File

@ -170,7 +170,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$interval.cancel(refreshSettingsInterval);
refreshSettingsInterval = $interval(refreshSettings, Math.floor(Math.random() * 24000) + 32000);
$http.get("/settings.json").then(function(response) {
$http.get("settings.json").then(function(response) {
var time = $rootScope.recvTime(response);
response.data.start = new Date(response.data.start);
response.data.end = new Date(response.data.end);
@ -197,7 +197,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$interval.cancel(refreshThemesInterval);
refreshThemesInterval = $interval(refreshThemes, Math.floor(Math.random() * 24000) + 32000);
$http.get("/themes.json").then(function(response) {
$http.get("themes.json").then(function(response) {
$scope.themes = response.data;
$scope.max_gain = 0;
$scope.max_solved = 0;
@ -228,7 +228,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$interval.cancel(refreshTeamsInterval);
refreshTeamsInterval = $interval($rootScope.refreshTeams, Math.floor(Math.random() * 24000) + 32000);
$http.get("/teams.json").then(function(response) {
$http.get("teams.json").then(function(response) {
var teams = response.data;
$scope.teams_count = Object.keys(teams).length
$scope.teams = teams;
@ -260,7 +260,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
return;
}
$http.get("/events.json").then(function(response) {
$http.get("events.json").then(function(response) {
if (eventsLastRefresh != undefined && eventsLastRefresh == response.headers()["last-modified"])
return;
eventsLastRefresh = response.headers()["last-modified"];
@ -301,7 +301,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
if ((kind & $rootScope.notify_field) == kind) {
var notification = new Notification("Challenge forensic", {body: event.txt.replace(/&#(\d+);/g, function(match, dec) {return String.fromCharCode(dec);}).replace(/(<([^>]+)>)/ig,""), badge: "/img/icon-" + event.kind + ".ico", icon: "/img/icon-" + event.kind + ".ico"});
notification.onclick = function(ev) {
$location.url("/edit");
$location.url("edit");
};
setTimeout(notification.close.bind(notification), 4000);
}
@ -318,11 +318,11 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$interval.cancel(refreshMyInterval);
refreshMyInterval = $interval(refreshMy, Math.floor(Math.random() * 24000) + 24000);
$http.get("/my.json").then(function(response) {
$http.get("my.json").then(function(response) {
$rootScope.recvMy(response.data);
}, function(response) {
if (!$scope.my && response.status == 404) {
$location.url("/register");
$location.url("register");
}
});
}
@ -458,9 +458,9 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$scope.hsubmit = function(hint) {
hint.submitted = true;
$scope.hinterror = null;
$http({ url: "/openhint/" + $rootScope.current_exercice, method: "POST", data: { id: hint.id } }).then(function(response) {
$http({ url: "openhint/" + $rootScope.current_exercice, method: "POST", data: { id: hint.id } }).then(function(response) {
var checkDiffHint = function() {
$http.get("/my.json").then(function(response) {
$http.get("my.json").then(function(response) {
var my = response.data;
angular.forEach(my.exercices[$rootScope.current_exercice].hints, function(h,hid){
if (hint.id == h.id) {
@ -554,7 +554,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
return;
}
$http({ url: "/submit/" + $rootScope.current_exercice, method: "POST", data: resp }).then(function(response) {
$http({ url: "submit/" + $rootScope.current_exercice, method: "POST", data: resp }).then(function(response) {
$scope.messageClass = {"text-success": true};
$scope.message = response.data.errmsg;
$scope.sberr = null;
@ -564,7 +564,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
});
var checkDiff = function() {
$http.get("/my.json").then(function(response) {
$http.get("my.json").then(function(response) {
var my = response.data;
if ($scope.my.exercices[$rootScope.current_exercice].tries != my.exercices[$rootScope.current_exercice].tries || $scope.my.exercices[$rootScope.current_exercice].solved_time != my.exercices[$rootScope.current_exercice].solved_time) {
$scope.my.exercices[$rootScope.current_exercice].submitted = false;
@ -592,9 +592,9 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$scope.wantchoices = function(kid) {
$scope.my.exercices[$rootScope.current_exercice].flags[kid].wcsubmitted = true;
$http({ url: "/wantchoices/" + $rootScope.current_exercice, method: "POST", data: { id: Math.floor(kid) } }).then(function(response) {
$http({ url: "wantchoices/" + $rootScope.current_exercice, method: "POST", data: { id: Math.floor(kid) } }).then(function(response) {
var checkDiffWC = function() {
$http.get("/my.json").then(function(response) {
$http.get("my.json").then(function(response) {
var my = response.data;
if (my.exercices[$rootScope.current_exercice].flags[kid].choices)
$rootScope.recvMy(my);
@ -650,7 +650,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
localStorage.notification = $rootScope.notify_field;
else
delete localStorage.notification;
$location.url("/");
$location.url(".");
}
var cbt;
@ -674,7 +674,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
}
$http({
url: "/submit/name",
url: "submit/name",
method: "POST",
data: {newName: $scope.my.newName}
}).then(function(response) {
@ -682,7 +682,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$rootScope.message = response.data.errmsg;
var checkDiff = function() {
$http.get("/my.json").then(function(response) {
$http.get("my.json").then(function(response) {
if ($scope.my.name != response.data.name) {
$scope.my.newName = undefined;
$rootScope.message = "";
@ -749,7 +749,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
}
$http({
url: "/registration",
url: "registration",
method: "POST",
data: $scope.form
}).then(function(response) {
@ -757,7 +757,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$scope.message = response.data.errmsg;
$interval(function(){
$http.get("/my.json").then(function(response) {
$http.get("my.json").then(function(response) {
$rootScope.refresh();
});
}, 1500);
@ -773,7 +773,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$scope.$watch("my", function(my){
if (my)
$location.url("/");
$location.url(".");
});
})
.controller("TagController", function($scope, $rootScope, $routeParams, $location) {
@ -797,7 +797,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
})
$scope.goDefi = function() {
$location.url("/" + this.ex.theme.urlid + "/" + this.ex.exercice.urlid);
$location.url(this.ex.theme.urlid + "/" + this.ex.exercice.urlid);
}
})
@ -835,7 +835,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$rootScope.authors = "";
$scope.goTheme = function() {
$location.url("/" + this.theme.urlid);
$location.url(this.theme.urlid);
}
});

View File

@ -2,7 +2,7 @@
<ol class="breadcrumb">
<li ng-repeat="(k,exercice) in themes[current_theme].exercices" class="breadcrumb-item" ng-class="{active: k == current_exercice, disabled: !my.exercices[k]}">
<a ng-if="(k != current_exercice && !my.exercices[k])">{{ exercice.title }}</a>
<a ng-href="/{{ themes[current_theme].urlid }}/{{ themes[current_theme].exercices[k].urlid }}" ng-if="(k != current_exercice && my.exercices[k])" ng-class="{'text-success': my.exercices[k].solved}">
<a ng-href="{{ themes[current_theme].urlid }}/{{ themes[current_theme].exercices[k].urlid }}" ng-if="(k != current_exercice && my.exercices[k])" ng-class="{'text-success': my.exercices[k].solved}">
{{ exercice.title }}
<span class="glyphicon glyphicon-gift" aria-hidden="true" ng-if="themes[current_theme].exercices[k].curcoeff > 1.0"></span>
<span class="glyphicon glyphicon-ok text-success" aria-hidden="true" ng-if="(my.team_id && my.exercices[k].solved)"></span>
@ -25,7 +25,7 @@
</div>
<div class="jumbotron niceborder text-indent mt-3" ng-if="(my.exercices[current_exercice])">
<h3 class="display-4">{{ themes[current_theme].exercices[current_exercice].title }}</h3>
<a ng-href="/tags/{{tag}}" class="badge badge-pill badge-secondary mr-2 mb-2" ng-repeat="tag in themes[current_theme].exercices[current_exercice].tags">#{{ tag }}</a>
<a ng-href="tags/{{tag}}" class="badge badge-pill badge-secondary mr-2 mb-2" ng-repeat="tag in themes[current_theme].exercices[current_exercice].tags">#{{ tag }}</a>
<p class="lead text-justify" ng-bind-html="my.exercices[current_exercice].statement"></p>
<div class="alert alert-{{my.exercices[current_exercice].issuekind}}" ng-if="my.exercices[current_exercice].issue" ng-bind-html="my.exercices[current_exercice].issue"></div>
<hr class="my-3">
@ -129,7 +129,7 @@
<hr ng-if="my.exercices[current_exercice].finished">
<p class="card-text" ng-if="my.exercices[current_exercice].finished" ng-bind-html="my.exercices[current_exercice].finished"></p>
<hr ng-if="my.exercices[current_exercice].finished && themes[current_theme].exercices[current_exercice].next">
<a href="/{{ themes[current_theme].urlid }}/{{ themes[current_theme].exercices[themes[current_theme].exercices[current_exercice].next].urlid }}" class="btn btn-success" ng-if="themes[current_theme].exercices[current_exercice].next">Passer au défi suivant</a>
<a href="{{ themes[current_theme].urlid }}/{{ themes[current_theme].exercices[themes[current_theme].exercices[current_exercice].next].urlid }}" class="btn btn-success" ng-if="themes[current_theme].exercices[current_exercice].next">Passer au défi suivant</a>
</div>
</div>

View File

@ -2,13 +2,13 @@
<strong>Attention&nbsp;:</strong> puisqu'il s'agit de captures effectuées dans le but de découvrir si des actes malveillants ont été commis sur différents systèmes d'information, les contenus qui sont téléchargeables <em>peuvent</em> contenir du contenu malveillant&nbsp;!
</div>
<div class="alert text-justify" ng-if="(my.team_id)" style="background-color: #4eaee6;">
<strong>Félicitations <span ng-repeat="member in my.members"><span ng-if="$last && !$first"> et </span><span ng-if="$middle">, </span>{{ member.firstname | capitalize }} {{ member.lastname | capitalize }}</span> !</strong> vous êtes maintenant connecté à l'espace de votre équipe <em>{{ teams[my.team_id].name }}</em>. Vous pouvez changer ce nom dès maintenant en vous rendant sur la page de <a href="/edit">votre équipe</a>.
<strong>Félicitations <span ng-repeat="member in my.members"><span ng-if="$last && !$first"> et </span><span ng-if="$middle">, </span>{{ member.firstname | capitalize }} {{ member.lastname | capitalize }}</span> !</strong> vous êtes maintenant connecté à l'espace de votre équipe <em>{{ teams[my.team_id].name }}</em>. Vous pouvez changer ce nom dès maintenant en vous rendant sur la page de <a href="edit">votre équipe</a>.
</div>
<div class="alert alert-warning text-justify" ng-if="(my.team_id && !my.members.length)">
<strong>Les membres de votre équipes ne sont pas encore enregistrés.</strong> Passez voir l'équipe serveur pour corriger cela.
</div>
<div class="alert alert-warning text-justify" ng-if="!my && settings.allowRegistration">
<strong>Votre équipe n'est pas encore enregistrée.</strong> Rendez-vous sur <a href="/register">cette page</a> pour procéder à votre inscription.
<strong>Votre équipe n'est pas encore enregistrée.</strong> Rendez-vous sur <a href="register">cette page</a> pour procéder à votre inscription.
</div>
<div class="alert alert-danger text-justify" ng-if="!my && !settings.allowRegistration">
<strong>Il semblerait qu'il y ait eu un problème lors de l'attribution de votre certificat.</strong> Veuillez vous signaler auprès de notre équipe afin de corriger ce problème.
@ -19,7 +19,7 @@
<div class="card-img-top theme-card" ng-show="theme.image" style="background-image: url({{ theme.image }})"></div>
<div class="card-body text-indent">
<h5 class="card-title">
<a ng-href="/{{ theme.urlid }}">{{ theme.name }}</a>
<a ng-href="{{ theme.urlid }}">{{ theme.name }}</a>
</h5>
<p class="card-text text-justify" ng-bind-html="theme.headline"></p>
</div>

View File

@ -3,12 +3,12 @@
<div class="card-img-top theme-card" ng-show="ex.theme.image" style="background-image: url({{ ex.theme.image }})"></div>
<div class="card-body">
<h6 class="card-title">
<a ng-href="/{{ex.theme.urlid}}">{{ex.theme.name}}</a> &gt;
<a ng-href="/{{ex.theme.urlid}}/{{ex.exercice.urlid}}">{{ex.exercice.title}}</a>
<a ng-href="{{ex.theme.urlid}}">{{ex.theme.name}}</a> &gt;
<a ng-href="{{ex.theme.urlid}}/{{ex.exercice.urlid}}">{{ex.exercice.title}}</a>
<span class="glyphicon glyphicon-gift" aria-hidden="true" ng-if="ex.exercice.curcoeff > 1.0" title="Un bonus est actuellement appliqué lors de la résolution de ce défi"></span>
</h6>
<div class="clearfix mb-2">
<a ng-href="/tags/{{tag}}" class="badge badge-pill badge-secondary mr-2 float-right" ng-repeat="tag in themes[ex.tid].exercices[ex.eid].tags">#{{ tag }}</a>
<a ng-href="tags/{{tag}}" class="badge badge-pill badge-secondary mr-2 float-right" ng-repeat="tag in themes[ex.tid].exercices[ex.eid].tags">#{{ tag }}</a>
</div>
<p class="card-text text-justify text-indent" ng-bind-html="ex.exercice.headline"></p>
</div>

View File

@ -7,14 +7,14 @@
<div class="card niceborder" ng-repeat="(k,exercice) in themes[current_theme].exercices">
<div class="card-body">
<h5 class="card-title clearfix">
<a ng-href="/{{ themes[current_theme].urlid }}/{{ themes[current_theme].exercices[k].urlid }}" ng-if="my.exercices[k]">
<a ng-href="{{ themes[current_theme].urlid }}/{{ themes[current_theme].exercices[k].urlid }}" ng-if="my.exercices[k]">
{{ exercice.title }}
</a>
<span ng-if="!my.exercices[k]">
<span class="glyphicon glyphicon-lock" aria-hidden="true" title="Vous n'avez pas encore accès à ce défi"></span>
{{ exercice.title }}
</span>
<a ng-href="/tags/{{tag}}" class="badge badge-pill badge-secondary ml-1 float-right" ng-repeat="tag in themes[current_theme].exercices[k].tags">#{{tag}}</a>
<a ng-href="tags/{{tag}}" class="badge badge-pill badge-secondary ml-1 float-right" ng-repeat="tag in themes[current_theme].exercices[k].tags">#{{tag}}</a>
<span class="glyphicon glyphicon-ok" aria-hidden="true" ng-if="(my.team_id && my.exercices[k].solved)"></span>
<span class="glyphicon glyphicon-gift" aria-hidden="true" ng-if="themes[current_theme].exercices[k].curcoeff > 1.0" title="Un bonus est actuellement appliqué lors de la résolution de ce défi"></span>
</h5>