Compare commits

...

5 commits

5 changed files with 19 additions and 9 deletions

View file

@ -8,7 +8,6 @@ import (
"net/http"
"os"
"path"
"strings"
"text/template"
"unicode"
@ -242,7 +241,7 @@ func genDexConfig() ([]byte, error) {
logoPath := ""
if len(challengeInfo.MainLogo) > 0 {
logoPath = strings.Replace(challengeInfo.MainLogo[len(challengeInfo.MainLogo)-1], "$FILES$", fic.FilesDir, -1)
logoPath = path.Join("../../files", "logo", path.Base(challengeInfo.MainLogo[len(challengeInfo.MainLogo)-1]))
}
dexTmpl, err := template.New("dexcfg").Parse(dexcfgtpl)
@ -286,6 +285,11 @@ func genDexConfig() ([]byte, error) {
}
func genDexPasswordTpl() ([]byte, error) {
challengeInfo, err := GetChallengeInfo()
if err != nil {
return nil, fmt.Errorf("Cannot create template: %w", err)
}
if teams, err := fic.GetTeams(); err != nil {
return nil, err
} else {
@ -295,6 +299,7 @@ func genDexPasswordTpl() ([]byte, error) {
return nil, fmt.Errorf("Cannot create template: %w", err)
} else if err = dexTmpl.Execute(b, dexConfig{
Teams: teams,
Name: challengeInfo.Title,
}); err != nil {
return nil, fmt.Errorf("An error occurs during template execution: %w", err)
} else {

View file

@ -958,12 +958,13 @@ angular.module("FICApp")
})
.controller("OAuthController", function ($scope, $http) {
$scope.oauth_status = {};
$scope.refreshOAuthStatus = function () {
$http.get("api/oauth-status").then(function (res) {
$scope.oauth_status = response.data;
$scope.oauth_status = res.data;
});
};
$scope.refreshOAuthStatus();
$scope.genDexCfg = function () {
$http.post("api/dex.yaml").then(function () {

View file

@ -58,7 +58,6 @@
</button>
<div class="dropdown-menu" ng-controller="ThemesListController" style="max-height: 45vh; overflow: auto">
<a class="dropdown-item" ng-click="deepSync(theme)" ng-repeat="theme in themes" ng-bind="theme.name"></a>
<a class="dropdown-item" ng-click="deepSync({name: 'Exercices indépendants', id: 0})">Exercices indépendants</a>
</div>
</div>
<button type="button" class="btn btn-secondary" ng-click="speedyDeepSync()" ng-disabled="deepSyncInProgress"><span class="glyphicon glyphicon-import" aria-hidden="true"></span> Synchronisation sans fichiers</button>

View file

@ -363,7 +363,7 @@ func SyncExerciceFiles(i Importer, exercice *fic.Exercice, exceptions *CheckExce
var f interface{}
if pf, exists := paramsFiles[fname]; exists && pf.URL != "" {
if pf, exists := paramsFiles[fname]; exists && pf.URL != "" && !i.Exists(path.Join(exercice.Path, "files", fname)) {
dest := GetDestinationFilePath(pf.URL, &pf.Filename)
if _, err := os.Stat(dest); !os.IsNotExist(err) {

View file

@ -39,16 +39,21 @@
submissions.update((u) => {
for (const k in last_submission.flags) {
u.flags[k] = last_submission.flags[k];
if (last_submission.flags[k])
u.flags[k] = last_submission.flags[k];
}
for (const k in last_submission.mcqs) {
u.mcqs[k] = last_submission.mcqs[k];
if (last_submission.mcqs[k])
u.mcqs[k] = last_submission.mcqs[k];
}
for (const k in last_submission.justifications) {
u.justifications[k] = last_submission.justifications[k];
if (last_submission.justifications[k])
u.justifications[k] = last_submission.justifications[k];
}
return u;
})
if ($my && $my.team_id === 0) {