Files
Gitea/modules/imagecaptcha/imagedata.go
T
silverwind 873efed5a6 refactor: move go-chi/captcha into Gitea (#39529)
The `gitea.com/go-chi/captcha` package only exists for Gitea,
so it moves into `modules/imagecaptcha`.

- Reloading an expired challenge shows a new image instead of a broken one
- Every answer is consumed on its first check
- OpenID registration stops after a failed captcha

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-10-02 22:21:41 +08:00

204 lines
2.3 KiB
Go

// Copyright 2026 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package imagecaptcha
import (
"strings"
"sync"
)
var fontData = sync.OnceValue(func() []string {
return strings.Fields(`
...#####...
..#######..
.###...###.
.##.....##.
###.....##.
##.......##
##.......##
##.......##
##.......##
##.......##
##.......##
##.......##
##.......##
##......###
.##.....##.
.###...###.
..#######..
...#####...
.....##....
....###....
...####....
..#####....
..##.##....
..#..##....
.....##....
.....##....
.....##....
.....##....
.....##....
.....##....
.....##....
.....##....
.....##....
.....##....
.##########
.##########
...####....
.########..
###....###.
.#......##.
........##.
........##.
........##.
.......##..
.......##..
......##...
.....##....
....###....
...###.....
..###......
.###.......
.##........
###########
###########
..######...
#########..
##.....###.
........##.
........##.
........##.
......###..
..#####....
..#######..
.......###.
........###
.........##
.........##
.........##
........###
#......###.
#########..
.#######...
.......##..
......###..
.....####..
.....#.##..
....##.##..
...##..##..
...##..##..
..##...##..
.##....##..
.##....##..
##.....##..
#......##..
###########
###########
.......##..
.......##..
.......##..
.......##..
.#########.
.#########.
.##........
.##........
.##........
.##........
.#######...
.########..
.......###.
........###
.........##
.........##
.........##
.........##
........###
##.....###.
#########..
..######...
.....#####.
...#######.
..###......
.##........
.##........
.#.........
##..####...
##.#######.
####....##.
###.....###
##.......##
##.......##
##.......##
##.......##
.##.....###
.###...###.
..#######..
...#####...
###########
###########
###......##
##......##.
........##.
.......###.
.......##..
.......##..
......##...
......##...
.....###...
.....##....
....###....
....##.....
....##.....
...###.....
...##......
..###......
...#####...
..########.
.###....###
.##......##
.##......##
.##......##
..##....##.
..#######..
....####...
..###.###..
.###...###.
###.....###
##.......##
##.......##
##.......##
###.....##.
.#########.
...#####...
...#####...
.########..
.##....###.
##......##.
##.......##
##.......##
##.......##
##......###
.##....####
.#######.##
...####..##
.........##
........##.
........##.
.......###.
......###..
.#######...
.#####.....
`)
})