Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
东方怂天
cxmooc-tools
提交
2b44ab22
C
cxmooc-tools
项目概览
东方怂天
/
cxmooc-tools
通知
11
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
cxmooc-tools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2b44ab22
编写于
4月 21, 2019
作者:
C
CodFrm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复验证码打码
上级
b4f6a600
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
39 addition
and
32 deletion
+39
-32
src/cxmooc-tools/chaoxing/vcode.js
src/cxmooc-tools/chaoxing/vcode.js
+30
-20
src/server/listen.js
src/server/listen.js
+8
-10
src/tampermonkey/cxmooc-pack.js
src/tampermonkey/cxmooc-pack.js
+0
-1
src/tg-bot.js
src/tg-bot.js
+1
-1
未找到文件。
src/cxmooc-tools/chaoxing/vcode.js
浏览文件 @
2b44ab22
...
...
@@ -7,19 +7,22 @@ module.exports = function () {
this
.
monitorVcode
=
function
()
{
//验证码监控加载
//作业处验证码
window
.
getVarCode
=
function
()
{
let
notic
=
until
.
signleLine
(
'
cxmooc自动打码中...
'
,
'
dama
'
,
$
(
'
#sub
'
).
parents
(
'
td
'
));
let
img
=
document
.
getElementById
(
'
imgVerCode
'
);
getVcode
(
'
/img/code?
'
+
new
Date
().
getTime
(),
img
,
function
(
code
,
msg
)
{
if
(
code
===
undefined
)
{
$
(
notic
).
html
(
msg
);
return
;
}
$
(
notic
).
html
(
'
cxmooc打码成功,准备提交
'
);
$
(
'
input#code
'
).
val
(
code
);
setTimeout
(
function
()
{
$
(
'
a#sub
'
).
click
();
},
2000
);
if
(
document
.
getElementById
(
'
imgVerCode
'
))
{
$
(
'
#imgVerCode
'
).
on
(
'
load
'
,
function
()
{
console
.
log
(
'
准备打码...
'
);
let
notic
=
until
.
signleLine
(
'
cxmooc自动打码中...
'
,
'
dama
'
,
$
(
'
#sub
'
).
parents
(
'
td
'
));
let
img
=
document
.
getElementById
(
'
imgVerCode
'
);
getVcode
(
'
/img/code?
'
+
new
Date
().
getTime
(),
img
,
function
(
code
,
msg
)
{
if
(
code
===
undefined
)
{
$
(
notic
).
html
(
msg
);
return
;
}
$
(
notic
).
html
(
'
cxmooc打码成功,准备提交
'
);
$
(
'
input#code
'
).
val
(
code
);
setTimeout
(
function
()
{
$
(
'
a#sub
'
).
click
();
},
2000
);
},
true
);
});
}
//异常验证码
...
...
@@ -41,7 +44,7 @@ module.exports = function () {
//保障账号安全验证码
window
.
showChapterVerificationCodeTip
=
window
.
showChapterVerificationCode
||
0
;
window
.
chapterVerifyCode
=
function
()
{
let
notic
=
until
.
signleLine
(
'
cxmooc自动打码中...
'
,
'
dama
'
,
$
(
'
.DySearch
'
));
let
notic
=
until
.
signleLine
(
'
cxmooc自动打码中...
'
,
'
dama
1
'
,
$
(
'
.DySearch
'
));
$
(
notic
).
css
(
'
float
'
,
'
left
'
);
let
img
=
$
(
'
.fl[name=chapterNumVerCode]
'
);
if
(
img
.
length
<=
0
)
{
...
...
@@ -62,13 +65,15 @@ module.exports = function () {
}
}
function
getVcode
(
url
,
img
,
callback
)
{
let
vcodeimg
=
document
.
createElement
(
'
img
'
);
vcodeimg
.
onload
=
function
()
{
function
getVcode
(
url
,
img
,
callback
,
show
)
{
let
vcodeimg
=
show
?
img
:
document
.
createElement
(
'
img
'
);
let
dmStart
=
function
()
{
let
base64
=
common
.
getImageBase64
(
vcodeimg
,
'
jpeg
'
);
img
.
src
=
base64
;
if
(
!
show
)
{
img
.
src
=
base64
;
}
common
.
gm_post
(
serverConfig
.
url
+
'
vcode
'
,
'
img=
'
+
encodeURIComponent
(
base64
.
substr
(
'
data:image/jpeg;base64,
'
.
length
)),
false
,
function
(
ret
)
{
let
json
=
JSON
.
parse
(
ret
)
let
json
=
JSON
.
parse
(
ret
)
;
if
(
json
.
code
==
-
2
)
{
alert
(
'
cxmooc打码已超限制,请手动输入
'
);
callback
(
undefined
,
json
.
msg
);
...
...
@@ -83,7 +88,12 @@ module.exports = function () {
callback
(
undefined
,
'
网络请求失败
'
);
});
}
vcodeimg
.
src
=
url
;
if
(
show
)
{
dmStart
();
}
else
{
vcodeimg
.
onload
=
dmStart
;
vcodeimg
.
src
=
url
;
}
}
self
.
monitorVcode
();
...
...
src/server/listen.js
浏览文件 @
2b44ab22
...
...
@@ -64,11 +64,11 @@ app.use(function (req, res, next) {
res
.
header
(
"
Access-Control-Allow-Headers
"
,
"
Content-Type,Content-Length,Authorization,Accept,X-Requested-With
"
);
res
.
header
(
"
Access-Control-Allow-Methods
"
,
"
PUT,POST,GET,DELETE,OPTIONS
"
);
if
(
req
.
method
==
"
OPTIONS
"
)
{
re
s
.
send
(
200
);
re
turn
res
.
send
(
200
,
'
success
'
);
}
else
{
next
();
return
next
();
}
})
})
;
app
.
all
(
'
/player/*
'
,
function
(
req
,
res
,
next
)
{
res
.
header
(
"
Access-Control-Allow-Origin
"
,
"
*
"
);
...
...
@@ -81,11 +81,10 @@ app.post('/answer', function (req, res) {
var
ip
=
getClientIp
(
req
);
var
ret
=
[];
if
(
req
.
body
.
length
<=
0
)
{
res
.
send
({
re
turn
re
s
.
send
({
code
:
0
,
msg
:
'
success
'
});
return
;
}
for
(
let
i
in
req
.
body
)
{
let
topic
=
req
.
body
[
i
];
...
...
@@ -156,7 +155,7 @@ app.get('/update', function (req, res) {
redis
.
onlineNum
(
function
(
err
,
data
)
{
//分发各个版本热更新
let
hotversion
=
config
.
getHotVersion
(
req
.
query
.
ver
||
config
.
version
);
res
.
send
({
re
turn
re
s
.
send
({
version
:
config
.
version
,
url
:
config
.
update
,
enforce
:
config
.
enforce
,
...
...
@@ -171,7 +170,7 @@ function getClientIp(req) {
return
req
.
headers
[
'
x-forwarded-for
'
]
||
req
.
connection
.
remoteAddress
||
req
.
socket
.
remoteAddress
||
req
.
connection
.
socket
.
remoteAddress
;
req
.
connection
.
socket
.
remoteAddress
||
'
error-ip
'
;
}
app
.
post
(
'
/v2/answer
'
,
function
(
req
,
res
)
{
var
topic
=
req
.
body
.
topic
||
[];
...
...
@@ -210,11 +209,10 @@ app.get('/answer', function (req, res) {
function
selectAnswer
(
topic
,
res
,
where
)
{
var
ret
=
[];
if
(
topic
.
length
<=
0
)
{
res
.
send
({
re
turn
re
s
.
send
({
code
:
0
,
msg
:
'
success
'
});
return
;
}
for
(
let
i
=
0
;
i
<
topic
.
length
;
i
++
)
{
mooc
.
find
(
'
answer
'
,
where
(
i
),
{
...
...
@@ -236,7 +234,7 @@ function selectAnswer(topic, res, where) {
}
ret
.
push
(
pushData
);
if
(
ret
.
length
==
topic
.
length
)
{
res
.
send
(
ret
);
re
turn
re
s
.
send
(
ret
);
}
});
}
...
...
src/tampermonkey/cxmooc-pack.js
浏览文件 @
2b44ab22
...
...
@@ -9,7 +9,6 @@ window.onload = function () {
var
ev
=
ev
||
event
;
var
_this
=
ev
.
srcElement
||
ev
.
target
;
if
(
_this
.
id
==
'
iframe
'
)
{
cx
.
vcode
.
monitorVcode
();
cx
.
studentstudy
();
}
},
true
);
...
...
src/tg-bot.js
浏览文件 @
2b44ab22
...
...
@@ -23,7 +23,7 @@ if (branch == tag) {
push
();
}
function
push
()
{
let
range
=
commit_range
;
let
range
=
commit_range
;
if
(
branch
==
tag
)
{
range
=
tag
+
'
...
'
+
lastTag
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录