annotate mod_invites_page/mod_invites_page.lua @ 4398:a16b689525d7

mod_migrate: Allow migrating data not attached to any user / nil user Certain data more related to the server itself is stored with user = nil
author Kim Alvefur <zash@zash.se>
date Tue, 26 Jan 2021 17:18:44 +0100
parents ca099bd28bf5
children 85c11eb4331b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4094
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 local st = require "util.stanza";
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2 local url_escape = require "util.http".urlencode;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 module:depends("http");
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 local base_url = module.http_url and module:http_url();
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 local render_html_template = require"util.interpolation".new("%b{}", st.xml_escape, {
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 urlescape = url_escape;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 lower = string.lower;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 classname = function (s) return (s:gsub("%W+", "-")); end;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 relurl = function (s)
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 if s:match("^%w+://") then
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 return s;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 end
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 return base_url.."/"..s;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
16 end;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
17 });
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
18 local render_url = require "util.interpolation".new("%b{}", url_escape, {
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
19 urlescape = url_escape;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
20 noscheme = function (url)
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
21 return (url:gsub("^[^:]+:", ""));
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
22 end;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
23 });
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
24
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
25 module:depends("register_apps");
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
26
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
27 local site_name = module:get_option_string("site_name", module.host);
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
28 local site_apps = module:shared("register_apps/apps");
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
29
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
30 local http_files;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
31
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
32 if prosody.shutdown then
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
33 module:depends("http");
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
34 http_files = module:depends("http_files");
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
35 end
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
36 local invites = module:depends("invites");
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
37
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
38 -- Point at eg https://github.com/ge0rg/easy-xmpp-invitation
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
39 -- This URL must always be absolute, as it is shared standalone
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
40 local invite_url_template = module:get_option_string("invites_page", base_url and (base_url.."?{invite.token}") or nil);
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
41 -- This URL is relative to the invite page, or can be absolute
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
42 local register_url_template = module:get_option_string("invites_registration_page", "register?t={invite.token}&c={app.id}");
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
43
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
44 local function add_landing_url(invite)
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
45 if not invite_url_template then return; end
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
46 -- TODO: we don't currently have a landing page for subscription-only invites,
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
47 -- so the user will only receive a URI. The client should be able to handle this
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
48 -- by automatically falling back to a client-specific landing page, per XEP-0401.
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
49 if not invite.allow_registration then return; end
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
50 invite.landing_page = render_url(invite_url_template, { host = module.host, invite = invite });
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
51 end
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
52
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
53 module:hook("invite-created", add_landing_url);
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
54
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
55 local function render_app_urls(apps, invite_vars)
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
56 local rendered_apps = {};
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
57 for _, unrendered_app in ipairs(apps) do
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
58 local app = setmetatable({}, { __index = unrendered_app });
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
59 local template_vars = { app = app, invite = invite_vars, base_url = base_url };
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
60 if app.magic_link_format then
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
61 -- Magic link generally links directly to third-party
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
62 app.proceed_url = render_url(app.magic_link_format or app.link or "#", template_vars);
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
63 elseif app.supports_preauth_uri then
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
64 -- Proceed to a page that guides the user to download, and then
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
65 -- click the URI button
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
66 app.proceed_url = render_url("{base_url!}/setup/{app.id}?{invite.token}", template_vars);
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
67 else
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
68 -- Manual means proceed to web registration, but include app id
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
69 -- so it can show post-registration instructions
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
70 app.proceed_url = render_url(register_url_template, template_vars);
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
71 end
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
72 table.insert(rendered_apps, app);
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
73 end
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
74 return rendered_apps;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
75 end
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
76
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
77 function serve_invite_page(event)
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
78 local invite_page_template = assert(module:load_resource("html/invite.html")):read("*a");
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
79 local invalid_invite_page_template = assert(module:load_resource("html/invite_invalid.html")):read("*a");
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
80
4129
ca099bd28bf5 mod_invites_page, mod_invites_register_web: Set correct Content-Type everywhere necessary
Matthew Wild <mwild1@gmail.com>
parents: 4116
diff changeset
81 event.response.headers["Content-Type"] = "text/html; charset=utf-8";
ca099bd28bf5 mod_invites_page, mod_invites_register_web: Set correct Content-Type everywhere necessary
Matthew Wild <mwild1@gmail.com>
parents: 4116
diff changeset
82
4094
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
83 local invite = invites.get(event.request.url.query);
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
84 if not invite then
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
85 return render_html_template(invalid_invite_page_template, {
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
86 site_name = site_name;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
87 static = base_url.."/static";
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
88 });
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
89 end
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
90
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
91 local template_vars = {
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
92 site_name = site_name;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
93 token = invite.token;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
94 uri = invite.uri;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
95 type = invite.type;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
96 jid = invite.jid;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
97 inviter = invite.inviter;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
98 static = base_url.."/static";
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
99 };
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
100 template_vars.apps = render_app_urls(site_apps, template_vars);
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
101
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
102 local invite_page = render_html_template(invite_page_template, template_vars);
4116
05d0a249326a mod_invites_page: Add Link header for URI with rel=alternate
Matthew Wild <mwild1@gmail.com>
parents: 4107
diff changeset
103
05d0a249326a mod_invites_page: Add Link header for URI with rel=alternate
Matthew Wild <mwild1@gmail.com>
parents: 4107
diff changeset
104 event.response.headers["Link"] = ([[<%s>; rel="alternate"]]):format(template_vars.uri);
4094
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
105 return invite_page;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
106 end
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
107
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
108 function serve_setup_page(event, app_id)
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
109 local invite_page_template = assert(module:load_resource("html/client.html")):read("*a");
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
110 local invalid_invite_page_template = assert(module:load_resource("html/invite_invalid.html")):read("*a");
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
111
4129
ca099bd28bf5 mod_invites_page, mod_invites_register_web: Set correct Content-Type everywhere necessary
Matthew Wild <mwild1@gmail.com>
parents: 4116
diff changeset
112 event.response.headers["Content-Type"] = "text/html; charset=utf-8";
ca099bd28bf5 mod_invites_page, mod_invites_register_web: Set correct Content-Type everywhere necessary
Matthew Wild <mwild1@gmail.com>
parents: 4116
diff changeset
113
4094
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
114 local invite = invites.get(event.request.url.query);
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
115 if not invite then
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
116 return render_html_template(invalid_invite_page_template, {
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
117 site_name = site_name;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
118 static = base_url.."/static";
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
119 });
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
120 end
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
121
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
122 local template_vars = {
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
123 site_name = site_name;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
124 apps = site_apps;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
125 token = invite.token;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
126 uri = invite.uri;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
127 type = invite.type;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
128 jid = invite.jid;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
129 static = base_url.."/static";
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
130 };
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
131 template_vars.app = render_app_urls({ site_apps[app_id] }, template_vars)[1];
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
132
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
133 local invite_page = render_html_template(invite_page_template, template_vars);
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
134 return invite_page;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
135 end
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
136
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
137 local mime_map = {
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
138 png = "image/png";
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
139 svg = "image/svg+xml";
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
140 js = "application/javascript";
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
141 };
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
142
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
143 module:provides("http", {
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
144 route = {
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
145 ["GET"] = serve_invite_page;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
146 ["GET /setup/*"] = serve_setup_page;
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
147 ["GET /static/*"] = http_files and http_files.serve({ path = module:get_directory().."/static", mime_map = mime_map });
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
148 };
dd00a2b9927c mod_invites_page: New module to generate landing page for invites
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
149 });