Changeset

3314:ab67f222d88b

mod_conversejs: Add an endpoint returning only initialization snippet
author Kim Alvefur <zash@zash.se>
date Mon, 10 Sep 2018 15:08:09 +0200
parents 3313:d6b922191aeb
children 3315:bbf20293bc43
files mod_conversejs/mod_conversejs.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_conversejs/mod_conversejs.lua	Mon Sep 10 15:07:07 2018 +0200
+++ b/mod_conversejs/mod_conversejs.lua	Mon Sep 10 15:08:09 2018 +0200
@@ -76,6 +76,13 @@
 			event.response.headers.content_type = "text/html";
 			return html_template:format(js_template:format(json_encode(converse_options)));
 		end;
+
+		["GET /prosody-converse.js"] = function (event)
+			local converse_options = get_converse_options();
+
+			event.response.headers.content_type = "application/javascript";
+			return js_template:format(json_encode(converse_options));
+		end;
 	}
 });