Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
东方怂天
cxmooc-tools
提交
1bfc46d5
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 搜索 >>
提交
1bfc46d5
编写于
3月 13, 2018
作者:
C
CodFrm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
https的问题
上级
b9a42045
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
45 addition
and
10 deletion
+45
-10
.gitignore
.gitignore
+2
-0
README.md
README.md
+15
-0
src/config.js
src/config.js
+1
-1
src/cxmooc-tools/start.js
src/cxmooc-tools/start.js
+0
-1
src/cxmooc-tools/topic.js
src/cxmooc-tools/topic.js
+0
-1
src/server/listen.js
src/server/listen.js
+27
-7
未找到文件。
.gitignore
浏览文件 @
1bfc46d5
...
@@ -4,3 +4,5 @@ package-lock.json
...
@@ -4,3 +4,5 @@ package-lock.json
coverage
coverage
typings
typings
typings.json
typings.json
certificate
README.md
浏览文件 @
1bfc46d5
...
@@ -13,6 +13,21 @@
...
@@ -13,6 +13,21 @@
npm install
npm install
npm run build
npm run build
```
```
## Server
搭配了一个服务器程序,这个服务器将会记录你正确的答题答案,并不会记录你的任何账号信息
并且接口没有任何权限,全由插件提交上传,还请大家不要故意上传错误的答案 (๑• . •๑)
因为超新慕课是https的原因,所以服务器配置需要https
环境:
*
Node.js
*
Mongodb
```
npm install
npm run server
```
## 安装
## 安装
Chrome:
Chrome:
...
...
src/config.js
浏览文件 @
1bfc46d5
module
.
exports
=
{
module
.
exports
=
{
url
:
"
http
://blog.icodef.com:8080
/
"
,
url
:
"
http
s://blog.icodef.com:8081
/
"
,
version
:
1.3
,
version
:
1.3
,
update
:
'
http://blog.icodef.com/2018/01/25/1304
'
,
update
:
'
http://blog.icodef.com/2018/01/25/1304
'
,
enforce
:
false
enforce
:
false
...
...
src/cxmooc-tools/start.js
浏览文件 @
1bfc46d5
...
@@ -10,7 +10,6 @@ window.onload = function () {
...
@@ -10,7 +10,6 @@ window.onload = function () {
return
;
return
;
}
}
}
}
this
.
console
.
log
(
localStorage
.
getItem
(
"
fresh
"
));
injected
(
document
,
'
mooc.js
'
);
injected
(
document
,
'
mooc.js
'
);
document
.
head
.
setAttribute
(
'
chrome-url
'
,
chrome
.
extension
.
getURL
(
''
));
document
.
head
.
setAttribute
(
'
chrome-url
'
,
chrome
.
extension
.
getURL
(
''
));
})
})
...
...
src/cxmooc-tools/topic.js
浏览文件 @
1bfc46d5
...
@@ -116,7 +116,6 @@ module.exports = function (_this, elLogo, index, over) {
...
@@ -116,7 +116,6 @@ module.exports = function (_this, elLogo, index, over) {
retJson
.
push
(
tmpJson
);
retJson
.
push
(
tmpJson
);
}
}
//提交数据
//提交数据
console
.
log
(
JSON
.
stringify
(
retJson
));
common
.
post
(
moocServer
.
url
+
'
answer
'
,
JSON
.
stringify
(
retJson
));
common
.
post
(
moocServer
.
url
+
'
answer
'
,
JSON
.
stringify
(
retJson
));
}
}
/**
/**
...
...
src/server/listen.js
浏览文件 @
1bfc46d5
...
@@ -4,9 +4,35 @@ const app = express();
...
@@ -4,9 +4,35 @@ const app = express();
const
moocModel
=
require
(
'
./mooc
'
);
const
moocModel
=
require
(
'
./mooc
'
);
const
md5
=
require
(
"
md5
"
);
const
md5
=
require
(
"
md5
"
);
const
config
=
require
(
'
../config
'
);
const
config
=
require
(
'
../config
'
);
var
mooc
=
new
moocModel
();
var
path
=
require
(
'
path
'
);
var
fs
=
require
(
'
fs
'
);
const
http
=
require
(
'
http
'
);
const
https
=
require
(
'
https
'
);
var
privateKey
=
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'
./certificate/private.key
'
),
'
utf8
'
);
var
certificate
=
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'
./certificate/file.crt
'
),
'
utf8
'
);
var
credentials
=
{
key
:
privateKey
,
cert
:
certificate
};
var
httpServer
=
http
.
createServer
(
app
);
var
httpsServer
=
https
.
createServer
(
credentials
,
app
);
var
PORT
=
8080
;
var
SSLPORT
=
8081
;
//创建http服务器
httpServer
.
listen
(
PORT
,
function
()
{
console
.
log
(
'
HTTP Server is running on: http://localhost:%s
'
,
PORT
);
});
//创建https服务器
httpsServer
.
listen
(
SSLPORT
,
function
()
{
console
.
log
(
'
HTTPS Server is running on: https://localhost:%s
'
,
SSLPORT
);
});
var
mooc
=
new
moocModel
();
app
.
use
(
bodyParser
.
json
());
app
.
use
(
bodyParser
.
json
());
app
.
use
(
bodyParser
.
urlencoded
({
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
extended
:
true
...
@@ -105,10 +131,4 @@ app.get('/answer', function (req, res) {
...
@@ -105,10 +131,4 @@ app.get('/answer', function (req, res) {
}
}
});
});
}
}
})
var
server
=
app
.
listen
(
8080
,
function
()
{
var
host
=
server
.
address
().
address
var
port
=
server
.
address
().
port
console
.
log
(
"
Server started successfully
\n
Home URL:http://%s:%s
"
,
host
,
port
)
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录