aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-23 12:47:10 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-23 12:47:10 +0800
commit911c932ec426ee45c9380bd26714c4bb505a3a88 (patch)
tree5224b91b5622997ccfc882c2e4e0b22e97bc450b /main.go
parentRevert "Remove the trivial habitual makefile" (diff)
downloadpowxy-911c932ec426ee45c9380bd26714c4bb505a3a88.tar.gz
powxy-911c932ec426ee45c9380bd26714c4bb505a3a88.tar.zst
powxy-911c932ec426ee45c9380bd26714c4bb505a3a88.zip
Use a global struct with version and source info
Diffstat (limited to '')
-rw-r--r--main.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/main.go b/main.go
index a2113ec..4844f48 100644
--- a/main.go
+++ b/main.go
@@ -15,8 +15,8 @@ import (
type tparams struct {
UnsignedTokenBase64 string
- NeedBits uint
Message string
+ Global any
}
func main() {
@@ -42,7 +42,7 @@ func main() {
_ = tmpl.Execute(writer, tparams{
UnsignedTokenBase64: base64.StdEncoding.EncodeToString(expectedToken[:sha256.Size]),
Message: message,
- NeedBits: difficulty,
+ Global: global,
})
}
@@ -75,7 +75,7 @@ func main() {
h.Write(expectedToken[:sha256.Size])
h.Write(nonce)
ck := h.Sum(nil)
- if !validateBitZeros(ck, difficulty) {
+ if !validateBitZeros(ck, global.NeedBits) {
authPage("Your submission was incorrect, or your session has expired while submitting.")
return
}