about summary refs log tree commit diff
diff options
context:
space:
mode:
authormaride <maride@darknebu.la>2019-10-06 15:53:20 +0200
committermaride <maride@darknebu.la>2019-10-06 15:53:20 +0200
commite4637ddf366231de52c05d0092ff8ea8583a1601 (patch)
tree6b3af05c91e6a36d3a206d9ef39c0a276520a4aa
parent364a18c1f138811e1eba77be5514e458ef2e21a4 (diff)
Correctly deliver timestamp and not bool; fix 'flagTries' raise problem
-rw-r--r--src/challenge.go6
-rw-r--r--src/http.go2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/challenge.go b/src/challenge.go
index f0028ca..0203378 100644
--- a/src/challenge.go
+++ b/src/challenge.go
@@ -17,7 +17,8 @@ type StrippedChallenge struct {
 	Name string `json:"name"`
 	Description string `json:"description"`
 	Category string `json:"category"`
-	FoundFlag bool `json:"foundFlag"`
+	FoundFlag int64 `json:"foundFlag"`
+	FlagTries uint `json:"flagTries"`
 	ContainsLaunchable bool `json:"ContainsLaunchable"`
 	IPAddress string `json:"IPAddress"`
 }
@@ -27,7 +28,8 @@ func stripChallenge(c Challenge) (StrippedChallenge) {
 		Name: c.Name,
 		Description: c.Description,
 		Category: c.Category,
-		FoundFlag: c.FoundFlag != time.Unix(0, 0),
+		FoundFlag: c.FoundFlag.Unix(),
+		FlagTries: c.FlagTries,
 		ContainsLaunchable: c.Container != "",
 		IPAddress: getAddressForChallengeContainer(c.Container),
 	}
diff --git a/src/http.go b/src/http.go
index 6ad5b5e..6feeb33 100644
--- a/src/http.go
+++ b/src/http.go
@@ -236,7 +236,7 @@ func submitFlagHandler(w http.ResponseWriter, r *http.Request) {
 						correctFlag = true
 					} else {
 						// ow, bummer :(
-						challenge.FlagTries++
+						challenges[index].FlagTries++
 					}
 					break
 				}