tUpdate token reminder text - scoreboard - Interactive scoreboard for CTF-like games
(HTM) git clone git://git.z3bra.org/scoreboard.git
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit 000adea9f154bdfb9073b75d7538afef7a8de370
(DIR) parent f54a4941d53b87921903199974c2b046d3757dfd
(HTM) Author: Willy Goiffon <contact@z3bra.org>
Date: Wed, 23 Aug 2023 09:20:55 +0200
Update token reminder text
Diffstat:
M main.go | 11 +++++------
M ui.go | 2 +-
2 files changed, 6 insertions(+), 7 deletions(-)
---
(DIR) diff --git a/main.go b/main.go
t@@ -24,6 +24,7 @@ import (
"database/sql"
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
+ "github.com/dustin/go-humanize"
_ "modernc.org/sqlite"
)
t@@ -33,12 +34,10 @@ const (
BOARD_HEIGHT int = 15
HTML string = "score.html"
DB string = "score.db"
- TOKEN_REMINDER string = `
-%s's token for flag #%d:
-
-🔑 %s
-
+ TOKEN_REMINDER string = `%s, use the token below to submit your %s flag.
Save it carefully, do not share it.
+
+ 🔑%s
`
)
t@@ -214,6 +213,6 @@ func main() {
}
if cyboard.player.token != "" && cyboard.flag < (len(cyboard.flag_ref)) {
- fmt.Printf(TOKEN_REMINDER, cyboard.player.name, cyboard.flag + 1, cyboard.player.token)
+ fmt.Printf(TOKEN_REMINDER, cyboard.player.name, humanize.Ordinal(cyboard.flag + 1), cyboard.player.token)
}
}
(DIR) diff --git a/ui.go b/ui.go
t@@ -106,7 +106,7 @@ func (a *Application) HighlightBoard(line int) {
AddItem(RankTable(0, -1, 0, true).Select(line - 1, 0), BOARD_HEIGHT, 1, true)
a.app.SetFocus(a.board)
- a.frame.AddText(fmt.Sprintf("🔑 %s", a.player.token), false, tview.AlignCenter, 0)
+ a.frame.AddText(fmt.Sprintf(" 🔑%s", a.player.token), false, tview.AlignCenter, 0)
}
func (a *Application) NewPlayer(rank int) {