Skip to content
Permalink
Browse files

Quick launching servers.

  • Loading branch information...
roncli committed Jul 14, 2015
1 parent f45d004 commit 2f214a99c0027bef36a4b533e19168a0e04a1f42
Showing with 350 additions and 293 deletions.
  1. +1 −1 public/index.htm
  2. +0 −290 public/js/angular-1.4.1.min.js
  3. +290 −0 public/js/angular-1.4.2.min.js
  4. +28 −0 public/js/ddsn.js
  5. +17 −0 public/templates/add-server-saved.htm
  6. +14 −2 websocket.js
@@ -2,7 +2,7 @@
<head>
<script src="/js/jquery-2.1.4.min.js"></script>
<script src="/js/bootstrap-3.3.5.min.js"></script>
<script src="/js/angular-1.4.1.min.js"></script>
<script src="/js/angular-1.4.2.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-override.css"/>

This file was deleted.

Large diffs are not rendered by default.

@@ -556,6 +556,34 @@ var app = angular.module("ddsn", []),
data.settings.addServer.allowed.shipsValid = data.settings.addServer.allowed.ships.blackpyro || data.settings.addServer.allowed.ships.magnumaht || data.settings.addServer.allowed.ships.phoenix || data.settings.addServer.allowed.ships.pyrogl;
};

$scope.deleteSavedServer = function(server) {
data.settings.savedServers.splice(data.settings.savedServers.indexOf(server), 1);

ws.send(JSON.stringify({
message: "settings.deletesavedserver",
saveServerName: server.saveServerName
}));
};

$scope.quickLaunchServer = function(server) {
data.settings.addServer = JSON.stringify(JSON.parse(server));

data.settings.addServer.server.port = 2092;
data.settings.addServer.server.gamespyport = 20143;

while (data.servers.filter($scope.checkPort).length > 0) {
data.settings.addServer.server.port++;
}

while (data.servers.filter($scope.checkGameSpyPort).length > 0) {
data.settings.addServer.server.gamespyport++;
}

data.settings.addServer.saveServerName = undefined;

$scope.launchServer();
};

$scope.launchServer = function() {
var server, savedServer;

@@ -0,0 +1,17 @@
<div ng-if="data.settings.savedServers.length === 0" class="text-center">You do not have any saved servers to quick launch.</div>
<div ng-if="data.settings.savedServers.length > 0">
<table class="table table-condensed">
<tr>
<td colspan="2">Select a server to quick launch. Servers will be launched on port 2092 and GameSpy port 20143, or the first available port not in use.</td>
</tr>
<tr ng-repeat="server as data.settings.savedServers">
<td class="text-right">
{{server.saveServerName}}
</td>
<td>
<button class="btn btn-success" ng-click="quickLaunchServer(server)">Quick Launch</button>
<button class="btn btn-danger" ng-click="deleteSavedServer(server)"><span class="glyphicon glyphicon-remove"></span></button>
</td>
</tr>
</table>
</div>
@@ -134,7 +134,8 @@ module.exports = function() {

// Parse any messages.
ws.on("message", function(data) {
var message = JSON.parse(data);
var message = JSON.parse(data),
savedServer;

switch (message.message) {
case "initialize":
@@ -255,7 +256,7 @@ module.exports = function() {
break;
case "launchserver":
randomPassword(function(err, password) {
var launcher, savedServer, serverData, server;
var launcher, serverData, server;

if (err) {
ws.send(JSON.stringify({
@@ -885,6 +886,17 @@ module.exports = function() {
});
}

break;
case "settings.deletesavedserver":
savedServer = settings.savedServers.filter(function(server) {
return server.saveServerName === message.saveServerName;
});

if (savedServer.length > 0) {
settings.savedServers.splice(settings.savedServers.indexOf(savedServer), 1);
writeSettings(settings);
}

break;
case "settings.descent3.path":
if (!settings.descent3) {

0 comments on commit 2f214a9

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