mirror of
https://gitee.com/shikong-sk/gofiber-study
synced 2025-02-24 07:42:15 +08:00
30 lines
710 B
Go
30 lines
710 B
Go
|
package app
|
||
|
|
||
|
import (
|
||
|
"github.com/go-redis/redis/v8"
|
||
|
"github.com/mojocn/base64Captcha"
|
||
|
"gofiber.study.skcks.cn/common/config"
|
||
|
"gofiber.study.skcks.cn/global"
|
||
|
)
|
||
|
|
||
|
var Store *global.CaptchaStore
|
||
|
|
||
|
func reloadCaptcha(c *config.BasicConfig, redis *redis.Client) {
|
||
|
driver := &base64Captcha.DriverString{
|
||
|
Height: c.Captcha.Height,
|
||
|
Width: c.Captcha.Width,
|
||
|
|
||
|
NoiseCount: c.Captcha.NoiseCount,
|
||
|
Fonts: []string{
|
||
|
"SourceHanSansCN-VF-2.otf",
|
||
|
},
|
||
|
ShowLineOptions: c.Captcha.ShowLineOptions,
|
||
|
Length: c.Captcha.Length,
|
||
|
Source: c.Captcha.Source,
|
||
|
BgColor: c.Captcha.BgColor,
|
||
|
}
|
||
|
|
||
|
Store = global.NewCaptchaStore(redis)
|
||
|
global.Captcha = base64Captcha.NewCaptcha(driver, Store)
|
||
|
}
|