mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-05 08:18:17 +00:00
feat(metarefresh): simplify random logic
Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
@@ -35,14 +35,9 @@ func (i *Impl) Issue(w http.ResponseWriter, r *http.Request, lg *slog.Logger, in
|
||||
q.Set("id", in.Challenge.ID)
|
||||
u.RawQuery = q.Encode()
|
||||
|
||||
showMeta := false
|
||||
showMeta := in.Challenge.RandomData[0]%2 == 0
|
||||
|
||||
switch in.Challenge.RandomData[0] {
|
||||
case '0', '1', '2', '3', '4', '5', '6', '7':
|
||||
lg.Debug("rendering meta element")
|
||||
showMeta = true
|
||||
default:
|
||||
lg.Debug("adding Refresh header")
|
||||
if !showMeta {
|
||||
w.Header().Add("Refresh", fmt.Sprintf("%d; url=%s", in.Rule.Challenge.Difficulty+1, u.String()))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user