\r
}\r
#kiwi #login input[type=checkbox] { width:auto !important; }\r
-#kiwi #login .more { border-top: 1px dotted #888888; }\r
+#kiwi #login .more { border-top: 1px dotted #888888; font-size: 0.9em;}\r
#kiwi #login .more_link {\r
font-size:12px;\r
position:relative;\r
Tabview.getServerTab().addMsg(null, ' ', '=== Failed to connect :(', 'status');\r
kiwi.plugs.run('connect', {success: false});\r
}\r
+\r
+ // Now that we're connected, warn the user if they really want to quit\r
+ window.onbeforeunload = function() {\r
+ return "Are you sure you leave Kiwi IRC?";\r
+ };\r
},\r
onConnectFail: function (e, data) {\r
var reason = (typeof data.reason === 'string') ? data.reason : '';\r
kiwi.front.ui.registerKeys();
- window.onbeforeunload = function() {
- return "Are you sure you leave Kiwi IRC?";
- };
-
$('#kiwi .toolbars').resize(kiwi.front.ui.doLayoutSize);
$(window).resize(kiwi.front.ui.doLayoutSize);
this.httpHandler = function (request, response) {
var uri, uri_parts, subs, useragent, agent, server_set, server, nick, debug, touchscreen, hash,
- min = {}, public_http_path, port, ssl,
+ min = {}, public_http_path, port, ssl, host, obj, args,
secure = (typeof request.client.encrypted === 'object');
//try {
if (kiwi.config.handle_http) {
+ // Run through any plugins..
+ args = {request: request, response: response};
+ obj = kiwi.kiwi_mod.run('http', args);
+ if (obj === null) {
+ return;
+ }
+ response = args.response;
+
uri = url.parse(request.url, true);
uri_parts = uri.pathname.split('/');
debug = (typeof uri.query.debug !== 'undefined');
port = 6667;
- ssl = false;
+ ssl = (typeof request.socket.pair !== 'undefined');
if (uri_parts[1] !== 'client') {
if (uri.query) {
server_set = ((typeof uri.query.server !== 'undefined') && (uri.query.server !== ''));
hs.listen(port.number, host);
console.log("Listening on %s:%d without SSL", host, port.number);
}
+
+ kiwi.httpServers.push(hs);
});
_.each(kiwi.io, function (io) {
label(for="port") Port:
input(type="text", id="port", name="port", class="port", value=port)
li
- label(for="password") Server password:
+ label(for="password") Password:
input(type="text", id="password", name="password", class="password")
li
label(for="ssl") SSL:
function addEvents(){
- $('.more_link').click(function(){ $('.content.bottom').slideDown('fast'); $('.network').focus(); return false; });
+ $('.more_link').click(function(){ $('.content.bottom').slideDown('fast'); $('.channel').focus(); return false; });
$('a.connect').click(function(){ $('.formconnectwindow').submit(); return false; });
var input_submit = function(e){
$('.formconnectwindow .channel').keydown(input_submit);
$('.formconnectwindow .network').keydown(input_submit);
$('.formconnectwindow .port').keydown(input_submit);
+ $('.formconnectwindow .password').keydown(input_submit);
}
--- /dev/null
+/*
+ * forcessl Kiwi module
+ * Force clients to use an SSL port by redirecting them
+ */
+
+var kiwi = require('../kiwi.js');
+
+
+exports.onhttp = function (ev) {
+ // TODO: request.socket.pair seems to only be set in a SSL req, is this
+ // the best way to check for this?
+ if (typeof ev.request.socket.pair === 'undefined') {
+ host = ev.request.headers.host;
+ //port = 443;
+
+ if (host.search(/:/)) {
+ //port = parseInt(host.substring(host.search(/:/) + 1), 10);
+ host = host.substring(0, host.search(/:/));
+ }
+ if (kiwi.config.ports[0].number != 443) {
+ for (i in kiwi.config.ports) {
+ if (kiwi.config.ports[i].secure) {
+ host += ':' + kiwi.config.ports[0].number.toString();
+ break;
+ }
+ }
+ }
+
+ console.log('https://' + host + ev.request.url);
+ ev.response.writeHead(302, {'Location': 'https://' + host + ev.request.url});
+ ev.response.end();
+
+ return null;
+ }
+
+ return ev;
+}
\ No newline at end of file