当前位置:网站首页>egg-swagger-doc 图形验证码解决方案
egg-swagger-doc 图形验证码解决方案
2022-07-27 12:52:00 【雪狼之夜】
序:
应该不只一个人卡到这个bug,egg-swagger-doc的作者github也停更好些日子了,demo里也没找到对应的api,无奈,博主只能去解剖egg-swagger-doc的依赖文件了。但是如果二维码都出不来,swagger基本就变成了摆设,毫无意义,所以没办法,博主还是对依赖包进行了修改
博主原创, 说实话,博主这花了72个小时才调试出这个,如果你生活收入还可以的话,打赏下呗。
博主egg配置和版本如下:
1、"egg": "^2.15.1",
2、 "egg-swagger-doc": "^2.3.2",
3、"captchapng": "^0.0.1",//这玩意是生成图片base64的验证码
先看最终效果 ,如图

博主请求接口/api/verify
返回格式
{
code:"200",
data: "data:image/png;base64,iVBORw0KGgoA......",//这里就是你的base64图片了
msg: "查询成功"
}
解决方案
打开路径:/node_modules/app/swagger-ui-bundle.js

对里面验证方法进行修改就可以了。
位置在下面代码
}, "Unrecognized response type; unable to display.") : null之后加入
if(e.url.indexOf("/api/verify")!=-1){
g=l.default.createElement("img", {
style: {
maxWidth: "100%",
backgroundColor:"#fff"
},
src:JSON.parse(e.content).data
})
};就可以了。

博主原创, 说实话,博主这花了72个小时才调试出这个,如果你生活收入还可以的话,打赏下呗。
边栏推荐
- Dichotomy queries values in an array
- How to debug JNI program
- 滑环设备怎么进行维护
- Li Kou 1480. Dynamic sum of one-dimensional array 383. Ransom letter 412. Fizz buzz
- Unapp prevents continuous click errors
- Amd adrenalin 22.7.1 driver update: double the performance of OpenGL and support Microsoft win11 22h2 system
- libevent 之 evconnlistener_new_bind
- Intranet penetration based on FRP -- SSH Remote connection to intranet server with the help of public server
- 高度塌陷和BFC
- 数据库HTAP能力强弱怎么看
猜你喜欢

Preliminary discussion on NetGen and Gmsh mesh generation of any multiple sub models of CAD based on osg+occ

v-on基础指令

echart折线图默认显示最后一个点以及纵向虚线

W3School导航栏练习

力扣 1480. 一维数组的动态和 383. 赎金信412. Fizz Buzz

51:第五章:开发admin管理服务:4:开发【新增admin账号,接口】;(只开发了【用户名+密码的,方式】;【@T…】注解控制事务;设置cookie时,是否需要使用URLEncoder去编码;)

leetcode——83,24;机器学习——神经网络

Verilog的系统任务----$fopen、$fclose和$fdisplay, $fwrite,$fstrobe,$fmonitor

Training in the second week of summer vacation on July 24, 2022

Seata's landing practice in ant International Banking
随机推荐
Intranet penetration based on FRP -- SSH Remote connection to intranet server with the help of public server
SQL group by statement
Text style
Dichotomy queries values in an array
[basic knowledge] ~ IC design process and EDA tools used in each stage
Training in the second week of summer vacation on July 24, 2022
Seata 在蚂蚁国际银行业务的落地实践
高度塌陷和BFC
MFC FTP creates multi-level folders and uploads files to the specified directory of FTP
16-VMware Horizon 2203 虚拟桌面-Win10 自动桌面池完整克隆专用(十六)
元素的层级
产品经理经验谈100篇(十一)-策略产品经理:模型与方法论
How can electric complete set enterprises do well in cost and profit management with the help of ERP system?
leetcode——83,24;机器学习——神经网络
[300 + selected interview questions from big companies continued to share] big data operation and maintenance sharp knife interview question column (IX)
电滑环的常用类型
Seata's landing practice in ant International Banking
Li Kou 1480. Dynamic sum of one-dimensional array 383. Ransom letter 412. Fizz buzz
Getting started for beginners: build your own blog with WordPress
evutil_make_internal_pipe_: pipe: Too many open files