<link rel="stylesheet" type="text/css" href="css/touchscreen_tweaks.css">\r
<?php } ?>\r
\r
-<script src="http://<?php echo $node_server; ?>:7777/socket.io/socket.io.js"></script>\r
+<script type="text/javascript">var kiwi_server = 'https://<?php echo $node_server; ?>:7777/';</script>\r
+<script src="https://<?php echo $node_server; ?>:7777/socket.io/socket.io.js"></script>\r
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>\r
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>\r
<script type="text/javascript" src="js/jquery.json-2.2.min.js"></script>\r
var agent = '<?php echo $agent; ?>';\r
var touchscreen = <?php echo ($touchscreen) ? 'true' : 'false'; ?>;\r
var init_data = {};\r
- var kiwi_server = 'wss://<?php echo $node_server; ?>:7777/';\r
\r
$(document).ready(function(){\r
if(touchscreen) $('#kiwi').addClass('touchscreen');\r
/*jslint browser: true, confusion: true, sloppy: true, maxerr: 50, indent: 4 */
-/*globals io, $ */
+/*globals io, $, kiwi_server */
var gateway = {
revision: 16,
--- /dev/null
+-----BEGIN CERTIFICATE-----
+MIICKzCCAZQCCQCHW0Kmpb9HBTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJH
+QjERMA8GA1UEChMIS2l3aSBJUkMxFzAVBgNVBAMTDktpd2kgV3JhbmdsZXJzMR8w
+HQYJKoZIhvcNAQkBFhBraXdpQGtpd2lpcmMuY29tMB4XDTExMDcxNjE1NDQxM1oX
+DTExMDgxNTE1NDQxM1owWjELMAkGA1UEBhMCR0IxETAPBgNVBAoTCEtpd2kgSVJD
+MRcwFQYDVQQDEw5LaXdpIFdyYW5nbGVyczEfMB0GCSqGSIb3DQEJARYQa2l3aUBr
+aXdpaXJjLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0h+kOA69tiJD
+u0COP0Wh0I9wVqAENQlRA5GowcH7r2Y3D9CbBIguw4Ss48kfXhDQa6sP9qsGvEAR
+kSkHcxIt+BRVtGjmzrZbGzObyOOm8rStcLiYCXas7m5U/mxy4vppL2eAX26az5wy
+f1vYGukhH1XRUdObxNNnLoNDWPJG8+sCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBU
+fARp2ZADZ89EiqUTRsCe8b8gXTO0Z3ov9LFTYhlpwH0RZ3fn9sE9A4mwrRlJC44W
+Z21sflIuXNFDerraedmx+fQwmwNBR6MMJgVN5nYw/x24QJf0C7ujIZrs4lxJdqwf
+yBRE6B7pJYPkk+aPHx/LSsbi9avMBfW+LQtkVOCuZg==
+-----END CERTIFICATE-----
--- /dev/null
+{
+ "port": 7777,
+ "listen_ssl": true,
+ "ssl_key": "server.key",
+ "ssl_cert": "cert.pem",
+ "quit_message": "KiwiIRC",
+ "cap_options": []
+}
var tls = require('tls'),
net = require('net'),
http = require('http'),
+ fs = require('fs'),
ws = require('socket.io'),
_ = require('./lib/underscore.min.js'),
starttls = require('./lib/starttls.js');
+asdf = fs.readFileSync('config.json', 'ascii')
+console.log(asdf, typeof asdf);
+var config = JSON.parse(asdf);
+console.log(config);
+
var ircNumerics = {
RPL_WELCOME: '001',
RPL_ISUPPORT: '005',
websocket.emit('message', {event: 'msg', nick: msg.nick, ident: msg.ident, hostname: msg.hostname, channel: msg.params.trim(), msg: msg.trailing});
break;
case 'CAP':
- caps = [];
+ caps = config.cap_options;
options = msg.trailing.split(" ");
switch (_.first(msg.params.split(" "))) {
case 'LS':
var ircSocketDataHandler = function (data, websocket, ircSocket) {
var i;
- data = data.split("\r\n");
+ if ((ircSocket.holdLast) && (ircSocket.held !== '')) {
+ data = ircSocket.held + data;
+ ircSocket.holdLast = false;
+ ircSocket.held = '';
+ }
+ if (data.substring(data.length-2,0) === '\r\n') {
+ ircSocket.holdLast = true;
+ }
+ data = data.split("\r\n");
for (i = 0; i < data.length; i++) {
if (data[i]) {
+ if ((ircSocket.holdLast) && (i === data.length-1)) {
+ ircSocket.held = data[i];
+ break;
+ }
console.log("->" + data[i]);
parseIRCMessage(websocket, ircSocket, data[i]);
}
};
//setup websocket listener
-var io = ws.listen(7777, {secure: true});
+if (config.listen_ssl) {
+ var io = ws.listen(config.port, {secure: true, key: fs.readFileSync(config.ssl_key), cert: fs.readFileSync(config.ssl_cert)});
+} else {
+ var io = ws.listen(config.port, {secure: false});
+}
io.sockets.on('connection', function (websocket) {
websocket.on('irc connect', function (nick, host, port, ssl, callback) {
var ircSocket;
});
websocket.on('disconnect', function () {
if ((!websocket.sentQUIT) && (websocket.ircSocket)) {
- websocket.ircSocket.end('QUIT :KiwiIRC\r\n');
+ websocket.ircSocket.end('QUIT :' + config.quit_messages + '\r\n');
websocket.sentQUIT = true;
websocket.ircSocket.destroySoon();
}
--- /dev/null
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQDSH6Q4Dr22IkO7QI4/RaHQj3BWoAQ1CVEDkajBwfuvZjcP0JsE
+iC7DhKzjyR9eENBrqw/2qwa8QBGRKQdzEi34FFW0aObOtlsbM5vI46bytK1wuJgJ
+dqzublT+bHLi+mkvZ4BfbprPnDJ/W9ga6SEfVdFR05vE02cug0NY8kbz6wIDAQAB
+AoGBANBlPVOzmwfWd+JxJiMuhkv41uuzDDklokmt3vc70sik0ZtHw1b9UZPsNCQ+
+RnPerTb7k3uLJ8TwrfuP+6lusFL8bwzXBaPZOZmSf2aQz8o6MAyY8B8gxjDi/NoW
+b5jtpXGFNayjc5O7tDjBsd/g88vk3EjnpJZ0P4H3gC+hhCCRAkEA7lGFVou8/ht7
+vTpbHEP13mjYG7OUmJqTXavkrit9UDDcZukt6I7TAB42LPyI7DnjB8i358bdmQQj
+x4R1mNZadQJBAOG2msKY+PFQGUpP18HlFze7JPbc0L5CLeiVIrXV9+xY7FgyGzwU
+UvI9ZyHhqzsgU2/9yW2+beaS8S8LCkGAiN8CQQCcmfMNiOua6wJnuQYPz9Sr3qdL
+pLjbgo+duQufK7K/1CuwcD+bluauKCwfaZ6r4+n8vneilXoeR6sfOzpvQUPVAkBJ
+ZJUB/bfEz6TJkxi3BYT9LC8izj5Z/y7qV8QHmGGbSnbfXruYV4t5FRo53CVPfn1j
+BwS+WJNnzBP8lfxpvB/FAkAf6mPKzWlMnWYXg6gII9lQZQ1EIn258Hi7vrFw9+Ic
+lDbndynaxh97wqKoloRckXF3D9FZM0w7YIS541Cih42u
+-----END RSA PRIVATE KEY-----