}\r
\r
// The base url to the kiwi server\r
- this.set('base_path', options[0].base_path ? options[0].base_path : '/client');\r
+ this.set('base_path', options[0].base_path ? options[0].base_path : '/kiwi');\r
\r
// Best guess at where the kiwi server is\r
this.detectKiwiServer();\r
this.view.barsHide(true);\r
\r
this.panels.server.server_login.bind('server_connect', function (event) {\r
- var server_login = this;\r
+ var server_login = this,\r
+ transport_path = '';\r
auto_connect_details = event;\r
\r
server_login.networkConnecting();\r
\r
- $script(that.kiwi_server + '/socket.io/socket.io.js?ts='+(new Date().getTime()), function () {\r
+ // Path to get the socket.io transport code\r
+ transport_path = that.kiwi_server + that.get('base_path') + '/transport/socket.io.js?ts='+(new Date().getTime());\r
+ \r
+ $script(transport_path, function () {\r
if (!window.io) {\r
kiwiServerNotFound();\r
return;\r
* @param {Function} callback A callback function to be invoked once Kiwi's server has connected to the IRC server\r
*/\r
this.connect = function (host, port, ssl, password, callback) {\r
+ var resource;\r
+\r
+ // Work out the resource URL for socket.io\r
+ if (kiwi.app.get('base_path').substr(0, 1) === '/') {\r
+ resource = kiwi.app.get('base_path');\r
+ resource = resource.substr(1, resource.length-1);\r
+ resource += '/transport';\r
+ } else {\r
+ resource = kiwi.app.get('base_path') + '/transport';\r
+ }\r
+\r
this.socket = io.connect(this.get('kiwi_server'), {\r
+ 'resource': resource,\r
+ \r
'try multiple transports': true,\r
'connect timeout': 3000,\r
'max reconnection attempts': 7,\r
<title> KiwiIRC </title>
-<link rel="stylesheet" type="text/css" href="/client/assets/css/style.css" />
+<link rel="stylesheet" type="text/css" href="/kiwi/assets/css/style.css" />
</head>
<body>
<div id="kiwi">
<div id="toolbar">
<a class="kiwi_logo" href="http://www.kiwiirc.com/" target="_blank">
- <h2><img src="/client/assets/img/ico.png" alt="KiwiIRC Logo" title="Kiwi IRC" /> Powered by Kiwi IRC</h2>
+ <h2><img src="/kiwi/assets/img/ico.png" alt="KiwiIRC Logo" title="Kiwi IRC" /> Powered by Kiwi IRC</h2>
</a>
<div id="tabs">
<div style="position:relative;float:left;width:320px;margin-left:3em;color:#555555;">
<a class="kiwi_logo" href="http://www.kiwiirc.com/" target="_blank">
- <img src="/client/assets/img/ico.png" alt="KiwiIRC Logo" title="Kiwi IRC" /> <br />
+ <img src="/kiwi/assets/img/ico.png" alt="KiwiIRC Logo" title="Kiwi IRC" /> <br />
<h1>Powered by Kiwi IRC</h1>
</a>
}
// Entry path for the kiwi application
- var base_path = '/client';
+ var base_path = '/kiwi';
// Start loading scripts
loadNextScript();
dns = require('dns'),
url = require('url'),
_ = require('underscore'),
+ config = require('./configuration.js'),
Client = require('./client.js').Client,
HttpHandler = require('./httphandler.js').HttpHandler;
var http_handler;
-var WebListener = function (config, transports) {
+var WebListener = function (web_config, transports) {
var hs,
opts,
that = this;
events.EventEmitter.call(this);
- http_handler = new HttpHandler(config);
+ http_handler = new HttpHandler(web_config);
- if (config.ssl) {
+ if (web_config.ssl) {
opts = {
- key: fs.readFileSync(__dirname + '/' + config.ssl_key),
- cert: fs.readFileSync(__dirname + '/' + config.ssl_cert)
+ key: fs.readFileSync(__dirname + '/' + web_config.ssl_key),
+ cert: fs.readFileSync(__dirname + '/' + web_config.ssl_cert)
};
// Do we have an intermediate certificate?
- if (typeof config.ssl_ca !== 'undefined') {
- opts.ca = fs.readFileSync(__dirname + '/' + config.ssl_ca);
+ if (typeof web_config.ssl_ca !== 'undefined') {
+ opts.ca = fs.readFileSync(__dirname + '/' + web_config.ssl_ca);
}
// Start socket.io listening on this weblistener
this.ws = ws.listen(hs, {ssl: true});
- hs.listen(config.port, config.address);
+ hs.listen(web_config.port, web_config.address);
- console.log('Listening on ' + config.address + ':' + config.port.toString() + ' with SSL');
+ console.log('Listening on ' + web_config.address + ':' + web_config.port.toString() + ' with SSL');
} else {
// Start some plain-text server up
// Start socket.io listening on this weblistener
this.ws = ws.listen(hs, {ssl: false});
- hs.listen(config.port, config.address);
+ hs.listen(web_config.port, web_config.address);
- console.log('Listening on ' + config.address + ':' + config.port.toString() + ' without SSL');
+ console.log('Listening on ' + web_config.address + ':' + web_config.port.toString() + ' without SSL');
}
this.ws.set('log level', 1);
this.ws.enable('browser client minification');
this.ws.enable('browser client etag');
this.ws.set('transports', transports);
+ this.ws.set('resource', (config.get().http_base_path || '') + '/transport');
this.ws.of('/kiwi').authorization(authoriseConnection).on('connection', function () {
newConnection.apply(that, arguments);