Commit 15f6cda1 authored by Ivan Vilata-i-Balaguer's avatar Ivan Vilata-i-Balaguer
Browse files

Add front-end link to (dummy) group list page.

parent 9d00eb08
......@@ -180,6 +180,15 @@ static void load_log_file(stringstream& out_ss) {
, ostreambuf_iterator<char>(out_ss));
}
void ClientFrontEnd::handle_group_list( const Request&
, Response& res
, std::stringstream& ss)
{
res.set(http::field::content_type, "text/plain");
ss << "TODO\n";
}
void ClientFrontEnd::handle_portal( ClientConfig& config
, const Request& req, Response& res, stringstream& ss
, cache::Client* cache_client
......@@ -316,6 +325,8 @@ void ClientFrontEnd::handle_portal( ClientConfig& config
" (i.e. not older than %s).<br>\n")
% max_age.total_seconds() % past_as_string(max_age));
ss << "<a href=\"" << group_list_apath << "\">See announced groups</a><br>\n";
Cancel cancel;
sys::error_code ec;
auto local_size = cache_client->local_size(cancel, yield[ec]);
......@@ -451,6 +462,8 @@ Response ClientFrontEnd::serve( ClientConfig& config
} else if (path == "/logfile.txt") {
res.set(http::field::content_type, "text/plain");
load_log_file(ss);
} else if (path == group_list_apath) {
handle_group_list(req, res, ss);
} else if (path == "/api/status") {
sys::error_code e;
handle_status( config, udp_port, upnps, reachability
......
......@@ -34,6 +34,11 @@ class ClientFrontEnd {
= boost::intrusive::list_base_hook
<boost::intrusive::link_mode
<boost::intrusive::auto_unlink>>;
public:
// Absolute paths of allowed URLs.
inline static const std::string group_list_apath = "/groups.txt";
public:
using Request = http::request<http::string_body>;
using Response = http::response<http::dynamic_body>;
......@@ -95,6 +100,10 @@ private:
void handle_ca_pem( const Request&, Response&, std::stringstream&
, const CACertificate& );
void handle_group_list( const Request&
, Response&
, std::stringstream&);
void handle_portal( ClientConfig&
, const Request&
, Response&
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment