mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-30 03:09:53 +02:00
Hotfix: Authenticate all Web&ApiRequests to fix save loading/voting issues
This commit is contained in:
@@ -97,7 +97,6 @@ RequestBroker::ProcessResponse APIRequest::Process(RequestBroker & rb)
|
||||
|
||||
if(Client::Ref().GetAuthUser().ID)
|
||||
{
|
||||
std::cout << typeid(*this).name() << " Authenticated " << std::endl;
|
||||
User user = Client::Ref().GetAuthUser();
|
||||
char userName[12];
|
||||
char *userSession = new char[user.SessionID.length() + 1];
|
||||
@@ -115,6 +114,16 @@ RequestBroker::ProcessResponse APIRequest::Process(RequestBroker & rb)
|
||||
else
|
||||
{
|
||||
HTTPContext = http_async_req_start(NULL, (char *)URL.c_str(), NULL, 0, 0);
|
||||
if(Client::Ref().GetAuthUser().ID)
|
||||
{
|
||||
User user = Client::Ref().GetAuthUser();
|
||||
char userName[12];
|
||||
char *userSession = new char[user.SessionID.length() + 1];
|
||||
std::strcpy(userName, format::NumberToString<int>(user.ID).c_str());
|
||||
std::strcpy(userSession, user.SessionID.c_str());
|
||||
http_auth_headers(HTTPContext, userName, NULL, userSession);
|
||||
delete userSession;
|
||||
}
|
||||
}
|
||||
//RequestTime = time(NULL);
|
||||
}
|
||||
|
@@ -114,6 +114,16 @@ RequestBroker::ProcessResponse WebRequest::Process(RequestBroker & rb)
|
||||
else
|
||||
{
|
||||
HTTPContext = http_async_req_start(NULL, (char *)URL.c_str(), NULL, 0, 0);
|
||||
if(Client::Ref().GetAuthUser().ID)
|
||||
{
|
||||
User user = Client::Ref().GetAuthUser();
|
||||
char userName[12];
|
||||
char *userSession = new char[user.SessionID.length() + 1];
|
||||
std::strcpy(userName, format::NumberToString<int>(user.ID).c_str());
|
||||
std::strcpy(userSession, user.SessionID.c_str());
|
||||
http_auth_headers(HTTPContext, userName, NULL, userSession);
|
||||
delete userSession;
|
||||
}
|
||||
}
|
||||
}
|
||||
return RequestBroker::OK;
|
||||
|
Reference in New Issue
Block a user