Skip to content
Permalink
Browse files

Add server page mostly functional, need to add trackers.

  • Loading branch information...
roncli committed Jun 28, 2015
1 parent edced27 commit b46818f3ffce4e000e7cae122789d0de05290fb9
@@ -0,0 +1,7 @@
.input-group-addon:first-child {
border-left: none;
}

.input-group-addon:last-child {
border-right: none;
}
@@ -4,7 +4,8 @@
<script src="/js/bootstrap-3.3.5.min.js"></script>
<script src="/js/angular-1.3.16.min.js"></script>
<script src="/js/ddsn.js"></script>
<link rel="stylesheet" href="/css/bootstrap-slate-3.3.5.min.css" />
<link rel="stylesheet" href="/css/bootstrap-slate-3.3.5.min.css"/>
<link rel="stylesheet" href="/css/bootstrap-override.css"/>
</head>
<body>
<div class="jumbotron text-center">
@@ -151,6 +151,20 @@ var app = angular.module("ddsn", []),
data.settingsMenuTab = screen;
};

$scope.updateAddServerServerPort = function() {
data.settings.addServer.server.portValid = typeof data.settings.addServer.server.port === "number" && data.settings.addServer.server.port >= 0 && data.settings.addServer.server.port <= 65535 && data.settings.addServer.server.port % 1 === 0;
data.settings.addServer.server.portsDiffer = data.settings.addServer.server.port !== data.settings.addServer.server.gamespyport;
};

$scope.updateAddServerServerGamespyport = function() {
data.settings.addServer.server.gamespyportValid = typeof data.settings.addServer.server.gamespyport === "number" && data.settings.addServer.server.gamespyport >= 0 && data.settings.addServer.server.gamespyport <= 65535 && data.settings.addServer.server.gamespyport % 1 === 0;
data.settings.addServer.server.portsDiffer = data.settings.addServer.server.port !== data.settings.addServer.server.gamespyport;
};

$scope.updateAddServerServerFramerate = function() {
data.settings.addServer.server.framerateValid = typeof data.settings.addServer.server.framerate === "number" && data.settings.addServer.server.framerate >= 1 && data.settings.addServer.server.framerate <= 999 && data && data.settings.addServer.server.framerate % 1 === 0;
};

$scope.updateSettingsDescent3Path = function() {
ws.send(JSON.stringify({
message: "settings.descent3.path",
@@ -7,15 +7,15 @@
</select>
</span>
</div>
<div class="input-group">
<div ng-class="{true: 'input-group', false: 'input-group has-error'}[data.settings.addServer.server.portValid && data.settings.addServer.server.portsDiffer]">
<span class="input-group-addon">Server port:</span>
<input type="number" min="0" max="65535" class="form-control" placeholder="Port between 0 and 65535" ng-model="data.settings.addServer.server.port" ng-blur="updateAddServerServerPort()" />
</div>
<div class="input-group">
<div ng-class="{true: 'input-group', false: 'input-group has-error'}[data.settings.addServer.server.gamespyportValid && data.settings.addServer.server.portsDiffer]">
<span class="input-group-addon">GameSpy port:</span>
<input type="number" min="0" max="65535" class="form-control" placeholder="GameSpy port between 0 and 65535" ng-model="data.settings.addServer.server.gamespyport" ng-blur="updateAddServerServerGamespyport()" />
</div>
<div class="input-group">
<div ng-class="{true: 'input-group', false: 'input-group has-error'}[data.settings.addServer.server.framerateValid]">
<span class="input-group-addon">Server framerate:</span>
<input type="number" min="1" max="999" class="form-control" placeholder="Frames per second between 1 and 999" ng-model="data.settings.addServer.server.framerate" ng-blur="updateAddServerServerFramerate()" />
</div>
@@ -30,4 +30,8 @@
<span class="input-group-addon" style="width: 100%; text-align: left;">
<input type="checkbox" ng-model="data.settings.addServer.server.playerMessages" />
</span>
</div>
</div><br/>
<div class="alert alert-danger" role="alert" ng-if="!data.settings.addServer.server.portValid"><span class="glyphicon glyphicon-alert"></span> You must enter a valid port between 0 and 65535.</div>
<div class="alert alert-danger" role="alert" ng-if="!data.settings.addServer.server.gamespyportValid"><span class="glyphicon glyphicon-alert"></span> You must enter a valid GameSpy port between 0 and 65535.</div>
<div class="alert alert-danger" role="alert" ng-if="!data.settings.addServer.server.portsDiffer"><span class="glyphicon glyphicon-alert"></span> Port and GameSpy port must be different.</div>
<div class="alert alert-danger" role="alert" ng-if="!data.settings.addServer.server.framerateValid"><span class="glyphicon glyphicon-alert"></span> You must enter a framerate between 1 and 999.</div>
@@ -1,5 +1,5 @@
<div ng-class="{true: 'input-group', false: 'input-group has-error'}[data.settings.descent3.pathValid]">
<span class="input-group-addon">Enter the path to your Descent 3 folder:</span>
<input type="text" class="form-control" placeholder="Your Descent 3 folder" ng-model="data.settings.descent3.path" ng-blur="updateSettingsDescent3Path()" />
</div>
</div><br />
<div class="alert alert-danger" role="alert" ng-if="!data.settings.descent3.pathValid"><span class="glyphicon glyphicon-alert"></span> Could not find Descent 3 in the directory specified.</div>
@@ -4,6 +4,7 @@ var cluster = require("cluster"),
fs = require("fs"),
path = require("path"),
os = require("os"),
net = require("net"),
Launcher = require("descent3launcher");

module.exports = function() {
@@ -70,8 +71,12 @@ module.exports = function() {
}

// Get default settings.
settings.default = Launcher.defaultOptions;
settings.addServer = Launcher.defaultOptions;
settings.default = JSON.parse(JSON.stringify(Launcher.defaultOptions));
settings.default.server.portValid = true;
settings.default.server.gamespyportValid = true;
settings.default.server.portsDiffer = true;
settings.default.server.framerateValid = true;
settings.addServer = JSON.parse(JSON.stringify(settings.default));

// Get network interfaces.
settings.interfaces = [];

0 comments on commit b46818f

Please sign in to comment.
You can’t perform that action at this time.