Merge #31

Merged
Sirherobrine23 merged 14 commits from main into stable 2021-02-09 17:53:17 +00:00
15 changed files with 276 additions and 50 deletions
Showing only changes of commit 24142a2e48 - Show all commits

View File

@ -69,7 +69,7 @@ module.exports = () => {
} }
if (pass){ if (pass){
if (command_bds === 'start'){ if (command_bds === 'start'){
var bds_init = bds.start() bds.start()
var command_status = `Bds Started` var command_status = `Bds Started`
} else if (command_bds === 'stop'){ } else if (command_bds === 'stop'){
bds.stop() bds.stop()

View File

@ -6,6 +6,19 @@ module.exports = () => {
const app = express(); const app = express();
var cors = require('cors'); var cors = require('cors');
app.use(cors()); app.use(cors());
const rateLimit = require("express-rate-limit");
const limiter = rateLimit({
windowMs: 5 * 60 * 1000, // 5 minutes
message: {
"status": false,
"log": "we had an overflow of log requests, please wait 5 minutes."
},
statusCode: 200,
max: 5000 // limit each IP to 5000 requests per windowMs
});
app.use(limiter);
const requestIp = require('request-ip');
app.use(requestIp.mw())
app.get("/", (req, res) => { app.get("/", (req, res) => {
if (typeof bds_log_string === 'undefined'){ if (typeof bds_log_string === 'undefined'){
if (fs.existsSync(localStorage.getItem("old_log_file"))){ if (fs.existsSync(localStorage.getItem("old_log_file"))){
@ -25,6 +38,7 @@ module.exports = () => {
"sucess": sucess, "sucess": sucess,
"log": text, "log": text,
"log_file": log_file, "log_file": log_file,
"ip": `${req.clientIp}`,
"requeset_date": bds.date() "requeset_date": bds.date()
}); });
}); });

View File

@ -18,6 +18,5 @@ This module was made to work both in the cli version and in gui versions like el
some deven ports are unlocked by the firewall if enabled: some deven ports are unlocked by the firewall if enabled:
- 28574
- 1932 - 1932
- 6565 - 6565

View File

@ -43,6 +43,7 @@
"qrcode": "^1.4.4", "qrcode": "^1.4.4",
"shelljs": "^0.8.4", "shelljs": "^0.8.4",
"systeminformation": "^5.0.10", "systeminformation": "^5.0.10",
"request-ip": "^2.1.3",
"telegraf": "^4.0.0" "telegraf": "^4.0.0"
}, },
"engines": { "engines": {

View File

@ -18,7 +18,7 @@ module.exports.start = () => {
} }
} else { } else {
if (require('command-exists').sync('java')){ if (require('command-exists').sync('java')){
var start_server = exec(`java -jar server.jar nogui`, {cwd: bds.bds_dir_java}); var start_server = exec(`java -Xmx1024M -Xms1024M -jar server.jar nogui`, {cwd: bds.bds_dir_java});
} else { } else {
if (bds.system == 'windows'){ if (bds.system == 'windows'){
require('open')("http://docs.sirherobrine23.com/bds_maneger_api_java#Windows"); require('open')("http://docs.sirherobrine23.com/bds_maneger_api_java#Windows");