关于 utools 官方自动化助手(获取公网 IP)bug 修复
第一次使用自动化助手,随便开了一个获取公网 ip,输入关键字发现没有反应
在官方代码中加入错误提示
1https.get('https://api.ip.sb/ip' ,(res) => {
2 if (res.statusCode !== 200) return
3 res.on('data', (d) => {
4 const ip = d.toString().trim()
5 utools.copyText(ip)
6 utools.showNotification('公网IP: ' + ip + ' 已复制到剪贴板')
7 utools.simulateKeyboardTap('v', utools.isMacOs() ? 'command' : 'ctrl')
8 })
9}).on('error', (e) => {
10//加上错误提示
11 utools.showNotification('公网IP: error'+e)
12})[/colort]
在多吉上查询 nodejs https 证书过期,发现如下帖子
https://blog.ipsfan.com/6277.html
修改原代码如下
1const https = require('https');
2const options = {
3 strictSSL: false,
4 rejectUnauthorized: false
5};
6
7https.get('https://api.ip.sb/ip',options ,(res) => {
8 if (res.statusCode !== 200) return
9 res.on('data', (d) => {
10 const ip = d.toString().trim()
11 utools.copyText(ip)
12 utools.showNotification('公网IP: ' + ip + ' 已复制到剪贴板')
13 utools.simulateKeyboardTap('v', utools.isMacOs() ? 'command' : 'ctrl')
14 })
15}).on('error', (e) => {
16 utools.showNotification('公网IP: error'+e)
17})
修复完成 ✅,优秀!
上一个我用的插件
很是方便快捷,多端适配。欢迎大家来体验!👏👏
---------------------------------------------------------------
>> 博客地址:https://blog.mufengs.com
>> 邮箱地址:[email protected]
>> 微信帐号:Do8080
>> Github : https://github.com/mufengcoding
---------------------------------------------------------------