chore: merge 9305c29 -> 024e60a from prod

This commit is contained in:
rjindael 2023-07-28 03:17:54 -07:00
parent 1965551be9
commit 99a652ed3e
No known key found for this signature in database
GPG Key ID: D069369C906CCF31
5 changed files with 33 additions and 22 deletions

View File

@ -9,4 +9,4 @@
#define APP_NAME "Kiseki.Patcher" #define APP_NAME "Kiseki.Patcher"
#define APP_DESCRIPTION "Client Functionality Library" #define APP_DESCRIPTION "Client Functionality Library"
#define APP_ORGANIZATION "Kiseki" #define APP_ORGANIZATION "Kiseki"
#define APP_COPYRIGHT "Copyright (c) Kiseki 2023" #define APP_COPYRIGHT "Copyright (c) Kiseki 2022-2023"

View File

@ -144,8 +144,15 @@ std::string Helpers::getISOTimestamp()
std::pair<bool, std::map<std::string, std::string>> Helpers::parseURL(const std::string url) std::pair<bool, std::map<std::string, std::string>> Helpers::parseURL(const std::string url)
{ {
// This is an ugly hack to url-encode the query before CURL actually parses the URL.
// We do this because CURL throws a fit if the query is not properly URL encoded; so URLs such as "/Error/Dmp.ashx?filename=C:/Users/..." won't parse correctly.
char* encodedQuery = curl_escape(url.substr(url.find("?") + 1).c_str(), url.substr(url.find("?") + 1).length());
std::string encodedUrl = url.substr(0, url.find("?")) + encodedQuery;
curl_free(encodedQuery);
CURLU* curl = curl_url(); CURLU* curl = curl_url();
CURLUcode result = curl_url_set(curl, CURLUPART_URL, url.c_str(), 0); CURLUcode result = curl_url_set(curl, CURLUPART_URL, url.c_str(), 0);
CURLUcode result = curl_url_set(curl, CURLUPART_URL, encodedUrl.c_str(), 0);
std::map<std::string, std::string> map; std::map<std::string, std::string> map;
bool success = false; bool success = false;
@ -154,20 +161,22 @@ std::pair<bool, std::map<std::string, std::string>> Helpers::parseURL(const std:
{ {
success = true; success = true;
char* scheme;
char* path; char* path;
char* host; char* host;
char* query; char* query;
curl_url_get(curl, CURLUPART_SCHEME, &scheme, 0);
curl_url_get(curl, CURLUPART_PATH, &path, 0); curl_url_get(curl, CURLUPART_PATH, &path, 0);
curl_url_get(curl, CURLUPART_HOST, &host, 0); curl_url_get(curl, CURLUPART_HOST, &host, 0);
curl_url_get(curl, CURLUPART_QUERY, &query, 0); curl_url_get(curl, CURLUPART_QUERY, &query, 0);
curl_url_cleanup(curl); curl_url_cleanup(curl);
map = { // ugly ternaries to prevent edge-case access violations
{ "path", std::string(path) }, map["scheme"] = scheme ? std::string(scheme) : "";
{ "host", std::string(host) }, map["path"] = path ? std::string(path) : "";
{ "query", std::string(query) } map["host"] = host ? std::string(host) : "";
}; map["query"] = query ? std::string(query) : "";
curl_free(path); curl_free(path);
curl_free(host); curl_free(host);

View File

@ -20,6 +20,21 @@ CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam = (CRobl
BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this) BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this)
{ {
#ifdef PLAYER
if (!hasAuthenticationUrl || !hasAuthenticationTicket || !hasJoinScriptUrl)
{
ShellExecute(0, 0, L"https://kiseki.lol/games", 0, 0, SW_SHOW);
return FALSE;
}
#endif
#ifdef SERVER
if (!hasJobId)
{
return FALSE;
}
#endif
if (!CRobloxApp__InitInstance(_this)) if (!CRobloxApp__InitInstance(_this))
{ {
return FALSE; return FALSE;
@ -45,21 +60,6 @@ BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this)
} }
} }
#ifdef SERVER
if (!hasJobId)
{
return FALSE;
}
#endif
#ifdef PLAYER
if (!hasAuthenticationUrl || !hasAuthenticationTicket || !hasJoinScriptUrl)
{
ShellExecute(0, 0, L"https://kiseki.lol/games", 0, 0, SW_SHOW);
return FALSE;
}
#endif
return TRUE; return TRUE;
} }

View File

@ -1,5 +1,7 @@
#ifdef SERVER #ifdef SERVER
#include <map>
#include "Hooks/ServerReplicator.hpp" #include "Hooks/ServerReplicator.hpp"
static std::map<ServerReplicator*, RakPeerInterface*> rakPeers; static std::map<ServerReplicator*, RakPeerInterface*> rakPeers;

View File

@ -29,7 +29,7 @@ ADD_PATCH(Http__trustCheck, Http__trustCheck_hook)
ADD_PATCH(Crypt__verifySignatureBase64, Crypt__verifySignatureBase64_hook) ADD_PATCH(Crypt__verifySignatureBase64, Crypt__verifySignatureBase64_hook)
#if defined(PLAYER) or defined(SERVER) #if defined(PLAYER) || defined(SERVER)
ADD_PATCH(CRobloxApp__InitInstance, CRobloxApp__InitInstance_hook) ADD_PATCH(CRobloxApp__InitInstance, CRobloxApp__InitInstance_hook)
ADD_PATCH(CRobloxCommandLineInfo__ParseParam, CRobloxCommandLineInfo__ParseParam_hook) ADD_PATCH(CRobloxCommandLineInfo__ParseParam, CRobloxCommandLineInfo__ParseParam_hook)
#endif #endif