Skip to content

Commit

Permalink
accept config info from server.ini (e. g. login url)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhnb committed Oct 3, 2023
1 parent 647082a commit cc0bbc6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/js/client-framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
},

Expand All @@ -90,7 +91,7 @@ marauroa.clientFramework = {
},

onServerInfo: function(contents) {
console.log("ServerInfo", contents);
// console.log("ServerInfo", contents);
},

onPreviousLogins: function(previousLogins) {
Expand Down
8 changes: 6 additions & 2 deletions src/js/message-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cc0bbc6

Please sign in to comment.