aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/Main.hx13
-rw-r--r--src/server/Main.hx11
2 files changed, 14 insertions, 10 deletions
diff --git a/src/client/Main.hx b/src/client/Main.hx
index aa0a648..a95a9a2 100644
--- a/src/client/Main.hx
+++ b/src/client/Main.hx
@@ -2,8 +2,8 @@ package client;
import haxe.Timer;
import js.html.MouseEvent;
-import js.html.ButtonElement;
import js.html.KeyboardEvent;
+import js.html.Event;
import js.html.Element;
import haxe.Json;
import js.html.InputElement;
@@ -33,11 +33,13 @@ class Main {
static function main():Void new Main();
- public function new(?host:String, port = 4201) {
+ public function new(?host:String, ?port:String) {
player = new Player(this);
if (host == null) host = Browser.location.hostname;
if (host == "") host = "localhost";
this.host = host;
+ if (port == null) port = Browser.location.port;
+ if (port == "") port = "80";
initListeners();
onTimeGet.run = () -> {
@@ -56,7 +58,7 @@ class Main {
});
}
- function openWebSocket(host:String, port:Int):Void {
+ function openWebSocket(host:String, port:String):Void {
ws = new WebSocket('ws://$host:$port');
ws.onmessage = onMessage;
ws.onopen = () -> {
@@ -89,8 +91,8 @@ class Main {
});
}
- ge("#queue_next").onclick = (e:MouseEvent) -> addVideoUrl(false);
- ge("#queue_end").onclick = (e:MouseEvent) -> addVideoUrl(true);
+ ge("#queue_next").onclick = e -> addVideoUrl(false);
+ ge("#queue_end").onclick = e -> addVideoUrl(true);
ge("#mediaurl").onkeydown = function(e:KeyboardEvent) {
if (e.keyCode == 13) addVideoUrl(true);
}
@@ -361,6 +363,7 @@ class Main {
function hideGuestLoginPanel():Void {
ge("#guestlogin").style.display = "none";
ge("#chatline").style.display = "block";
+ js.Browser.window.dispatchEvent(new Event("resize"));
}
function updateClients(newClients:Array<ClientData>):Void {
diff --git a/src/server/Main.hx b/src/server/Main.hx
index 1e2094e..b5fe3a6 100644
--- a/src/server/Main.hx
+++ b/src/server/Main.hx
@@ -34,14 +34,12 @@ class Main {
static function main():Void new Main();
- public function new(port = 4200, wsPort = 4201) {
+ public function new(port = 4200, ?wsPort:Int) {
final envPort = (process.env : Dynamic).PORT;
if (envPort != null) port = envPort;
statePath = '$rootDir/user/state.json';
config = getUserConfig();
loadState();
- wss = new WSServer({port: wsPort});
- wss.on("connection", onConnect);
function exit() {
saveState();
process.exit();
@@ -77,9 +75,12 @@ class Main {
HttpServer.init(dir, '$rootDir/user/res');
Lang.init('$dir/langs');
- Http.createServer((req, res) -> {
+ final server = Http.createServer((req, res) -> {
HttpServer.serveFiles(req, res);
- }).listen(port);
+ });
+ server.listen(port);
+ wss = new WSServer({server: server, port: wsPort});
+ wss.on("connection", onConnect);
}
function getUserConfig():Config {
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage