settings: Challenge can never ends

This commit is contained in:
nemunaire 2023-05-12 14:53:15 +02:00
commit aad95f1e53
12 changed files with 36 additions and 22 deletions

View file

@ -7,7 +7,7 @@ import (
)
func WantChoicesHandler(w http.ResponseWriter, r *http.Request, team string, sURL []string) {
if time.Now().After(challengeEnd) {
if challengeEnd != nil && time.Now().After(*challengeEnd) {
http.Error(w, "{\"errmsg\":\"Le challenge est terminé, trop tard !\"}", http.StatusGone)
return
}

View file

@ -7,7 +7,7 @@ import (
)
func HintHandler(w http.ResponseWriter, r *http.Request, team string, sURL []string) {
if time.Now().After(challengeEnd) {
if challengeEnd != nil && time.Now().After(*challengeEnd) {
http.Error(w, "{\"errmsg\":\"Le challenge est terminé, trop tard pour un indice !\"}", http.StatusGone)
return
}

View file

@ -17,7 +17,7 @@ const resolutiontpl = `<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Challenge Forensic - Résolution</title>
<title>Résolution</title>
</head>
<body style="margin: 0">
<video src="{{.}}" controls width="100%" height="100%"></video>

View file

@ -12,7 +12,7 @@ var startedFile = "started"
var touchTimer *time.Timer = nil
var challengeStart time.Time
var challengeEnd time.Time
var challengeEnd *time.Time
func touchStartedFile() {
if fd, err := os.Create(startedFile); err == nil {

View file

@ -9,7 +9,7 @@ import (
)
func SubmissionHandler(w http.ResponseWriter, r *http.Request, team string, sURL []string) {
if time.Now().After(challengeEnd) {
if challengeEnd != nil && time.Now().After(*challengeEnd) {
http.Error(w, "{\"errmsg\":\"Vous ne pouvez plus soumettre, le challenge est terminé.\"}", http.StatusGone)
return
}

View file

@ -8,7 +8,7 @@
import { settings, time } from '$lib/stores/settings.js';
</script>
{#if $settings}
{#if $settings && $settings.end}
{#if $settings.end - $settings.start > 0}
<div
class="clock display-2 text-end text-md-center"
@ -69,7 +69,7 @@
{:else}
<div class="d-flex h-100 justify-content-center align-items-center">
<h1 class="display-3 m-0">
Challenge forensic
{$challengeInfo.title}
</h1>
</div>
{/if}