mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2026-04-05 15:26:11 +00:00
Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6b494c6c4 | ||
|
|
a80d4f5147 | ||
|
|
811b04485c | ||
|
|
a64fead653 | ||
|
|
399461d1b1 | ||
|
|
ec5e8ed5b3 | ||
|
|
5655164e60 | ||
|
|
3d9b7c2d67 | ||
|
|
764e3ab5c1 | ||
|
|
3314362faf | ||
|
|
e483f520db | ||
|
|
c92e32c0e1 | ||
|
|
cb872f8a41 | ||
|
|
0aae245054 | ||
|
|
480a7d038f | ||
|
|
f62f44d4c0 | ||
|
|
e316b89fb1 | ||
|
|
3b2dbcac1b | ||
|
|
d881c9faf6 | ||
|
|
11d9375f36 | ||
|
|
4207d7adcf | ||
|
|
832b1d66a0 | ||
|
|
cd829f9f22 | ||
|
|
f7c70eb6df | ||
|
|
01960f6470 | ||
|
|
f6065a1c00 | ||
|
|
ba3b7f0ed0 | ||
|
|
056eadbef2 | ||
|
|
2bb2dc9040 | ||
|
|
17553fd412 | ||
|
|
08c1c0f682 | ||
|
|
84959ae9c9 | ||
|
|
c90c102097 | ||
|
|
5b004426ce | ||
|
|
69c9060dd2 | ||
|
|
49870639ff | ||
|
|
0843862af9 |
2
.github/workflows/cmake-windows.yml
vendored
2
.github/workflows/cmake-windows.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
vcpkgArguments: 'discord-rpc zlib rapidjson openssl'
|
vcpkgArguments: 'discord-rpc zlib rapidjson openssl'
|
||||||
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg'
|
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg'
|
||||||
vcpkgGitCommitId: '75522bb1f2e7d863078bcd06322348f053a9e33f'
|
vcpkgGitCommitId: '06b5f4a769d848d1a20fa0acd556019728b56273'
|
||||||
vcpkgTriplet: 'x64-windows-static'
|
vcpkgTriplet: 'x64-windows-static'
|
||||||
|
|
||||||
- name: Create Build Environment
|
- name: Create Build Environment
|
||||||
|
|||||||
2
.github/workflows/release-build.yml
vendored
2
.github/workflows/release-build.yml
vendored
@@ -44,7 +44,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
vcpkgArguments: 'discord-rpc zlib rapidjson openssl'
|
vcpkgArguments: 'discord-rpc zlib rapidjson openssl'
|
||||||
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg'
|
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg'
|
||||||
vcpkgGitCommitId: '75522bb1f2e7d863078bcd06322348f053a9e33f'
|
vcpkgGitCommitId: '06b5f4a769d848d1a20fa0acd556019728b56273'
|
||||||
vcpkgTriplet: 'x64-windows-static'
|
vcpkgTriplet: 'x64-windows-static'
|
||||||
|
|
||||||
- name: Create Build Environment
|
- name: Create Build Environment
|
||||||
|
|||||||
@@ -99,8 +99,8 @@ void ErrorAboard(){
|
|||||||
exit(6);
|
exit(6);
|
||||||
}
|
}
|
||||||
void Discord_Main(){
|
void Discord_Main(){
|
||||||
std::thread t1(DMain);
|
/*std::thread t1(DMain);
|
||||||
t1.detach();
|
t1.detach();*/
|
||||||
/*info("Connecting to discord client...");
|
/*info("Connecting to discord client...");
|
||||||
int C = 0;
|
int C = 0;
|
||||||
while(DiscordInfo == nullptr && C < 80){
|
while(DiscordInfo == nullptr && C < 80){
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ void Parse(std::string Data,SOCKET CSocket){
|
|||||||
NetReset();
|
NetReset();
|
||||||
Terminate = true;
|
Terminate = true;
|
||||||
TCPTerminate = true;
|
TCPTerminate = true;
|
||||||
Data = Code + HTTP::Post("https://backend.beammp.com/servers","");
|
Data = Code + HTTP::Get("https://backend.beammp.com/servers-info");
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
ListOfMods.clear();
|
ListOfMods.clear();
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ std::string HTTP::Get(const std::string &IP) {
|
|||||||
|
|
||||||
httplib::Client cli(IP.substr(0, pos).c_str());
|
httplib::Client cli(IP.substr(0, pos).c_str());
|
||||||
cli.set_connection_timeout(std::chrono::seconds(10));
|
cli.set_connection_timeout(std::chrono::seconds(10));
|
||||||
|
cli.set_follow_location(true);
|
||||||
auto res = cli.Get(IP.substr(pos).c_str(), ProgressBar);
|
auto res = cli.Get(IP.substr(pos).c_str(), ProgressBar);
|
||||||
std::string Ret;
|
std::string Ret;
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ std::string Auth(SOCKET Sock){
|
|||||||
|
|
||||||
auto Res = TCPRcv(Sock);
|
auto Res = TCPRcv(Sock);
|
||||||
|
|
||||||
if(Res.empty() || Res[0] == 'E'){
|
if(Res.empty() || Res[0] == 'E' || Res[0] == 'K'){
|
||||||
Abord();
|
Abord();
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ std::string Auth(SOCKET Sock){
|
|||||||
|
|
||||||
Res = TCPRcv(Sock);
|
Res = TCPRcv(Sock);
|
||||||
|
|
||||||
if(Res[0] == 'E'){
|
if(Res[0] == 'E' || Res[0] == 'K'){
|
||||||
Abord();
|
Abord();
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ std::string TCPRcv(SOCKET Sock){
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
//debug("Parsing from server -> " + std::to_string(Ret.size()));
|
//debug("Parsing from server -> " + std::to_string(Ret.size()));
|
||||||
#endif
|
#endif
|
||||||
if(Ret[0] == 'E')UUl(Ret.substr(1));
|
if(Ret[0] == 'E' || Ret[0] == 'K')UUl(Ret.substr(1));
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ extern bool LoginAuth;
|
|||||||
std::string Role;
|
std::string Role;
|
||||||
|
|
||||||
void UpdateKey(const char* newKey){
|
void UpdateKey(const char* newKey){
|
||||||
if(newKey){
|
if(newKey && std::isalnum(newKey[0])){
|
||||||
std::ofstream Key("key");
|
std::ofstream Key("key");
|
||||||
if(Key.is_open()){
|
if(Key.is_open()){
|
||||||
Key << newKey;
|
Key << newKey;
|
||||||
@@ -88,13 +88,21 @@ void CheckLocalKey(){
|
|||||||
Key.read(&Buffer[0], Size);
|
Key.read(&Buffer[0], Size);
|
||||||
Key.close();
|
Key.close();
|
||||||
|
|
||||||
|
for (char& c : Buffer) {
|
||||||
|
if (!std::isalnum(c) && c != '-') {
|
||||||
|
UpdateKey(nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Buffer = HTTP::Post("https://auth.beammp.com/userlogin", R"({"pk":")" + Buffer + "\"}");
|
Buffer = HTTP::Post("https://auth.beammp.com/userlogin", R"({"pk":")" + Buffer + "\"}");
|
||||||
|
|
||||||
json::Document d;
|
json::Document d;
|
||||||
d.Parse(Buffer.c_str());
|
d.Parse(Buffer.c_str());
|
||||||
if (Buffer == "-1" || Buffer.at(0) != '{' || d.HasParseError()) {
|
if (Buffer == "-1" || Buffer.at(0) != '{' || d.HasParseError()) {
|
||||||
error(Buffer);
|
error(Buffer);
|
||||||
fatal("Invalid answer from authentication servers, please try again later!");
|
info("Invalid answer from authentication servers.");
|
||||||
|
UpdateKey(nullptr);
|
||||||
}
|
}
|
||||||
if(d["success"].GetBool()){
|
if(d["success"].GetBool()){
|
||||||
LoginAuth = true;
|
LoginAuth = true;
|
||||||
|
|||||||
@@ -29,8 +29,9 @@ std::string GetVer(){
|
|||||||
return "2.0";
|
return "2.0";
|
||||||
}
|
}
|
||||||
std::string GetPatch(){
|
std::string GetPatch(){
|
||||||
return ".63";
|
return ".82";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetEP(char*P){
|
std::string GetEP(char*P){
|
||||||
static std::string Ret = [&](){
|
static std::string Ret = [&](){
|
||||||
std::string path(P);
|
std::string path(P);
|
||||||
@@ -195,10 +196,6 @@ size_t DirCount(const std::filesystem::path& path){
|
|||||||
void CheckMP(const std::string& Path) {
|
void CheckMP(const std::string& Path) {
|
||||||
if (!fs::exists(Path))return;
|
if (!fs::exists(Path))return;
|
||||||
size_t c = DirCount(fs::path(Path));
|
size_t c = DirCount(fs::path(Path));
|
||||||
if (c > 3) {
|
|
||||||
warn(std::to_string(c - 1) + " multiplayer mods will be wiped from mods/multiplayer! Close this if you don't want that!");
|
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(15));
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
for (auto& p : fs::directory_iterator(Path)){
|
for (auto& p : fs::directory_iterator(Path)){
|
||||||
if(p.exists() && !p.is_directory()){
|
if(p.exists() && !p.is_directory()){
|
||||||
@@ -246,14 +243,9 @@ void EnableMP(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PreGame(const std::string& GamePath){
|
void PreGame(const std::string& GamePath){
|
||||||
const std::string CurrVer("0.24.0.1");
|
|
||||||
std::string GameVer = CheckVer(GamePath);
|
std::string GameVer = CheckVer(GamePath);
|
||||||
info("Game Version : " + GameVer);
|
info("Game Version : " + GameVer);
|
||||||
if(GameVer < CurrVer){
|
|
||||||
fatal("Game version is old! Please update.");
|
|
||||||
}else if(GameVer > CurrVer){
|
|
||||||
warn("Game is newer than recommended, multiplayer may not work as intended!");
|
|
||||||
}
|
|
||||||
CheckMP(GetGamePath() + "mods/multiplayer");
|
CheckMP(GetGamePath() + "mods/multiplayer");
|
||||||
|
|
||||||
if(!Dev) {
|
if(!Dev) {
|
||||||
|
|||||||
Reference in New Issue
Block a user