From 2eec384223bdc30f1b0f47b3fdf6ffe887035589 Mon Sep 17 00:00:00 2001 From: Darren Date: Thu, 8 Nov 2012 15:36:42 +0000 Subject: [PATCH] Moved client plugins into the index.html build process --- client/assets/dev/build.js | 9 ++++++++- client/assets/dev/index.html.tmpl | 10 +++++++++- config.js | 12 ++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/client/assets/dev/build.js b/client/assets/dev/build.js index 8e75dca..698bbb9 100644 --- a/client/assets/dev/build.js +++ b/client/assets/dev/build.js @@ -85,9 +85,11 @@ var index_src = fs.readFileSync(__dirname + '/index.html.tmpl', FILE_ENCODING); var vars = { base_path: config.get().http_base_path, cache_buster: Math.ceil(Math.random() * 9000).toString(), - server_settings: '{}' + server_settings: '{}', + client_plugins: '[]' }; +// Any restricted server mode set? if (config.get().restrict_server) { vars.server_settings = JSON.stringify({ connection: { @@ -101,6 +103,11 @@ if (config.get().restrict_server) { }); } +// Any client plugins? +if (config.get().client_plugins && config.get().client_plugins.length > 0) { + vars.client_plugins = JSON.stringify(config.get().client_plugins); +} + _.each(vars, function(value, key) { index_src = index_src.replace(new RegExp('<%' + key + '%>', 'g'), value); }); diff --git a/client/assets/dev/index.html.tmpl b/client/assets/dev/index.html.tmpl index 7b6f311..95afef5 100644 --- a/client/assets/dev/index.html.tmpl +++ b/client/assets/dev/index.html.tmpl @@ -240,11 +240,19 @@ // Override the kiwi_server to use. (Think: running on standalone client..) //kiwi_server: 'http://kiwiirc.com:80', - server_settings: <%server_settings%> + server_settings: <%server_settings%>, + client_plugins: <%client_plugins%> }; // Start the app kiwi.start(opts); + + // Load any plugins + if (opts.client_plugins && opts.client_plugins.length > 0) { + _.each(opts.client_plugins, function (plugin_url) { + kiwi.plugins.load(plugin_url); + }); + } } diff --git a/config.js b/config.js index 5becf37..ac0ca8d 100644 --- a/config.js +++ b/config.js @@ -44,6 +44,18 @@ conf.public_http = "client/"; // Max connections per connection. 0 to disable conf.max_client_conns = 5; + +/* + * Client side plugins + * Array of URLs that will be loaded into the browser when the client first loads up + * See http://github.com/prawnsalad/KiwiIRC/wiki/Client-plugins + */ +conf.client_plugins = [ + // "http://server.com/kiwi/plugins/myplugin.html" +]; + + + // Enabled CAP extensions (See ENTER URL TO CAP INFO HERE PLS) conf.cap_options = []; -- 2.25.1