annotate mod_http_libjs/mod_http_libjs.lua @ 4210:a0937b5cfdcb

mod_invites_page: Remove preauth URI button This button is incompatible with the majority of XMPP clients around, yet based on feedback from users, many are drawn to click it when they have any XMPP client installed already. In the case where the user already has software installed, we would prefer them to select it from the software list so they can follow the setup process suited to their specific client (we already track which software supports preauth URIs). If their client is not listed, they can still use the manual registration link instead.
author Matthew Wild <mwild1@gmail.com>
date Fri, 16 Oct 2020 11:03:38 +0100
parents de2390d6bbe4
children f0efbb0b0b5b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4087
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 local mime_map = module:shared("/*/http_files/mime").types or {
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2 css = "text/css",
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 js = "application/javascript",
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 };
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5
4095
de2390d6bbe4 mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents: 4087
diff changeset
6 local serve;
de2390d6bbe4 mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents: 4087
diff changeset
7 if not pcall(function ()
de2390d6bbe4 mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents: 4087
diff changeset
8 local http_files = require "net.http.files";
de2390d6bbe4 mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents: 4087
diff changeset
9 serve = http_files.serve;
de2390d6bbe4 mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents: 4087
diff changeset
10 end) then
de2390d6bbe4 mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents: 4087
diff changeset
11 serve = module:depends"http_files".serve;
de2390d6bbe4 mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents: 4087
diff changeset
12 end
de2390d6bbe4 mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents: 4087
diff changeset
13
4087
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 local libjs_path = module:get_option_string("libjs_path", "/usr/share/javascript");
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
16 module:provides("http", {
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
17 default_path = "/share";
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
18 route = {
4095
de2390d6bbe4 mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents: 4087
diff changeset
19 ["GET /*"] = serve({ path = libjs_path, mime_map = mime_map });
4087
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
20 }
88a469b285f5 mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
21 });