Display a badge to inform about case sensitivity (can be disabled by setting)

This commit is contained in:
nemunaire 2023-11-05 10:59:10 +01:00
parent f6b94b33e5
commit 20272e7bad
6 changed files with 32 additions and 3 deletions

View File

@ -316,6 +316,7 @@ func ApplySettings(config *settings.Settings) {
fic.UnlockedChallengeDepth = config.UnlockedChallengeDepth fic.UnlockedChallengeDepth = config.UnlockedChallengeDepth
fic.UnlockedChallengeUpTo = config.UnlockedChallengeUpTo fic.UnlockedChallengeUpTo = config.UnlockedChallengeUpTo
fic.DisplayAllFlags = config.DisplayAllFlags fic.DisplayAllFlags = config.DisplayAllFlags
fic.HideCaseSensitivity = config.HideCaseSensitivity
fic.DisplayMCQBadCount = config.DisplayMCQBadCount fic.DisplayMCQBadCount = config.DisplayMCQBadCount
fic.FirstBlood = config.FirstBlood fic.FirstBlood = config.FirstBlood
fic.SubmissionCostBase = config.SubmissionCostBase fic.SubmissionCostBase = config.SubmissionCostBase

View File

@ -225,6 +225,13 @@
</label> </label>
</div> </div>
<div class="form-check">
<label class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" ng-model="config.hideCaseSensitivity">
<span class="custom-control-label" ng-class="{'text-primary font-weight-bold': !config.hideCaseSensitivity != !dist_config.hideCaseSensitivity}">Ne pas informer sur la sensibilité à la casse des flags</span>
</label>
</div>
<div class="form-check"> <div class="form-check">
<label class="custom-control custom-checkbox"> <label class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" ng-model="config.submissionUniqueness"> <input class="custom-control-input" type="checkbox" ng-model="config.submissionUniqueness">

View File

@ -1,5 +1,6 @@
<script> <script>
import { import {
Badge,
Button, Button,
Icon, Icon,
Spinner, Spinner,
@ -115,6 +116,15 @@
{#if flag.found && flag.value} {#if flag.found && flag.value}
<span>{flag.value}</span> <span>{flag.value}</span>
{/if} {/if}
{#if !flag.found && !$settings.hideCaseSensitivity && !flag.ignore_case}
<Badge
class="float-end"
color="danger"
title="Ce flag est sensible à la casse!"
>
aA
</Badge>
{/if}
{#if !flag.found} {#if !flag.found}
{#each values as v, index} {#each values as v, index}
{#if !flag.choices} {#if !flag.choices}

View File

@ -30,7 +30,7 @@ func reloadSettings(config *settings.Settings) {
fic.WChoiceCoefficient = config.WChoiceCurCoefficient fic.WChoiceCoefficient = config.WChoiceCurCoefficient
fic.ExerciceCurrentCoefficient = config.ExerciceCurCoefficient fic.ExerciceCurrentCoefficient = config.ExerciceCurCoefficient
ChStarted = config.Start.Unix() > 0 && time.Since(config.Start) >= 0 ChStarted = config.Start.Unix() > 0 && time.Since(config.Start) >= 0
if allowRegistration != config.AllowRegistration || fic.PartialValidation != config.PartialValidation || fic.UnlockedChallengeDepth != config.UnlockedChallengeDepth || fic.UnlockedChallengeUpTo != config.UnlockedChallengeUpTo || fic.DisplayAllFlags != config.DisplayAllFlags || fic.FirstBlood != config.FirstBlood || fic.SubmissionCostBase != config.SubmissionCostBase || fic.SubmissionUniqueness != config.SubmissionUniqueness || fic.DiscountedFactor != config.DiscountedFactor { if allowRegistration != config.AllowRegistration || fic.PartialValidation != config.PartialValidation || fic.UnlockedChallengeDepth != config.UnlockedChallengeDepth || fic.UnlockedChallengeUpTo != config.UnlockedChallengeUpTo || fic.DisplayAllFlags != config.DisplayAllFlags || fic.FirstBlood != config.FirstBlood || fic.SubmissionCostBase != config.SubmissionCostBase || fic.SubmissionUniqueness != config.SubmissionUniqueness || fic.DiscountedFactor != config.DiscountedFactor || fic.HideCaseSensitivity != config.HideCaseSensitivity {
allowRegistration = config.AllowRegistration allowRegistration = config.AllowRegistration
fic.PartialValidation = config.PartialValidation fic.PartialValidation = config.PartialValidation
@ -43,6 +43,7 @@ func reloadSettings(config *settings.Settings) {
fic.SubmissionUniqueness = config.SubmissionUniqueness fic.SubmissionUniqueness = config.SubmissionUniqueness
fic.GlobalScoreCoefficient = config.GlobalScoreCoefficient fic.GlobalScoreCoefficient = config.GlobalScoreCoefficient
fic.CountOnlyNotGoodTries = config.CountOnlyNotGoodTries fic.CountOnlyNotGoodTries = config.CountOnlyNotGoodTries
fic.HideCaseSensitivity = config.HideCaseSensitivity
fic.DiscountedFactor = config.DiscountedFactor fic.DiscountedFactor = config.DiscountedFactor
if !skipInitialGeneration { if !skipInitialGeneration {

View File

@ -19,6 +19,9 @@ var DisplayAllFlags bool
// DisplayMCQBadCount activates the report of MCQ bad responses counter. // DisplayMCQBadCount activates the report of MCQ bad responses counter.
var DisplayMCQBadCount bool var DisplayMCQBadCount bool
// HideCaseSensitivity never tells the user if the flag is case sensitive or not.
var HideCaseSensitivity bool
type myTeamFile struct { type myTeamFile struct {
Path string `json:"path"` Path string `json:"path"`
Name string `json:"name"` Name string `json:"name"`
@ -274,8 +277,13 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
flag.IgnoreCase = k.IgnoreCase flag.IgnoreCase = k.IgnoreCase
flag.CaptureRe = k.CaptureRegexp flag.CaptureRe = k.CaptureRegexp
flag.Soluce = hex.EncodeToString(k.Checksum) flag.Soluce = hex.EncodeToString(k.Checksum)
} else if PartialValidation { } else {
flag.Solved = t.HasPartiallySolved(k) if PartialValidation {
flag.Solved = t.HasPartiallySolved(k)
}
if !HideCaseSensitivity {
flag.IgnoreCase = k.IgnoreCase
}
} }
flag.Multiline = k.Multiline flag.Multiline = k.Multiline

View File

@ -77,6 +77,8 @@ type Settings struct {
CountOnlyNotGoodTries bool `json:"countOnlyNotGoodTries,omitempty"` CountOnlyNotGoodTries bool `json:"countOnlyNotGoodTries,omitempty"`
// DisplayAllFlags doesn't respect the predefined constraint existing between flags. // DisplayAllFlags doesn't respect the predefined constraint existing between flags.
DisplayAllFlags bool `json:"displayAllFlags,omitempty"` DisplayAllFlags bool `json:"displayAllFlags,omitempty"`
// HideCaseSensitivity never tells the user if the flag is case sensitive or not.
HideCaseSensitivity bool `json:"hideCaseSensitivity,omitempty"`
// DisplayMCQBadCount activates the report of MCQ bad responses counter. // DisplayMCQBadCount activates the report of MCQ bad responses counter.
DisplayMCQBadCount bool `json:"displayMCQBadCount,omitempty"` DisplayMCQBadCount bool `json:"displayMCQBadCount,omitempty"`
// EventKindness will ask browsers to delay notification interval. // EventKindness will ask browsers to delay notification interval.