mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-07 20:16:55 +03:00
fix for #2036
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#### Fixed
|
#### Fixed
|
||||||
|
|
||||||
- n.a.
|
- [2036](https://github.com/jomjol/AI-on-the-edge-device/issues/2036) Initial AP-Mode now decodes the parameters correctly
|
||||||
|
|
||||||
#### Removed
|
#### Removed
|
||||||
|
|
||||||
|
|||||||
@@ -898,3 +898,33 @@ const char* get404(void) {
|
|||||||
" You could try your <a href=index.html target=_parent>luck</a> here!</pre>\n"
|
" You could try your <a href=index.html target=_parent>luck</a> here!</pre>\n"
|
||||||
"<script>document.cookie = \"page=overview.html\"</script>"; // Make sure we load the overview page
|
"<script>document.cookie = \"page=overview.html\"</script>"; // Make sure we load the overview page
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string UrlDecode(const std::string& value)
|
||||||
|
{
|
||||||
|
std::string result;
|
||||||
|
result.reserve(value.size());
|
||||||
|
|
||||||
|
for (std::size_t i = 0; i < value.size(); ++i)
|
||||||
|
{
|
||||||
|
auto ch = value[i];
|
||||||
|
|
||||||
|
if (ch == '%' && (i + 2) < value.size())
|
||||||
|
{
|
||||||
|
auto hex = value.substr(i + 1, 2);
|
||||||
|
auto dec = static_cast<char>(std::strtol(hex.c_str(), nullptr, 16));
|
||||||
|
result.push_back(dec);
|
||||||
|
i += 2;
|
||||||
|
}
|
||||||
|
else if (ch == '+')
|
||||||
|
{
|
||||||
|
result.push_back(' ');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.push_back(ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|||||||
@@ -93,4 +93,7 @@ std::string getFormatedUptime(bool compact);
|
|||||||
|
|
||||||
const char* get404(void);
|
const char* get404(void);
|
||||||
|
|
||||||
|
|
||||||
|
std::string UrlDecode(const std::string& value);
|
||||||
|
|
||||||
#endif //HELPER_H
|
#endif //HELPER_H
|
||||||
|
|||||||
@@ -213,55 +213,55 @@ esp_err_t config_ini_handler(httpd_req_t *req)
|
|||||||
if (httpd_query_key_value(_query, "ssid", _valuechar, 30) == ESP_OK)
|
if (httpd_query_key_value(_query, "ssid", _valuechar, 30) == ESP_OK)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "ssid is found: %s", _valuechar);
|
ESP_LOGD(TAG, "ssid is found: %s", _valuechar);
|
||||||
ssid = std::string(_valuechar);
|
ssid = UrlDecode(std::string(_valuechar));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "pwd", _valuechar, 30) == ESP_OK)
|
if (httpd_query_key_value(_query, "pwd", _valuechar, 30) == ESP_OK)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "pwd is found: %s", _valuechar);
|
ESP_LOGD(TAG, "pwd is found: %s", _valuechar);
|
||||||
pwd = std::string(_valuechar);
|
pwd = UrlDecode(std::string(_valuechar));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "ssid", _valuechar, 30) == ESP_OK)
|
if (httpd_query_key_value(_query, "ssid", _valuechar, 30) == ESP_OK)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "ssid is found: %s", _valuechar);
|
ESP_LOGD(TAG, "ssid is found: %s", _valuechar);
|
||||||
ssid = std::string(_valuechar);
|
ssid = UrlDecode(std::string(_valuechar));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "hn", _valuechar, 30) == ESP_OK)
|
if (httpd_query_key_value(_query, "hn", _valuechar, 30) == ESP_OK)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "hostname is found: %s", _valuechar);
|
ESP_LOGD(TAG, "hostname is found: %s", _valuechar);
|
||||||
hn = std::string(_valuechar);
|
hn = UrlDecode(std::string(_valuechar));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "ip", _valuechar, 30) == ESP_OK)
|
if (httpd_query_key_value(_query, "ip", _valuechar, 30) == ESP_OK)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "ip is found: %s", _valuechar);
|
ESP_LOGD(TAG, "ip is found: %s", _valuechar);
|
||||||
ip = std::string(_valuechar);
|
ip = UrlDecode(std::string(_valuechar));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "gw", _valuechar, 30) == ESP_OK)
|
if (httpd_query_key_value(_query, "gw", _valuechar, 30) == ESP_OK)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "gateway is found: %s", _valuechar);
|
ESP_LOGD(TAG, "gateway is found: %s", _valuechar);
|
||||||
gw = std::string(_valuechar);
|
gw = UrlDecode(std::string(_valuechar));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "nm", _valuechar, 30) == ESP_OK)
|
if (httpd_query_key_value(_query, "nm", _valuechar, 30) == ESP_OK)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "netmask is found: %s", _valuechar);
|
ESP_LOGD(TAG, "netmask is found: %s", _valuechar);
|
||||||
nm = std::string(_valuechar);
|
nm = UrlDecode(std::string(_valuechar));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "dns", _valuechar, 30) == ESP_OK)
|
if (httpd_query_key_value(_query, "dns", _valuechar, 30) == ESP_OK)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "dns is found: %s", _valuechar);
|
ESP_LOGD(TAG, "dns is found: %s", _valuechar);
|
||||||
dns = std::string(_valuechar);
|
dns = UrlDecode(std::string(_valuechar));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "rssi", _valuechar, 30) == ESP_OK)
|
if (httpd_query_key_value(_query, "rssi", _valuechar, 30) == ESP_OK)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "rssi is found: %s", _valuechar);
|
ESP_LOGD(TAG, "rssi is found: %s", _valuechar);
|
||||||
rssi = std::string(_valuechar);
|
rssi = UrlDecode(std::string(_valuechar));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user