ui: Display a message when dealing with compressed downloads

This commit is contained in:
nemunaire 2023-04-03 23:46:01 +02:00
parent 1a21115503
commit 6a0b0545d7
2 changed files with 16 additions and 6 deletions

View file

@ -20,10 +20,11 @@ var DisplayAllFlags bool
var DisplayMCQBadCount bool
type myTeamFile struct {
Path string `json:"path"`
Name string `json:"name"`
Checksum string `json:"checksum"`
Size int64 `json:"size"`
Path string `json:"path"`
Name string `json:"name"`
Checksum string `json:"checksum"`
Compressed bool `json:"compressed,omitempty"`
Size int64 `json:"size"`
}
type myTeamHint struct {
HintId int64 `json:"id"`
@ -178,10 +179,12 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
for _, f := range files {
if t == nil || t.CanDownload(f) {
cksum := f.Checksum
compressed := false
if len(f.ChecksumShown) > 0 {
cksum = f.ChecksumShown
compressed = true
}
exercice.Files = append(exercice.Files, myTeamFile{path.Join(FilesDir, f.Path), f.Name, hex.EncodeToString(cksum), f.Size})
exercice.Files = append(exercice.Files, myTeamFile{path.Join(FilesDir, f.Path), f.Name, hex.EncodeToString(cksum), compressed, f.Size})
}
}
}