mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-01 23:46:59 +00:00
Switched to new default userdata
This commit is contained in:
parent
1afa81e420
commit
289402a9ba
@ -6,6 +6,7 @@
|
||||
/// Created by Anonymous275 on 7/19/2020
|
||||
///
|
||||
|
||||
#include <Security/Init.h>
|
||||
#include <windows.h>
|
||||
#include "Startup.h"
|
||||
#include "Logger.h"
|
||||
@ -30,10 +31,10 @@ std::string GetGamePath(){
|
||||
sk = R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)";
|
||||
openRes = RegOpenKeyEx(HKEY_CURRENT_USER, sk, 0, KEY_ALL_ACCESS, &hKey);
|
||||
if (openRes != ERROR_SUCCESS){
|
||||
fatal("Cannot get Documents directory!");
|
||||
fatal("Cannot get Local Appdata directory!");
|
||||
}
|
||||
Path = QueryKey(hKey,5);
|
||||
Path += "\\BeamNG.drive\\";
|
||||
Path += "\\BeamNG.drive\\" + CheckVer(GetGameDir()) + "\\";
|
||||
return Path;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ void Parse(std::string Data,SOCKET CSocket){
|
||||
NetReset();
|
||||
Terminate = true;
|
||||
TCPTerminate = true;
|
||||
Data = Code + HTTP::Post("backend.beammp.com/servers", "");
|
||||
Data = Code + HTTP::Post("backend.beammp.com/servers","");
|
||||
break;
|
||||
case 'C':
|
||||
ListOfMods.clear();
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "http.h"
|
||||
#include <mutex>
|
||||
#include <cmath>
|
||||
#include <evhttp.h>
|
||||
|
||||
#include "winmain-inl.h"
|
||||
|
||||
@ -40,8 +41,9 @@ std::string HTTP::Get(const std::string &IP) {
|
||||
t.Start(true);
|
||||
|
||||
auto pos = IP.find('/');
|
||||
std::shared_ptr<evpp::httpc::ConnPool> pool = std::make_shared<evpp::httpc::ConnPool>("www." + IP.substr(0,pos), 443, true, evpp::Duration(10.0));
|
||||
auto* r = new evpp::httpc::Request(pool.get(), t.loop(), IP.substr(pos), "");
|
||||
std::shared_ptr<evpp::httpc::ConnPool> pool = std::make_shared<evpp::httpc::ConnPool>(IP.substr(0, pos), 443, true,
|
||||
evpp::Duration(10.0));
|
||||
auto *r = new evpp::httpc::Request(pool.get(), t.loop(), IP.substr(pos), "");
|
||||
r->Execute(Response);
|
||||
|
||||
while (!responded) {
|
||||
@ -62,10 +64,16 @@ std::string HTTP::Post(const std::string& IP, const std::string& Fields) {
|
||||
evpp::EventLoopThread t;
|
||||
t.Start(true);
|
||||
|
||||
|
||||
auto pos = IP.find('/');
|
||||
std::shared_ptr<evpp::httpc::ConnPool> pool = std::make_shared<evpp::httpc::ConnPool>( IP.substr(0,pos), 443, true, evpp::Duration(10.0));
|
||||
auto* r = new evpp::httpc::Request(pool.get(), t.loop(), IP.substr(pos), Fields);
|
||||
r->AddHeader("Content-Type","application/json");
|
||||
std::shared_ptr<evpp::httpc::ConnPool> pool = std::make_shared<evpp::httpc::ConnPool>(IP.substr(0, pos), 443,
|
||||
true,
|
||||
evpp::Duration(10.0));
|
||||
auto *r = new evpp::httpc::Request(pool.get(), t.loop(), IP.substr(pos), Fields);
|
||||
if(!Fields.empty()) {
|
||||
r->AddHeader("Content-Type", "application/json");
|
||||
}
|
||||
r->set_request_type(EVHTTP_REQ_POST);
|
||||
r->Execute(Response);
|
||||
|
||||
while (!responded) {
|
||||
@ -101,7 +109,7 @@ bool HTTP::Download(const std::string &IP, const std::string &Path) {
|
||||
evpp::EventLoopThread t;
|
||||
t.Start(true);
|
||||
auto pos = IP.find('/');
|
||||
std::shared_ptr<evpp::httpc::ConnPool> pool = std::make_shared<evpp::httpc::ConnPool>("www." + IP.substr(0,pos), 443, true, evpp::Duration(10.0));
|
||||
std::shared_ptr<evpp::httpc::ConnPool> pool = std::make_shared<evpp::httpc::ConnPool>(IP.substr(0,pos), 443, true, evpp::Duration(10.0));
|
||||
auto* r = new evpp::httpc::Request(pool.get(), t.loop(), IP.substr(pos), "");
|
||||
r->set_progress_callback(ProgressBar);
|
||||
r->Execute(Response);
|
||||
|
@ -120,7 +120,7 @@ std::string QueryKey(HKEY hKey,int ID){
|
||||
case 2: if(key == "Name" && data == "BeamNG.drive")return data;break;
|
||||
case 3: if(key == "rootpath")return data;break;
|
||||
case 4: if(key == "userpath_override")return data;
|
||||
case 5: if(key == "Personal")return data;
|
||||
case 5: if(key == "Local AppData")return data;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
@ -10,9 +10,6 @@
|
||||
#include "Network/network.h"
|
||||
#include "Security/Init.h"
|
||||
#include <filesystem>
|
||||
#ifndef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "Startup.h"
|
||||
#include "Logger.h"
|
||||
#include <thread>
|
||||
|
Loading…
x
Reference in New Issue
Block a user