fix: 登录二维码按页面图片方式获取
This commit is contained in:
@@ -195,12 +195,15 @@ func (a *App) login(w http.ResponseWriter, r *http.Request) {
|
||||
func (a *App) qrCode(w http.ResponseWriter, r *http.Request) {
|
||||
ctx, cancel := context.WithTimeout(r.Context(), 40*time.Second)
|
||||
defer cancel()
|
||||
img, err := a.client.QRCode(ctx)
|
||||
img, ctype, err := a.client.QRCode(ctx)
|
||||
if err != nil {
|
||||
writeErr(w, err.Error())
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "image/jpeg")
|
||||
if ctype == "" {
|
||||
ctype = "image/png"
|
||||
}
|
||||
w.Header().Set("Content-Type", ctype)
|
||||
w.Header().Set("Cache-Control", "no-store")
|
||||
_, _ = w.Write(img)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user