aboutsummaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2024-08-15 08:29:24 +0300
committerRblSb <msrblsb@gmail.com>2024-08-15 08:33:17 +0300
commit4ac52a44ced3691581a1390bbdbdc0906074b3f3 (patch)
treedb18acc64e20d5837c0ef92787ccf8ab1eb6af2d /src/client
parent38cc0a1d9b4b146af7110c681389378fd26761fa (diff)
Add uuids for better reconection
Kick zombie users with same uuids. Minimal node version is 14.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/ClientSettings.hx1
-rw-r--r--src/client/Main.hx8
2 files changed, 8 insertions, 1 deletions
diff --git a/src/client/ClientSettings.hx b/src/client/ClientSettings.hx
index 8403ff3..a004213 100644
--- a/src/client/ClientSettings.hx
+++ b/src/client/ClientSettings.hx
@@ -2,6 +2,7 @@ package client;
typedef ClientSettings = {
version:Int,
+ uuid:Null<String>,
name:String,
hash:String,
isExtendedPlayer:Bool,
diff --git a/src/client/Main.hx b/src/client/Main.hx
index 8cdd914..6d50b5e 100644
--- a/src/client/Main.hx
+++ b/src/client/Main.hx
@@ -61,6 +61,7 @@ class Main {
final defaults:ClientSettings = {
version: SETTINGS_VERSION,
+ uuid: null,
name: "",
hash: "",
isExtendedPlayer: false,
@@ -124,7 +125,8 @@ class Main {
final port = Browser.location.port;
final colonPort = port.length > 0 ? ':$port' : port;
final path = Browser.location.pathname;
- ws = new WebSocket('$protocol//$host$colonPort$path');
+ final query = settings.uuid == null ? "" : '?uuid=${settings.uuid}';
+ ws = new WebSocket('$protocol//$host$colonPort$path$query');
ws.onmessage = onMessage;
ws.onopen = () -> {
disconnectNotification?.stop();
@@ -585,6 +587,10 @@ class Main {
function onConnected(data:WsEvent):Void {
final connected = data.connected;
+
+ settings.uuid = connected.uuid;
+ Settings.write(settings);
+
globalIp = connected.globalIp;
setConfig(connected.config);
if (connected.isUnknownClient) {
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage