diff --git a/dependencies/control_system_client_tdma b/dependencies/control_system_client_tdma
index cb0f743..78694fd 160000
--- a/dependencies/control_system_client_tdma
+++ b/dependencies/control_system_client_tdma
@@ -1 +1 @@
-Subproject commit cb0f743535b95b87311318a0b8daf82da9bb7df5
+Subproject commit 78694fd775841c6db96323d1d35c20f607f94daf
diff --git a/front-generator/render-params.json b/front-generator/render-params.json
index cafeb55..43f4e67 100644
--- a/front-generator/render-params.json
+++ b/front-generator/render-params.json
@@ -122,7 +122,6 @@
{
"widget": "settings-container",
"childs": [
- {"widget": "text", "label": "Пароль для входа в сеть ЦЗС", "name": "cesPassword"},
{"widget": "h3", "label": "Настройки интерфейса управления"},
{"widget": "ip-address-mask", "label": "Интерфейс управления (a.d.d.r/mask)", "name": "managementIp"},
{"widget": "text", "label": "Имя веб-сервера", "name": "serverName"}
diff --git a/front-generator/template/common/admin-methods.js.j2 b/front-generator/template/common/admin-methods.js.j2
index 3769cc1..a54ff3d 100644
--- a/front-generator/template/common/admin-methods.js.j2
+++ b/front-generator/template/common/admin-methods.js.j2
@@ -63,6 +63,22 @@
}
this.submitStatus.firmwareUpgradeOta = false
},
+ async settingsPerformSetCesPassword() {
+ if (this.submitStatus.cesPassword) { return }
+ this.submitStatus.cesPassword = true
+ try {
+ await fetch('/api/set/cesPassword', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({'password': this.cesPasswordValue})
+ })
+ } catch (e) {
+ console.log("failed to perform set CES password: ", e)
+ }
+ this.submitStatus.cesPassword = false
+ },
{% endif %}
doModemReboot() {
diff --git a/front-generator/template/common/admin.html.j2 b/front-generator/template/common/admin.html.j2
index f9ba9b7..a5eafff 100644
--- a/front-generator/template/common/admin.html.j2
+++ b/front-generator/template/common/admin.html.j2
@@ -23,7 +23,16 @@
-
+ {% endraw %}{% if modem == 'tdma' %}
+
+
Вход в сеть ЦЗС
+
+
+
+
{% endif %}{% raw %}
Обновление ПО
diff --git a/front-generator/template/main.html b/front-generator/template/main.html
index e592200..40bce1e 100644
--- a/front-generator/template/main.html
+++ b/front-generator/template/main.html
@@ -99,10 +99,14 @@
firmwareUpgrade: false,
{% if modem == 'tdma' %}
firmwareUpgradeOta: false,
+ cesPassword: false,
{% endif %}
// когда модем перезагружается, тут должен быть счетчик. Направление счета - к нулю
modemReboot: null
},
+ {% if modem == 'tdma' %}
+ cesPasswordValue: '',
+ {% endif %}
// ========== include from 'common/all-params-data.js.j2'
{% include 'common/all-params-data.js.j2' %}
diff --git a/src/main.cpp b/src/main.cpp
index b2965de..96eed32 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -227,7 +227,7 @@ public:
resultJson["status"] = "ok";
resultJson["state"] = api->loadTerminalState();
} catch (std::exception& e) {
- BOOST_LOG_TRIVIAL(error) << "WebHandle(/api/set/qos): Can't set QoS settings: " << e.what();
+ BOOST_LOG_TRIVIAL(error) << "WebHandle(/api/get/statistics): Can't get terminal state: " << e.what();
resultJson.clear();
resultJson["status"] = "error";
resultJson["error"] = e.what();
@@ -436,6 +436,36 @@ public:
auto result = resultJson.dump();
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
}));
+#ifdef MODEM_IS_TDMA
+ s.resources.emplace_back(std::make_unique("/api/set/cesPassword", this->auth, http::auth::User::EDIT_SETTINGS, [this](const http::server::Request& req, auto& rep) {
+ if (req.method != "POST") {
+ http::server::stockReply(http::server::bad_request, rep);
+ return;
+ }
+
+ rep.status = http::server::ok;
+ rep.headers.push_back({.name = "Content-Type", .value = toString(mime_types::json)});
+ nlohmann::json resultJson;
+
+ try {
+ auto reqJson = nlohmann::json::parse(std::string(req.payload.begin(), req.payload.end()));
+ auto password = reqJson["password"].get();
+
+ this->api->executeInApi([&password](auto& cp) {
+ cp.setNetwork("ces_password", password);
+ });
+ resultJson["status"] = "ok";
+ } catch (std::exception& e) {
+ BOOST_LOG_TRIVIAL(error) << "WebHandle(/api/set/cesPassword): Can't set CES password: " << e.what();
+ resultJson.clear();
+ resultJson["status"] = "error";
+ resultJson["error"] = e.what();
+ }
+
+ auto result = resultJson.dump();
+ rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
+ }));
+#endif
#endif
s.resources.emplace_back(std::make_unique("/api/reboot", this->auth, 0, [this](const auto& req, auto& rep) {
diff --git a/static/main-tdma.html b/static/main-tdma.html
index cbdfbac..93db9c1 100644
--- a/static/main-tdma.html
+++ b/static/main-tdma.html
@@ -241,10 +241,6 @@
Настройки сети
-
Настройки интерфейса управления
+
Вход в сеть ЦЗС
+
+
+
+
Обновление ПО
@@ -335,9 +339,11 @@
firmwareUpload: false,
firmwareUpgrade: false,
firmwareUpgradeOta: false,
+ cesPassword: false,
// когда модем перезагружается, тут должен быть счетчик. Направление счета - к нулю
modemReboot: null
},
+ cesPasswordValue: '',
// ========== include from 'common/all-params-data.js.j2'
paramRxtx: {
@@ -370,7 +376,6 @@
delay: 0,
},
paramNetwork: {
- cesPassword: null,
managementIp: null,
serverName: null,
},
@@ -551,7 +556,6 @@
{ if (!confirm("Применение этих настроек может сделать модем недоступным! Продолжить?")) return }
let query = {
- "cesPassword": this.paramNetwork.cesPassword,
"managementIp": this.paramNetwork.managementIp,
"serverName": this.paramNetwork.serverName,
}
@@ -597,7 +601,6 @@
},
updateNetworkSettings(vals) {
this.submitStatus.network = false
- this.paramNetwork.cesPassword = vals["settings"]["network"]["cesPassword"]
this.paramNetwork.managementIp = vals["settings"]["network"]["managementIp"]
this.paramNetwork.serverName = vals["settings"]["network"]["serverName"]
},
@@ -761,6 +764,22 @@
}
this.submitStatus.firmwareUpgradeOta = false
},
+ async settingsPerformSetCesPassword() {
+ if (this.submitStatus.cesPassword) { return }
+ this.submitStatus.cesPassword = true
+ try {
+ await fetch('/api/set/cesPassword', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({'password': this.cesPasswordValue})
+ })
+ } catch (e) {
+ console.log("failed to perform set CES password: ", e)
+ }
+ this.submitStatus.cesPassword = false
+ },
doModemReboot() {
if (this.submitStatus.modemReboot !== null) {