Redirect /https://... to /...
This commit is contained in:
parent
8b443062eb
commit
e31cd4e9be
10
main.cpp
10
main.cpp
|
@ -40,16 +40,16 @@ int main(int argc, char** argv) {
|
|||
server.Get("/style.css", css_route);
|
||||
server.Get("/(" DOMAIN_RE ")/@(" ACCT_RE ")(|/with_replies|/media)", user_route);
|
||||
server.Get("/(" DOMAIN_RE ")/users/(" ACCT_RE ")(|/with_replies|/media)", [](const httplib::Request& req, httplib::Response& res) {
|
||||
using namespace std::string_literals;
|
||||
|
||||
serve_redirect(req, res, "/"s + req.matches.str(1) + "/@" + req.matches.str(2) + req.matches.str(3), true);
|
||||
serve_redirect(req, res, get_origin(req) + '/' + req.matches.str(1) + "/@" + req.matches.str(2) + req.matches.str(3), true);
|
||||
});
|
||||
|
||||
server.Get("/(" DOMAIN_RE ")/@" ACCT_RE "/(\\d+)", status_route);
|
||||
server.Get("/(" DOMAIN_RE ")/users/(" ACCT_RE ")/statuses/(\\d+)", [](const httplib::Request& req, httplib::Response& res) {
|
||||
using namespace std::string_literals;
|
||||
serve_redirect(req, res, get_origin(req) + '/' + req.matches.str(1) + "/@" + req.matches.str(2) + '/' + req.matches.str(3), true);
|
||||
});
|
||||
|
||||
serve_redirect(req, res, "/"s + req.matches.str(1) + "/@" + req.matches.str(2) + '/' + req.matches.str(3), true);
|
||||
server.Get("/https://?(.+)", [](const httplib::Request& req, httplib::Response& res) {
|
||||
serve_redirect(req, res, get_origin(req) + '/' + req.matches.str(1), true);
|
||||
});
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
|
Loading…
Reference in New Issue