mirror of
https://gitee.com/shikong-sk/gofiber-study
synced 2025-02-23 23:32:15 +08:00
30 lines
702 B
Go
30 lines
702 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{
|
|
"wqy-microhei.ttc",
|
|
},
|
|
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)
|
|
}
|