Skip to content

Commit 75fdea0

Browse files
committed
Updated routes
1 parent 3b9edd1 commit 75fdea0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/routes/index.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,16 @@ async function updateRecord (req, res) {
6464
const username = await checkAuth(req)
6565
if (!username) return unauthorized(res)
6666
let config = await json(req)
67-
if (config.screepsAPIConfig && config.screepsAPIConfig.token && config.screepsAPIConfig.token.includes('*')) {
68-
delete config.screepsAPIConfig
69-
}
70-
if (config.screepsAPIConfig && config.screepsAPIConfig.password && config.screepsAPIConfig.password.match(/^\*{8}$/)) {
71-
delete config.screepsAPIConfig
67+
if (config.screepsAPIConfig) {
68+
if (config.screepsAPIConfig.privateServer) {
69+
if (config.screepsAPIConfig.password && config.screepsAPIConfig.password.match(/^\*{8}$/)) {
70+
delete config.screepsAPIConfig
71+
}
72+
} else {
73+
if (config.screepsAPIConfig.token && config.screepsAPIConfig.token.includes('*')) {
74+
delete config.screepsAPIConfig
75+
}
76+
}
7277
}
7378
config.lastErrorText = ''
7479
await req.db.Config.update(config, { where: { pk: config.pk, username } })

0 commit comments

Comments
 (0)