Merge pull request #75 from gruppe-adler/admins-motd-forcedDifficulty

more options in web frontend
This commit is contained in:
Björn Dahlgren 2017-10-01 04:28:07 +02:00 committed by GitHub
commit 55a8985701
7 changed files with 39 additions and 1 deletions

View File

@ -12,6 +12,7 @@ module.exports = {
'@mod1',
'@mod2',
],
admins: [], // add steam IDs here to enable #login without password
auth: { // If both username and password is set, HTTP Basic Auth will be used. You may use an array to specify more than one user.
username: '', // Username for HTTP Basic Auth
password: '', // Password for HTTP Basic Auth

View File

@ -104,9 +104,11 @@ Manager.prototype.save = function () {
admin_password: server.admin_password,
auto_start: server.auto_start,
battle_eye: server.battle_eye,
forcedDifficulty: server.forcedDifficulty,
max_players: server.max_players,
missions: server.missions,
mods: server.mods,
motd: server.motd,
number_of_headless_clients: server.number_of_headless_clients,
parameters: server.parameters,
password: server.password,

View File

@ -48,9 +48,11 @@ Server.prototype.update = function (options) {
this.admin_password = options.admin_password
this.auto_start = options.auto_start
this.battle_eye = options.battle_eye
this.forcedDifficulty = options.forcedDifficulty || null
this.max_players = options.max_players
this.missions = options.missions
this.mods = options.mods || []
this.motd = options.motd || null
this.number_of_headless_clients = options.number_of_headless_clients || 0
this.password = options.password
this.parameters = options.parameters
@ -109,15 +111,18 @@ Server.prototype.getParameters = function () {
Server.prototype.start = function () {
var parameters = this.getParameters()
var server = new ArmaServer.Server({
admins: config.admins,
battleEye: this.battle_eye ? 1 : 0,
config: this.id,
disableVoN: this.von ? 0 : 1,
game: config.game,
forcedDifficulty: this.forcedDifficulty || null,
headlessClients: this.number_of_headless_clients > 0 ? ['127.0.0.1'] : null,
hostname: createServerTitle(this.title),
localClient: this.number_of_headless_clients > 0 ? ['127.0.0.1'] : null,
missions: this.missions,
mods: this.mods,
motd: (this.motd && this.motd.split('\n')) || null,
parameters: parameters,
password: this.password,
passwordAdmin: this.admin_password,
@ -270,8 +275,10 @@ Server.prototype.toJSON = function () {
auto_start: this.auto_start,
battle_eye: this.battle_eye,
id: this.id,
forcedDifficulty: this.forcedDifficulty,
max_players: this.max_players,
missions: this.missions,
motd: this.motd,
mods: this.mods,
number_of_headless_clients: this.number_of_headless_clients,
parameters: this.parameters,

View File

@ -16,7 +16,7 @@
]
},
"dependencies": {
"arma-server": "0.0.5",
"arma-server": "0.0.6",
"async": "^0.9.0",
"body-parser": "^1.17.1",
"express": "^4.15.2",

View File

@ -11,8 +11,10 @@ define(function (require) {
admin_password: '',
auto_start: false,
battle_eye: false,
forcedDifficulty: '',
max_players: null,
mods: [],
motd: '',
number_of_headless_clients: 0,
parameters: [],
password: '',

View File

@ -22,7 +22,9 @@ define(function (require) {
admin_password: this.$("form .admin-password").val(),
auto_start: this.$("form .auto-start").prop("checked"),
battle_eye: this.$("form .battle-eye").prop("checked"),
forcedDifficulty: this.$("form .forcedDifficulty").val(),
max_players: this.$("form .max-players").val(),
motd: this.$("form .motd").val(),
number_of_headless_clients: this.$("form .headless-clients").val(),
password: this.$("form .password").val(),
persistent: this.$("form .persistent").prop("checked"),

View File

@ -35,6 +35,30 @@
</div>
</div>
<div class="form-group">
<label for="motd" class="col-sm-2 control-label">MOTD</label>
<div class="col-sm-10">
<textarea rows="3"
class="form-control motd"
data-field="motd"
placeholder="No MOTD will be shown"><%-motd %></textarea>
<p class="help-block">Message of the day. Shown to players when connected</p>
</div>
</div>
<div class="form-group">
<label for="forcedDifficulty" class="col-sm-2 control-label">Difficulty</label>
<div class="col-sm-10">
<select class="form-control forcedDifficulty" data-field="forcedDifficulty" value="<%- (forcedDifficulty || '') %>">
<%= ["", "Recruit", "Regular", "Veteran", "Custom"].map(function (difficulty) {
var selected = difficulty == forcedDifficulty ? 'selected' : '';
return '<option value="' + difficulty + '" ' + selected + '>' + (difficulty || 'Not set') + '</option>';
}).join('\n') %>
</select>
<p class="help-block">Difficulty that is always used unless mission rotation states otherwise</p>
</div>
</div>
<div class="form-group">
<label for="headless-clients" class="col-sm-2 control-label">Headless Clients</label>
<div class="col-sm-10">