|
|
@ -2,6 +2,7 @@ package api
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"bytes"
|
|
|
|
|
|
|
|
_ "embed"
|
|
|
|
"encoding/base64"
|
|
|
|
"encoding/base64"
|
|
|
|
"image/color"
|
|
|
|
"image/color"
|
|
|
|
"image/png"
|
|
|
|
"image/png"
|
|
|
@ -19,6 +20,9 @@ import (
|
|
|
|
"github.com/rocboss/paopao-ce/pkg/util"
|
|
|
|
"github.com/rocboss/paopao-ce/pkg/util"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//go:embed assets/comic.ttf
|
|
|
|
|
|
|
|
var comic []byte
|
|
|
|
|
|
|
|
|
|
|
|
const MAX_PHONE_CAPTCHA = 10
|
|
|
|
const MAX_PHONE_CAPTCHA = 10
|
|
|
|
|
|
|
|
|
|
|
|
func Version(c *gin.Context) {
|
|
|
|
func Version(c *gin.Context) {
|
|
|
@ -43,7 +47,7 @@ func SyncSearchIndex(c *gin.Context) {
|
|
|
|
func GetCaptcha(c *gin.Context) {
|
|
|
|
func GetCaptcha(c *gin.Context) {
|
|
|
|
cap := captcha.New()
|
|
|
|
cap := captcha.New()
|
|
|
|
|
|
|
|
|
|
|
|
if err := cap.SetFont("assets/comic.ttf"); err != nil {
|
|
|
|
if err := cap.AddFontFromBytes(comic); err != nil {
|
|
|
|
panic(err.Error())
|
|
|
|
panic(err.Error())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|