From 645fe41b105a0d29f28e4f7f4928fe760b4fd0b1 Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Tue, 13 Aug 2013 22:58:11 +0100 Subject: [PATCH] Have client refetch settings on reconfig --- client/assets/src/models/application.js | 13 +++++++++++++ server/kiwi.js | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/client/assets/src/models/application.js b/client/assets/src/models/application.js index db5e696..b8832ab 100644 --- a/client/assets/src/models/application.js +++ b/client/assets/src/models/application.js @@ -341,6 +341,8 @@ _kiwi.model.Application = function () { this.bindGatewayCommands = function (gw) { + var that = this; + gw.on('onconnect', function (event) { that.view.barsShow(); }); @@ -407,6 +409,17 @@ _kiwi.model.Application = function () { }); })(); + gw.on('kiwi:reconfig', function () { + $.getJSON(that.get('base_path') + '/assets/settings.json', function (data) { + console.log(data); + if (typeof data.kiwi_server !== 'undefined') { + _kiwi.app.kiwi_server = data.kiwi_server; + } + + that.server_settings = data.server_settings || {}; + that.translations = data.translations || {}; + }); + }); }; diff --git a/server/kiwi.js b/server/kiwi.js index 42ef9bc..26d5b9c 100755 --- a/server/kiwi.js +++ b/server/kiwi.js @@ -146,6 +146,13 @@ global.servers = { +config.on('loaded', function () { + for (var client in global.clients.clients) { + global.clients.clients[client].sendKiwiCommand('reconfig'); + } +}); + + /* * Identd server -- 2.25.1