Skip to content

Commit

Permalink
stable version
Browse files Browse the repository at this point in the history
  • Loading branch information
Z3ratu1 committed Mar 21, 2021
1 parent e9eafaf commit 3b07f31
Show file tree
Hide file tree
Showing 6 changed files with 2,835 additions and 2,752 deletions.
2 changes: 1 addition & 1 deletion server/apis/admingetdockers.js
Expand Up @@ -5,7 +5,7 @@ const getDockers = async (ctx) => {
if (!verify.admin_login(ctx)) {
return
}
let dockerUser = await user.find({dockerTimeout: {$not: null}}) // 查询非空
let dockerUser = await user.find({dockerTimeout: {$ne: null}}) // 查询非空
let ret = []
for(let user of dockerUser)
{
Expand Down
5 changes: 4 additions & 1 deletion server/apis/postcreatedocker.js
Expand Up @@ -46,9 +46,12 @@ const createDocker = async (ctx) => {
} else {
// 获取1-2w之间的一个端口,随机产生,之前是顺序的
let port = parseInt(Math.random() * 10000 + 10000, 10)
while (!await isPortReachable(port))
let res = await isPortReachable(port)
while (res) // reachabley意味着这里有服务以及被占用了
{
port = parseInt(Math.random() * 10000 + 10000, 10)
res = await isPortReachable(port, 'localhost')

}

// console.log(port)
Expand Down
2 changes: 1 addition & 1 deletion server/apis/poststopdocker.js
Expand Up @@ -29,7 +29,7 @@ const stopDocker = async (ctx) => {
}
}

let tempuser = await user.findOne({username: ctx.state.userinfo.username})
let tempuser = await user.findOne({username: body.username})
let docker = new Docker()
let container = docker.getContainer(tempuser.token)

Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Expand Up @@ -14,7 +14,7 @@
"debug": "^4.1.1",
"dockerode": "^3.2.1",
"fs": "^0.0.1-security",
"get-port": "^5.1.1",
"is-port-reachable": "^3.0.0",
"jwt-simple": "^0.5.6",
"koa": "^2.10.0",
"koa-bodyparser": "^4.2.1",
Expand Down

0 comments on commit 3b07f31

Please sign in to comment.