Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gyteng committed Apr 23, 2019
1 parent 41adc46 commit 731fd16
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 59 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "shadowsocks-manager",
"version": "0.32.3",
"version": "0.32.4",
"description": "A shadowsocks manager tool for multi user and traffic control.",
"main": "server.js",
"scripts": {
Expand Down
55 changes: 1 addition & 54 deletions plugins/webgui/server/adminServer.js
Expand Up @@ -106,7 +106,7 @@ exports.editServer = async (req, res) => {
req.checkBody('scale', 'Invalid scale').notEmpty();
req.checkBody('shift', 'Invalid shift').isInt();
const result = await req.getValidationResult();
if(!result.isEmpty()) { return Promise.reject('Invalid Body'); }
if(!result.isEmpty()) { return Promise.reject(result.array()); }
const serverId = req.params.serverId;
const type = req.body.type;
const isWG = type === 'WireGuard';
Expand Down Expand Up @@ -151,59 +151,6 @@ exports.editServer = async (req, res) => {
console.log(err);
res.status(403).end();
}


// req.checkBody('name', 'Invalid name').notEmpty();
// req.checkBody('address', 'Invalid address').notEmpty();
// req.checkBody('port', 'Invalid port').isInt({min: 1, max: 65535});
// req.checkBody('password', 'Invalid password').notEmpty();
// req.checkBody('method', 'Invalid method').notEmpty();
// req.checkBody('scale', 'Invalid scale').notEmpty();
// req.checkBody('shift', 'Invalid shift').isInt();
// req.getValidationResult().then(result => {
// if(result.isEmpty()) {
// const address = req.body.address;
// const port = +req.body.port;
// const password = req.body.password;
// return manager.send({
// command: 'flow',
// options: { clear: false, },
// }, {
// host: address,
// port,
// password,
// });
// }
// result.throw();
// }).then(success => {
// const serverId = req.params.serverId;
// const name = req.body.name;
// const comment = req.body.comment;
// const address = req.body.address;
// const port = +req.body.port;
// const password = req.body.password;
// const method = req.body.method;
// const scale = req.body.scale;
// const shift = req.body.shift;
// const check = +req.body.check;
// return serverManager.edit({
// id: serverId,
// name,
// host: address,
// port,
// password,
// method,
// scale,
// comment,
// shift,
// check,
// });
// }).then(success => {
// res.send('success');
// }).catch(err => {
// console.log(err);
// res.status(403).end();
// });
};

exports.deleteServer = (req, res) => {
Expand Down
7 changes: 4 additions & 3 deletions plugins/webgui/server/home.js
Expand Up @@ -30,9 +30,10 @@ exports.signup = async (req, res) => {
req.checkBody('password', 'Invalid password').notEmpty();
let type = 'normal';
const validation = await req.getValidationResult();
if(!validation.isEmpty()) {
return Promise.reject('invalid body');
}
// if(!validation.isEmpty()) {
// return Promise.reject('invalid body');
// }
if(!validation.isEmpty()) { return Promise.reject(validation.array()); }
const email = req.body.email.toString().toLowerCase();
const code = req.body.code;
await emailPlugin.checkCode(email, code);
Expand Down

0 comments on commit 731fd16

Please sign in to comment.