изменил политику кеширования, убрал строковые константы из статистик (пилоты, размер кадра)
This commit is contained in:
14
src/main.cpp
14
src/main.cpp
@@ -105,17 +105,11 @@ public:
|
||||
sf->registerFile(VUE_JS, mime_types::javascript, true);
|
||||
sf->registerFile(KB_MP4, mime_types::video_mp4, true);
|
||||
|
||||
#if USE_DEBUG
|
||||
constexpr bool allowCacheCss = false;
|
||||
#else
|
||||
constexpr bool allowCacheCss = true;
|
||||
#endif
|
||||
sf->registerFile(STYLE_CSS, mime_types::text_css, true);
|
||||
sf->registerFile(FIELDS_CSS, mime_types::text_css, true);
|
||||
|
||||
sf->registerFile(INDEX_HTML, mime_types::text_html, allowCacheCss);
|
||||
sf->registerFile(LOGIN_HTML, mime_types::text_html, allowCacheCss);
|
||||
|
||||
sf->registerFile(STYLE_CSS, mime_types::text_css, allowCacheCss);
|
||||
sf->registerFile(FIELDS_CSS, mime_types::text_css, allowCacheCss);
|
||||
sf->registerFile(INDEX_HTML, mime_types::text_html, false);
|
||||
sf->registerFile(LOGIN_HTML, mime_types::text_html, true);
|
||||
}
|
||||
|
||||
void registerResources(http::server::Server& s) {
|
||||
|
@@ -43,6 +43,7 @@ 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());
|
||||
@@ -50,6 +51,10 @@ 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)});
|
||||
|
@@ -242,6 +242,12 @@ public:
|
||||
CP_SetDmaDebug(sid, "save_config", "");
|
||||
}
|
||||
|
||||
void resetPacketStatistics() {
|
||||
std::string tmp;
|
||||
std::lock_guard lock(this->cpApiMutex);
|
||||
CP_GetDmaDebug(sid, "reset_cnt_rx", &tmp);
|
||||
}
|
||||
|
||||
~TerminalApiDaemon() {
|
||||
try {
|
||||
daemon.interrupt();
|
||||
@@ -321,15 +327,15 @@ std::string api_driver::ApiDriver::loadTerminalState() const {
|
||||
result << ",\"tx.snr\":"; writeDouble(result, modulator.snr_remote);
|
||||
|
||||
if (modulator.is_short) {
|
||||
result << R"(,"tx.frameSize":"short")";
|
||||
result << R"(,"tx.frameSizeNormal":false)";
|
||||
} else {
|
||||
result << R"(,"tx.frameSize":"normal")";
|
||||
result << R"(,"tx.frameSizeNormal":true)";
|
||||
}
|
||||
|
||||
if (modulator.is_pilots) {
|
||||
result << R"(,"tx.pilots":"pilots")";
|
||||
result << R"(,"tx.isPilots":true)";
|
||||
} else {
|
||||
result << R"(,"tx.pilots":"no pilots")";
|
||||
result << R"(,"tx.isPilots":false)";
|
||||
}
|
||||
|
||||
result << ",\"tx.speedOnTxKbit\":"; writeDouble(result, static_cast<double>(modulator.speed_in_bytes_tx) / 128.0);
|
||||
@@ -347,15 +353,15 @@ std::string api_driver::ApiDriver::loadTerminalState() const {
|
||||
result << ",\"rx.modcod\":" << demodulator.modcod;
|
||||
|
||||
if (demodulator.is_short) {
|
||||
result << R"(,"rx.frameSize":"short")";
|
||||
result << R"(,"rx.frameSizeNormal":false)";
|
||||
} else {
|
||||
result << R"(,"rx.frameSize":"normal")";
|
||||
result << R"(,"rx.frameSizeNormal":true)";
|
||||
}
|
||||
|
||||
if (demodulator.is_pilots) {
|
||||
result << R"(,"rx.pilots":"pilots")";
|
||||
result << R"(,"rx.isPilots":true)";
|
||||
} else {
|
||||
result << R"(,"rx.pilots":"no pilots")";
|
||||
result << R"(,"rx.isPilots":false)";
|
||||
}
|
||||
|
||||
result << ",\n\"rx.symError\":"; writeDouble(result, demodulator.sym_err);
|
||||
@@ -405,8 +411,7 @@ std::string api_driver::ApiDriver::loadTerminalState() const {
|
||||
|
||||
|
||||
void api_driver::ApiDriver::resetPacketStatistics() const {
|
||||
std::string tmp;
|
||||
CP_GetDmaDebug(sid, "reset_cnt_rx", &tmp);
|
||||
this->daemon->resetPacketStatistics();
|
||||
}
|
||||
|
||||
std::string api_driver::ApiDriver::loadSettings() const {
|
||||
@@ -441,8 +446,8 @@ std::string api_driver::ApiDriver::loadSettings() const {
|
||||
result << ",\"tx.centerFreq\":"; writeDouble(result, modSettings.central_freq_in_kGz, 3);
|
||||
|
||||
result << ",\n\"dvbs2.isAcm\":" << boolAsStr(acmSettings.enable);
|
||||
result << ",\"dvbs2.frameSize\":" << ((modulatorModcod & 2) ? "\"short\"" : "\"normal\"");
|
||||
// result << ",\"dvbs2.pilots\":" << "null";
|
||||
result << ",\"dvbs2.frameSizeNormal\":" << boolAsStr(!(modulatorModcod & 2));
|
||||
// result << ",\"dvbs2.isPilots\":" << "null";
|
||||
result << ",\"dvbs2.ccm_modcod\":" << (modulatorModcod >> 4);
|
||||
result << ",\"dvbs2.acm_maxModcod\":" << (acmSettings.max_modcod >> 2);
|
||||
result << ",\"dvbs2.acm_minModcod\":" << (acmSettings.min_modcod >> 2);
|
||||
|
Reference in New Issue
Block a user