From cc0bbc64ab7a1c8243436f7cde50bb084a8d506a Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Tue, 3 Oct 2023 16:34:28 +0200 Subject: [PATCH] accept config info from server.ini (e. g. login url) --- src/js/client-framework.js | 5 +++-- src/js/message-factory.js | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/js/client-framework.js b/src/js/client-framework.js index 47f4f1c6..e71dc4e0 100644 --- a/src/js/client-framework.js +++ b/src/js/client-framework.js @@ -75,7 +75,8 @@ marauroa.clientFramework = { console.log("onDisconnect: " + reason + " error: " + error); }, - onLoginRequired: function() { + onLoginRequired: function(config) { + console.log("Config", config); // a login is required }, @@ -90,7 +91,7 @@ marauroa.clientFramework = { }, onServerInfo: function(contents) { - console.log("ServerInfo", contents); + // console.log("ServerInfo", contents); }, onPreviousLogins: function(previousLogins) { diff --git a/src/js/message-factory.js b/src/js/message-factory.js index 6383c59a..ad1e4283 100644 --- a/src/js/message-factory.js +++ b/src/js/message-factory.js @@ -44,8 +44,12 @@ marauroa.messageFactory = new function() { // Message S2C Send Key this["t15"] = function() { - console.log("Server send key: ", this); - marauroa.clientFramework.onLoginRequired(); + let config = {}; + for (let entry of this["config"]) { + let pos = entry.indexOf("="); + config[entry.substring(0, pos).trim()] = entry.substring(pos + 1).trim(); + } + marauroa.clientFramework.onLoginRequired(config); } // Message S2C Perception