фикс входа в браузере opera gx
This commit is contained in:
parent
fc121c51b2
commit
872b5e7b3d
@ -113,7 +113,20 @@ std::map<std::string, std::string> http::utils::parseCookies(const std::string&
|
|||||||
if (equalPos == std::string::npos) {
|
if (equalPos == std::string::npos) {
|
||||||
continue; // Неверный формат Cookie
|
continue; // Неверный формат Cookie
|
||||||
}
|
}
|
||||||
std::string name = cookie.substr(0, equalPos);
|
size_t startIndex = 0;
|
||||||
|
while (startIndex < cookie.size()) {
|
||||||
|
if (cookie[startIndex] == '=') {
|
||||||
|
// некорректная кука, состоит только из пробелов, так что на этом обработку и закончим
|
||||||
|
return cookies;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cookie[startIndex] == ' ') {
|
||||||
|
startIndex++;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::string name = cookie.substr(startIndex, equalPos - startIndex);
|
||||||
std::string value = cookie.substr(equalPos + 1);
|
std::string value = cookie.substr(equalPos + 1);
|
||||||
|
|
||||||
// Удаляем пробелы с начала и конца значения Cookie
|
// Удаляем пробелы с начала и конца значения Cookie
|
||||||
|
@ -114,6 +114,7 @@ public:
|
|||||||
#error "Modem type not defined!"
|
#error "Modem type not defined!"
|
||||||
#endif
|
#endif
|
||||||
static constexpr const char* LOGIN_HTML = "/login.html";
|
static constexpr const char* LOGIN_HTML = "/login.html";
|
||||||
|
static constexpr const char* DEV_HTML = "/dev.html";
|
||||||
|
|
||||||
// картинки, их даже можно кешировать
|
// картинки, их даже можно кешировать
|
||||||
static constexpr const char* FAVICON_ICO = "/favicon.ico";
|
static constexpr const char* FAVICON_ICO = "/favicon.ico";
|
||||||
@ -135,6 +136,7 @@ public:
|
|||||||
sf->registerFile(staticFilesPath + STYLE_CSS, STYLE_CSS, mime_types::text_css, true);
|
sf->registerFile(staticFilesPath + STYLE_CSS, STYLE_CSS, mime_types::text_css, true);
|
||||||
sf->registerFile(staticFilesPath + FIELDS_CSS, FIELDS_CSS, mime_types::text_css, true);
|
sf->registerFile(staticFilesPath + FIELDS_CSS, FIELDS_CSS, mime_types::text_css, true);
|
||||||
sf->registerFile(staticFilesPath + INDEX_HTML, INDEX_HTML, mime_types::text_html, false);
|
sf->registerFile(staticFilesPath + INDEX_HTML, INDEX_HTML, mime_types::text_html, false);
|
||||||
|
sf->registerFile(staticFilesPath + DEV_HTML, DEV_HTML, mime_types::text_html, false);
|
||||||
sf->registerFile(staticFilesPath + LOGIN_HTML, LOGIN_HTML, mime_types::text_html, true);
|
sf->registerFile(staticFilesPath + LOGIN_HTML, LOGIN_HTML, mime_types::text_html, true);
|
||||||
sf->registerFile(staticFilesPath + INTERNET_JPG, INTERNET_JPG, mime_types::image_jpeg, true);
|
sf->registerFile(staticFilesPath + INTERNET_JPG, INTERNET_JPG, mime_types::image_jpeg, true);
|
||||||
}
|
}
|
||||||
@ -195,6 +197,7 @@ public:
|
|||||||
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>(FIELDS_CSS, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(FIELDS_CSS, rep); }));
|
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>(FIELDS_CSS, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(FIELDS_CSS, rep); }));
|
||||||
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>(VUE_JS, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(VUE_JS, rep); }));
|
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>(VUE_JS, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(VUE_JS, rep); }));
|
||||||
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>(INTERNET_JPG, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(INTERNET_JPG, rep); }));
|
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>(INTERNET_JPG, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(INTERNET_JPG, rep); }));
|
||||||
|
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>("/dev", [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(DEV_HTML, rep); }));
|
||||||
|
|
||||||
s.resources.emplace_back(std::make_unique<http::auth::AuthRequiredResource>("/api/get/statistics", this->auth, http::auth::User::WATCH_STATISTICS, [this](const auto& req, auto& rep) {
|
s.resources.emplace_back(std::make_unique<http::auth::AuthRequiredResource>("/api/get/statistics", this->auth, http::auth::User::WATCH_STATISTICS, [this](const auto& req, auto& rep) {
|
||||||
if (req.method != "GET") {
|
if (req.method != "GET") {
|
||||||
|
@ -111,7 +111,8 @@
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: JSON.stringify(requestData)
|
body: JSON.stringify(requestData),
|
||||||
|
credentials: 'same-origin'
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
// Обработка ответа сервера
|
// Обработка ответа сервера
|
||||||
response.json().then((value) => {
|
response.json().then((value) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user