Software /
code /
prosody-modules
Comparison
mod_welcome_page/mod_welcome_page.lua @ 4975:733e5513f691
various: Use 0.12+ API for serving files from the file system over HTTP
Using mod_http_files this way is deprecated. Having the base behavior in
a separate module makes it easier to have a specialized module with
coherent behavior that does not do things when not explicitly enabled.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 18 Jul 2022 13:58:27 +0200 |
parent | 4605:ffb709728210 |
child | 4976:75b6e5df65f9 |
comparison
equal
deleted
inserted
replaced
4974:807007913f67 | 4975:733e5513f691 |
---|---|
59 event.response.headers.Location = invite.landing_page or invite.uri; | 59 event.response.headers.Location = invite.landing_page or invite.uri; |
60 | 60 |
61 return 303; | 61 return 303; |
62 end | 62 end |
63 | 63 |
64 local http_files = module:depends("http_files"); | 64 local http_files |
65 if not pcall(function() | |
66 -- Prosody >= 0.12 | |
67 http_files = require "net.http.files"; | |
68 end) then | |
69 -- Prosody <= 0.11 | |
70 http_files = module:depends "http_files"; | |
71 end | |
65 | 72 |
66 module:provides("http", { | 73 module:provides("http", { |
67 default_path = "/"; | 74 default_path = "/"; |
68 route = { | 75 route = { |
69 ["GET"] = serve_page; | 76 ["GET"] = serve_page; |