mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Use new built in public IP detection
This commit is contained in:
parent
9ec8e83090
commit
b3574552e2
@ -3,7 +3,6 @@ var events = require('events')
|
|||||||
var fs = require('fs.extra')
|
var fs = require('fs.extra')
|
||||||
var Gamedig = require('gamedig')
|
var Gamedig = require('gamedig')
|
||||||
var path = require('path')
|
var path = require('path')
|
||||||
var publicIp = require('public-ip')
|
|
||||||
var slugify = require('slugify')
|
var slugify = require('slugify')
|
||||||
|
|
||||||
var queryInterval = 5000
|
var queryInterval = 5000
|
||||||
@ -89,7 +88,7 @@ Server.prototype.makeServerConfig = function () {
|
|||||||
return {
|
return {
|
||||||
bindAddress: '',
|
bindAddress: '',
|
||||||
bindPort: this.port,
|
bindPort: this.port,
|
||||||
publicAddress: this.ip,
|
publicAddress: '',
|
||||||
publicPort: this.port,
|
publicPort: this.port,
|
||||||
a2s: {
|
a2s: {
|
||||||
address: '127.0.0.1',
|
address: '127.0.0.1',
|
||||||
@ -172,39 +171,36 @@ Server.prototype.start = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var self = this
|
var self = this
|
||||||
publicIp.v4().then(function (ip) {
|
var config = self.makeServerConfig()
|
||||||
self.ip = ip
|
self.saveServerConfig(config, function (err) {
|
||||||
var config = self.makeServerConfig()
|
if (err) {
|
||||||
self.saveServerConfig(config, function (err) {
|
console.log(err)
|
||||||
if (err) {
|
return
|
||||||
console.log(err)
|
}
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var instance = childProcess.spawn(self.serverBinary(), self.serverArguments(), { cwd: self.config.path })
|
var instance = childProcess.spawn(self.serverBinary(), self.serverArguments(), { cwd: self.config.path })
|
||||||
|
|
||||||
instance.on('error', function (err) {
|
instance.on('error', function (err) {
|
||||||
console.error('Failed to start server', self.title, err)
|
console.error('Failed to start server', self.title, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
instance.on('close', function (code) {
|
instance.on('close', function (code) {
|
||||||
clearInterval(self.queryStatusInterval)
|
clearInterval(self.queryStatusInterval)
|
||||||
self.state = null
|
self.state = null
|
||||||
self.pid = null
|
self.pid = null
|
||||||
self.instance = null
|
self.instance = null
|
||||||
|
|
||||||
self.emit('state')
|
|
||||||
})
|
|
||||||
|
|
||||||
self.pid = instance.pid
|
|
||||||
self.instance = instance
|
|
||||||
self.headlessClientInstances = []
|
|
||||||
self.queryStatusInterval = setInterval(function () {
|
|
||||||
self.queryStatus()
|
|
||||||
}, queryInterval)
|
|
||||||
|
|
||||||
self.emit('state')
|
self.emit('state')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self.pid = instance.pid
|
||||||
|
self.instance = instance
|
||||||
|
self.headlessClientInstances = []
|
||||||
|
self.queryStatusInterval = setInterval(function () {
|
||||||
|
self.queryStatus()
|
||||||
|
}, queryInterval)
|
||||||
|
|
||||||
|
self.emit('state')
|
||||||
})
|
})
|
||||||
|
|
||||||
return this
|
return this
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
"lodash": "^4.17.10",
|
"lodash": "^4.17.10",
|
||||||
"morgan": "^1.8.1",
|
"morgan": "^1.8.1",
|
||||||
"multer": "^1.3.0",
|
"multer": "^1.3.0",
|
||||||
"public-ip": "^4.0.4",
|
|
||||||
"raw-loader": "^0.5.1",
|
"raw-loader": "^0.5.1",
|
||||||
"serve-static": "^1.12.1",
|
"serve-static": "^1.12.1",
|
||||||
"slugify": "^1.1.0",
|
"slugify": "^1.1.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user