var vars = {\r
base_path: config.get().http_base_path || '/kiwi',\r
cache_buster: Math.ceil(Math.random() * 9000).toString(),\r
- server_settings: '{}',\r
- client_plugins: '[]'\r
+ server_settings: {},\r
+ client_plugins: []\r
};\r
\r
// Any restricted server mode set?\r
if (config.get().restrict_server) {\r
- vars.server_settings = JSON.stringify({\r
+ vars.server_settings = {\r
connection: {\r
server: config.get().restrict_server,\r
port: config.get().restrict_server_port || 6667,\r
nick: config.get().restrict_server_nick,\r
allow_change: false\r
}\r
- });\r
+ };\r
+}\r
+\r
+// Any client default settings?\r
+if (config.get().client) {\r
+ vars.server_settings.client = config.get().client;\r
}\r
\r
// Any client plugins?\r
if (config.get().client_plugins && config.get().client_plugins.length > 0) {\r
- vars.client_plugins = JSON.stringify(config.get().client_plugins);\r
+ vars.client_plugins = config.get().client_plugins;\r
}\r
\r
_.each(vars, function(value, key) {\r
+ if (typeof value === 'object') value = JSON.stringify(value);\r
index_src = index_src.replace(new RegExp('<%' + key + '%>', 'g'), value);\r
});\r
\r
this.populateDefaultServerSettings = function () {\r
var parts;\r
var defaults = {\r
- nick: getQueryVariable('nick') || 'kiwi_' + Math.ceil(Math.random() * 10000).toString(),\r
+ nick: getQueryVariable('nick') || 'kiwi_?',\r
server: 'irc.kiwiirc.com',\r
port: 6667,\r
ssl: false,\r
};\r
var uricheck;\r
\r
+\r
+ /**\r
+ * Get any settings set by the server\r
+ * These settings may be changed in the server selection dialog\r
+ */\r
+ if (this.server_settings.client) {\r
+ if (this.server_settings.client.nick)\r
+ defaults.nick = this.server_settings.client.nick;\r
+\r
+ if (this.server_settings.client.server)\r
+ defaults.server = this.server_settings.client.server;\r
+\r
+ if (this.server_settings.client.port)\r
+ defaults.port = this.server_settings.client.port;\r
+\r
+ if (this.server_settings.client.ssl)\r
+ defaults.ssl = this.server_settings.client.ssl;\r
+\r
+ if (this.server_settings.client.channel)\r
+ defaults.channel = this.server_settings.client.channel;\r
+ }\r
+\r
+\r
+\r
+ /**\r
+ * Get any settings passed in the URL\r
+ * These settings may be changed in the server selection dialog\r
+ */\r
+\r
// Process the URL part by part, extracting as we go\r
parts = window.location.pathname.toString().replace(this.get('base_path'), '').split('/');\r
\r
}\r
\r
// If any settings have been given by the server.. override any auto detected settings\r
+ /**\r
+ * Get any server restrictions as set in the server config\r
+ * These settings can not changed in the server selection dialog\r
+ */\r
if (this.server_settings && this.server_settings.connection) {\r
if (this.server_settings.connection.server) {\r
defaults.server = this.server_settings.connection.server;\r
* Reverse proxies that have been reported to work can be found at:
* http://github.com/prawnsalad/KiwiIRC/wiki/Running-behind-a-proxy
*/
+
// Whitelisted HTTP proxies in CIDR format
conf.http_proxies = ["127.0.0.1/32"];
conf.quit_message = "http://www.kiwiirc.com/ - A hand-crafted IRC client";
+// Default settings for the client. These may be changed in the browser
+conf.client = {
+ server: 'irc.kiwiirc.com',
+ port: 6697,
+ ssl: true,
+ channel: '#kiwiirc',
+ nick: 'kiwi_?'
+};
+
+
// If not empty, the client may only connect to this 1 IRC server
//conf.restrict_server = "irc.kiwiirc.com";
//conf.restrict_server_port = 6667;
//conf.restrict_server_nick = "kiwi_";
+
+
/*
* Do not ammend the below lines unless you understand the changes!
*/