aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Types.hx1
-rw-r--r--src/client/Main.hx4
-rw-r--r--src/server/Main.hx14
3 files changed, 10 insertions, 9 deletions
diff --git a/src/Types.hx b/src/Types.hx
index 41d5340..a98c7a1 100644
--- a/src/Types.hx
+++ b/src/Types.hx
@@ -8,6 +8,7 @@ typedef VideoData = {
}
typedef Config = {
+ port:Int,
channelName:String,
maxLoginLength:Int,
maxMessageLength:Int,
diff --git a/src/client/Main.hx b/src/client/Main.hx
index 8ec1704..1552d38 100644
--- a/src/client/Main.hx
+++ b/src/client/Main.hx
@@ -2,11 +2,11 @@ package client;
import haxe.crypto.Sha256;
import haxe.Timer;
+import haxe.Json;
import js.html.MouseEvent;
import js.html.KeyboardEvent;
import js.html.Event;
import js.html.Element;
-import haxe.Json;
import js.html.InputElement;
import js.html.WebSocket;
import js.Browser;
@@ -38,7 +38,7 @@ class Main {
static function main():Void new Main();
- public function new(?host:String, ?port:String) {
+ function new(?host:String, ?port:String) {
player = new Player(this);
if (host == null) host = Browser.location.hostname;
if (host == "") host = "localhost";
diff --git a/src/server/Main.hx b/src/server/Main.hx
index 033e2a0..5cac674 100644
--- a/src/server/Main.hx
+++ b/src/server/Main.hx
@@ -1,11 +1,9 @@
package server;
import haxe.crypto.Sha256;
-import js.lib.Date;
import sys.FileSystem;
import sys.io.File;
import haxe.Timer;
-import Client.ClientData;
import haxe.Json;
import js.Node.process;
import js.Node.__dirname;
@@ -13,6 +11,8 @@ import js.npm.ws.Server as WSServer;
import js.npm.ws.WebSocket;
import js.node.http.IncomingMessage;
import js.node.Http;
+import js.lib.Date;
+import Client.ClientData;
import Types.Config;
import Types.Permission;
import Types.UserList;
@@ -43,9 +43,7 @@ class Main {
static function main():Void new Main();
- public function new(port = 4200, ?wsPort:Int) {
- final envPort = (process.env : Dynamic).PORT;
- if (envPort != null) port = envPort;
+ function new() {
statePath = '$rootDir/user/state.json';
// process.on("exit", exit);
process.on("SIGINT", exit); // ctrl+c
@@ -72,7 +70,9 @@ class Main {
config.salt = generateConfigSalt();
localIp = Utils.getLocalIp();
globalIp = localIp;
- this.port = port;
+ port = config.port;
+ final envPort = (process.env : Dynamic).PORT;
+ if (envPort != null) port = envPort;
Utils.getGlobalIp(ip -> {
globalIp = ip;
@@ -88,7 +88,7 @@ class Main {
HttpServer.serveFiles(req, res);
});
server.listen(port);
- wss = new WSServer({server: server, port: wsPort});
+ wss = new WSServer({server: server});
wss.on("connection", onConnect);
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage