куча мелких изменений в вебе
This commit is contained in:
@@ -162,7 +162,7 @@ public:
|
||||
}));
|
||||
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>("/logout", [this](const auto& req, auto& rep) {
|
||||
if (req.method == "GET") {
|
||||
http::server::httpRedirect(rep, "/");
|
||||
http::server::httpRedirect(rep, "/login");
|
||||
rep.headers.push_back({.name = "Set-Cookie", .value = http::auth::jwt::EMPTY_AUTH_COOKIE});
|
||||
} else {
|
||||
http::server::stockReply(http::server::bad_request, rep);
|
||||
|
@@ -25,17 +25,12 @@ static void loadFile(const std::string& path, std::vector<char>& content) {
|
||||
http::resource::BasicResource::BasicResource(std::string path): path(std::move(path)) {}
|
||||
|
||||
http::resource::StaticFileFactory::StaticFileDef::StaticFileDef(std::string path, server::mime_types::Mime type, bool allowCache): path(std::move(path)), type(type), allowCache(allowCache) {
|
||||
#ifdef USE_DEBUG
|
||||
if (allowCache) {
|
||||
BOOST_LOG_TRIVIAL(info) << "Load static file " << this->path;
|
||||
loadFile(this->path, this->content);
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << "Skip loading static file " << this->path;
|
||||
}
|
||||
#else
|
||||
BOOST_LOG_TRIVIAL(info) << "Load static file " << this->path;
|
||||
loadFile(this->path, this->content);
|
||||
#endif
|
||||
}
|
||||
http::resource::StaticFileFactory::StaticFileDef::~StaticFileDef() = default;
|
||||
|
||||
@@ -48,7 +43,6 @@ void http::resource::StaticFileFactory::registerFile(const std::string &path, se
|
||||
void http::resource::StaticFileFactory::serve(const std::string &path, server::Reply &rep) {
|
||||
for (auto& f: this->files) {
|
||||
if (f.path == path) {
|
||||
#ifdef USE_DEBUG
|
||||
if (f.allowCache) {
|
||||
rep.content.clear();
|
||||
rep.content.insert(rep.content.end(), f.content.begin(), f.content.end());
|
||||
@@ -56,10 +50,6 @@ void http::resource::StaticFileFactory::serve(const std::string &path, server::R
|
||||
BOOST_LOG_TRIVIAL(debug) << "Reload file " << path << " (http path: " << path << ")";
|
||||
loadFile(f.path, rep.content);
|
||||
}
|
||||
#else
|
||||
rep.content.clear();
|
||||
rep.content.insert(rep.content.end(), f.content.begin(), f.content.end());
|
||||
#endif
|
||||
rep.status = server::ok;
|
||||
// rep.headers.clear();
|
||||
rep.headers.push_back({.name = "Content-Type", .value = server::mime_types::toString(f.type)});
|
||||
|
@@ -166,8 +166,6 @@ void api_driver::ApiDriver::resetPacketStatistics() const {
|
||||
}
|
||||
|
||||
std::string api_driver::ApiDriver::loadSettings() const {
|
||||
// constexpr auto* UNKNOWN = "\"?\"";
|
||||
|
||||
modulator_settings modSettings{};
|
||||
CP_GetModulatorSettings(sid, modSettings);
|
||||
uint32_t modulatorModcod;
|
||||
|
Reference in New Issue
Block a user