Skip to content

Commit

Permalink
验证码hook&油猴配置注释
Browse files Browse the repository at this point in the history
  • Loading branch information
CodFrm committed Apr 5, 2019
1 parent a77c328 commit d4b68a4
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ npm run server
扩展地址:[https://addons.mozilla.org/zh-CN/firefox/addon/%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7/](https://addons.mozilla.org/zh-CN/firefox/addon/%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7/)
### 解压安装
为了方便安装,制作了一个浏览器打包的版本,请在[release页面](https://github.com/CodFrm/cxmooc-tools)查看详情
为了方便安装,制作了一个浏览器打包的版本,请在[release页面](https://github.com/CodFrm/cxmooc-tools/release)查看详情

![](build/cxmooc-tools/img/4.jpg)

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"dependencies": {
"body-parser": "^1.18.3",
"express": "^4.16.3",
"image-to-base64": "^2.0.1",
"md5": "^2.2.1",
"mongodb": "^3.1.10",
"redis": "^2.8.0"
Expand Down
18 changes: 18 additions & 0 deletions src/cxmooc-tools/chaoxing/chaoxing.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const common = require('../common');
const until = require('./until');
const Video = require('./video');
const Topic = require('./topic');
const image2base64 = require('image-to-base64');

module.exports = function () {
let self = this;
Expand Down Expand Up @@ -172,6 +173,23 @@ module.exports = function () {
switchTask();
}, (config.interval || 0.1) * 60000);
}
//监控验证码
self.monitorVcode();
getVarCode();
}

this.monitorVcode = function () {
//验证码监控加载
let hookGetVarCode = window.getVarCode;
window.getVarCode = function () {
let img = document.getElementById('imgVerCode');
image2base64('/img/code?' + new Date().getTime()).then(
(response) => {
img.src = 'data:image/jpg;base64,' + response
//TODO:验证码识别
}
)
}
}

this.read = function () {
Expand Down
13 changes: 7 additions & 6 deletions tampermonkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
// ==/UserScript==

let config = {
answer_ignore: true, //忽略题目
auto: true, //全自动挂机
interval: "5", //时间间隔
rand_answer: true, //随机答案
video_multiple: "1", //视频播放倍速
video_mute: true, //视频静音
answer_ignore: true, //忽略题目,勾选此处将不会答题
auto: true, //全自动挂机,无需手动操作,即可自动观看视频等
interval: "5", //时间间隔,当任务点完成后,会等待5分钟然后跳转到下一个任务点
rand_answer: false, //随机答案,没有答案的题目将自动的生成一个答案
video_multiple: "1", //视频播放倍速,视频播放的倍数,建议不要改动,为1即可,这是危险的功能
video_mute: true, //视频静音,视频自动静音播放
};

localStorage['config'] = JSON.stringify(config);

5 changes: 4 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ module.exports = {
},
chunks: ['popup']
})
]
],
node: {
fs: 'empty'
}
}

0 comments on commit d4b68a4

Please sign in to comment.