if (!getQueryVariable('debug')) {\r
manageDebug(false);\r
} else {\r
- manageDebug(true);\r
+ //manageDebug(true);\r
}\r
\r
// Set the gateway up\r
// Rejigg the UI sizes\r
this.view.doLayout();\r
\r
- // Populate the server select box with defaults\r
- this.panels.server.server_login.populateFields({\r
- nick: getQueryVariable('nick') || 'kiwi_' + Math.ceil(Math.random() * 10000).toString(),\r
- server: getQueryVariable('server') || 'irc.kiwiirc.com',\r
- port: 6667,\r
- ssl: false,\r
- channel: window.location.hash || '#test'\r
- });\r
+ this.populateDefaultServerSettings();\r
};\r
\r
\r
};\r
\r
\r
+ this.populateDefaultServerSettings = function () {\r
+ var parts;\r
+ var defaults = {\r
+ nick: getQueryVariable('nick') || 'kiwi_' + Math.ceil(Math.random() * 10000).toString(),\r
+ server: 'irc.kiwiirc.com',\r
+ port: 6667,\r
+ ssl: false,\r
+ channel: window.location.hash || '#kiwiirc'\r
+ };\r
+\r
+ // Process the URL part by part, extracting as we go\r
+ parts = window.location.pathname.toString().split('/');\r
+ parts.shift();\r
+\r
+ if (parts.length > 0 && parts[0].toLowerCase() === 'client') {\r
+ parts.shift();\r
+\r
+ if (parts.length > 0 && parts[0]) {\r
+ console.log(3);\r
+ // TODO: Extract the port from this hostname\r
+ defaults.server = parts[0];\r
+ parts.shift();\r
+ }\r
+\r
+ if (parts.length > 0 && parts[0]) {\r
+ defaults.channel = '#' + parts[0];\r
+ parts.shift();\r
+ }\r
+ }\r
+\r
+ // Set any random numbers if needed\r
+ defaults.nick = defaults.nick.replace('?', Math.floor(Math.random() * 100000).toString());\r
+\r
+ // Populate the server select box with defaults\r
+ this.panels.server.server_login.populateFields(defaults);\r
+ };\r
+\r
\r
this.bindGatewayCommands = function (gw) {\r
gw.on('onmotd', function (event) {\r
};
StaticFileServer.prototype.serve = function (request, response) {
+ // Any requests for /client to load the index file
+ if (request.url.match(/^\/client/)) {
+ request.url = '/';
+ }
+
this.fileServer.serve(request, response, function (err) {
if (err) {
response.writeHead(err.status, err.headers);