diff --git a/src/main.cpp b/src/main.cpp index 1844b12..580210c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -162,7 +162,7 @@ public: })); s.resources.emplace_back(std::make_unique("/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); diff --git a/src/server/resource.cpp b/src/server/resource.cpp index 7fa27e8..2847a06 100644 --- a/src/server/resource.cpp +++ b/src/server/resource.cpp @@ -25,17 +25,12 @@ static void loadFile(const std::string& path, std::vector& 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)}); diff --git a/src/terminal_api_driver.cpp b/src/terminal_api_driver.cpp index ced1f7c..b57d0f0 100644 --- a/src/terminal_api_driver.cpp +++ b/src/terminal_api_driver.cpp @@ -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; diff --git a/static/fields.css b/static/fields.css index 2dae627..550742a 100644 --- a/static/fields.css +++ b/static/fields.css @@ -52,12 +52,15 @@ } .tabs-item-flex-container > *, .settings-set-container { - padding: 1em; margin: 1em; border: 1px solid var(--text-color2); border-radius: 0.2em; } +.settings-set-container { + padding: 1em; +} + .tabs-item-flex-container th { text-align: left; padding-right: 1em; @@ -69,29 +72,39 @@ margin-top: 0; } -form label * { +.settings-set-container > h3 { + margin: 0; +} + +.settings-set-container label * { display: block; } -form label { +.settings-set-container label { margin: 1em 0; display: block; - background: var(--bg-selected); + /*background: var(--bg-selected);*/ color: var(--text-color2); } -form input { +.settings-set-container input, .settings-set-container select { margin-top: 0.5em; border: none; border-bottom: solid 2px var(--text-color); - width: 100%; + width: 20em; box-sizing: border-box; } -form input:focus { +.settings-set-container input:focus { outline: none; border: none; border-bottom: solid 2px var(--brand-text); } +/* костыль для браузеров, которые некорректно стилизуют элементы option */ +select * { + background: var(--bg-selected); + color: var(--text-color); +} + /*********************** Стили для красивых 'switch' ***********************/ .toggle-input { diff --git a/static/main.html b/static/main.html index 34075b5..dc11098 100644 --- a/static/main.html +++ b/static/main.html @@ -26,7 +26,7 @@ Выход
{{ initState }}
-
+

Статистика приема

@@ -98,7 +98,7 @@

Настройки приема/передачи

-
+
- -
-
-

Настройки передатчика

+
+
+
+

Настройки передатчика

-
-

Параметры передачи

+
+

Параметры передачи

-
-

Режим работы DVB-S2

+
+

Режим работы DVB-S2

-
-

Настройки авто-регулировки мощности

+
+

Авто-регулировка мощности

-
-

Настройка приемника

+
+

Настройка приемника

- +

Настройки режима CinC

-
+
- +

Настройки питания и опорного генератора

-
+

Настройки BUC

- - -
+
+

Настройки LNB

- - -
+
+

Сервисные настройки

- +
+

Настройки QoS

+
+ +
+ +

Классы CD

+ +
+ #{{ index }} CIR={{ rule.cir }}кбит, PIR={{ rule.pir }}кбит {{ rule.description }} + + + + +

Фильтры ({{ rule.filters.length }})

+ +
+ + + + + + + + + + +
+ + +
+ + +

Эти настройки пока недоступны, но скоро разработчик это поправит. А пока купи разработчику банку пива колы)

-

@@ -639,7 +702,15 @@ }, }, - testState: '?', + qos: { + en: false, + rt1: [{cir: 100, description: 'test class'}], + rt2: [], + rt3: [], + cd: [], + }, + + testState: false, initState: '', lastUpdateTime: new Date(), activeTab: getCurrentTab(), @@ -776,6 +847,48 @@ this.param.lnb.powering = vals["settings"]["lnb.powering"] this.param.serviceSettings.refClk10M = vals["settings"]["serviceSettings.refClk10M"] this.param.serviceSettings.autoStart = vals["settings"]["serviceSettings.autoStart"] + }, + + // addQosClass() + qosAddClass(name) { + let res = { + cir: 0, + pir: 0, + filters: [] + } + switch (name) { + case 'rt1': this.qos.rt1.push(res); break + case 'rt2': this.qos.rt2.push(res); break + case 'rt3': this.qos.rt3.push(res); break + case 'cd': this.qos.cd.push(res); break + } + }, + + qosClassAddRule(name, index) { + let rule = { + vlan: "", + proto: "tcp", + sport: "22,80,448", + dport: "5000-6000", + ip_src: "192.168.0.0/24", + ip_dest: "192.168.0.0/24,172.16.0.0/16,95.127.91.34", + dscp: "" + } + switch (name) { + case 'rt1': this.qos.rt1[index].filters.push(rule); break + case 'rt2': this.qos.rt2[index].filters.push(rule); break + case 'rt3': this.qos.rt3[index].filters.push(rule); break + case 'cd': this.qos.cd[index].filters.push(rule); break + } + }, + + qosDelClass(name, index) { + switch (name) { + case 'rt1': this.qos.rt1.splice(index, 1); break + case 'rt2': this.qos.rt2.splice(index, 1); break + case 'rt3': this.qos.rt3.splice(index, 1); break + case 'cd': this.qos.cd.splice(index, 1); break + } } }, mounted() {