mirror of
https://github.com/matrix-construct/construct
synced 2025-03-14 05:20:17 +01:00
modules: Rename root to webroot.
This commit is contained in:
parent
eb603c22c1
commit
b4e7bb062c
3 changed files with 44 additions and 31 deletions
|
@ -154,7 +154,7 @@ try
|
|||
m::modules.emplace(name, name);
|
||||
|
||||
// Manually load last modules
|
||||
m::modules.emplace("root"s, "root"s);
|
||||
m::modules.emplace("webroot"s, "webroot"s);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
|
|
|
@ -44,13 +44,13 @@ AM_LDFLAGS += \
|
|||
|
||||
moduledir = @moduledir@
|
||||
|
||||
root_la_SOURCES = root.cc
|
||||
webroot_la_SOURCES = webroot.cc
|
||||
console_la_SOURCES = console.cc
|
||||
vm_la_SOURCES = vm.cc
|
||||
vm_fetch_la_SOURCES = vm_fetch.cc
|
||||
|
||||
module_LTLIBRARIES = \
|
||||
root.la \
|
||||
webroot.la \
|
||||
console.la \
|
||||
vm.la \
|
||||
vm_fetch.la \
|
||||
|
|
|
@ -10,25 +10,58 @@
|
|||
|
||||
using namespace ircd;
|
||||
|
||||
std::map<std::string, std::string, iless> files
|
||||
{};
|
||||
std::map<std::string, std::string, iless> files;
|
||||
|
||||
static string_view
|
||||
content_type(const mutable_buffer &out, const string_view &filename, const string_view &content);
|
||||
|
||||
resource::response
|
||||
get_root(client &client, const resource::request &request);
|
||||
|
||||
static void
|
||||
init_files();
|
||||
|
||||
mapi::header
|
||||
IRCD_MODULE
|
||||
{
|
||||
"Web root content resource",
|
||||
init_files
|
||||
};
|
||||
|
||||
resource
|
||||
root_resource
|
||||
{
|
||||
"/",
|
||||
{
|
||||
"Webroot resource",
|
||||
root_resource.DIRECTORY
|
||||
}
|
||||
};
|
||||
|
||||
resource::method
|
||||
root_get
|
||||
{
|
||||
root_resource, "GET", get_root
|
||||
};
|
||||
|
||||
void
|
||||
init_files()
|
||||
{
|
||||
// TODO: XXX
|
||||
for(const auto &file : fs::ls_recursive("/home/jason/charybdis/charybdis/modules/static"))
|
||||
for(const auto &file : fs::ls_recursive("/home/jason/charybdis/charybdis/deps/riot-web/webapp/"))
|
||||
{
|
||||
const auto name(tokens_after(file, '/', 6));
|
||||
files.emplace(std::string(name), file);
|
||||
}
|
||||
/*
|
||||
for(const auto &file : fs::ls_recursive("/home/jason/charybdis/charybdis/modules/static/"))
|
||||
{
|
||||
const auto name(tokens_after(file, '/', 5));
|
||||
files.emplace(std::string(name), file);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
static string_view
|
||||
content_type(const mutable_buffer &out,
|
||||
const string_view &filename,
|
||||
const string_view &content);
|
||||
|
||||
resource::response
|
||||
get_root(client &client,
|
||||
const resource::request &request)
|
||||
|
@ -159,23 +192,3 @@ content_type(const mutable_buffer &out,
|
|||
|
||||
return content_type;
|
||||
}
|
||||
|
||||
resource root_resource
|
||||
{
|
||||
"/",
|
||||
{
|
||||
"Webroot resource",
|
||||
root_resource.DIRECTORY
|
||||
}
|
||||
};
|
||||
|
||||
resource::method root_get
|
||||
{
|
||||
root_resource, "GET", get_root
|
||||
};
|
||||
|
||||
mapi::header IRCD_MODULE
|
||||
{
|
||||
"Web root content resource",
|
||||
init_files
|
||||
};
|
Loading…
Add table
Reference in a new issue