mirror of
https://github.com/BugisoftRSG/SCAPI.git
synced 2024-12-23 04:57:26 +08:00
rel
This commit is contained in:
parent
466edec3a3
commit
a5cafbd0ee
@ -80,8 +80,6 @@ string command::run(const string url, map<string, string> map)
|
||||
},
|
||||
cpr::Parameters{ params });
|
||||
|
||||
cout << response.status_code << endl;
|
||||
|
||||
return response.text;
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,28 @@ public:
|
||||
virtual string execute(const vector<string>& args) = 0;
|
||||
virtual SERVICE_TYPE get_service_type() = 0;
|
||||
|
||||
inline string get_category()
|
||||
{
|
||||
switch (get_service_type())
|
||||
{
|
||||
case PROD_ROS:
|
||||
return "prod.ros";
|
||||
break;
|
||||
case PROD_ROS_LAUNCHER:
|
||||
return "prod.ros (launcher)";
|
||||
break;
|
||||
case PROD_SCAPI_AMC:
|
||||
return "SCAPI";
|
||||
break;
|
||||
case PROD_CLOUD:
|
||||
return "cloud";
|
||||
break;
|
||||
default:
|
||||
return "unknown";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static ROSCrypt* m_launcher_ros;
|
||||
static ROSCrypt* m_ros;
|
||||
};
|
||||
|
@ -110,7 +110,10 @@ class CreateTicket : command
|
||||
}
|
||||
}
|
||||
|
||||
string data = command::get(hash<string>()("getaccountinfo"))->execute({});
|
||||
string data = "";
|
||||
if (!TICKET.empty())
|
||||
data = command::get(hash<string>()("getaccountinfo"))->execute({});
|
||||
|
||||
if (data.empty() || data.contains("Internal Server Error") || data.contains("AuthenticationFailed"))
|
||||
{
|
||||
cout << "Auth -> Cached session is no longer valid... recreating now." << endl;
|
||||
|
26
src/commands/scapi.rockstargames.com/Search/SearchCrew.cpp
Normal file
26
src/commands/scapi.rockstargames.com/Search/SearchCrew.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "../../../command.hpp"
|
||||
#include <iostream>
|
||||
|
||||
class SearchCrew : command
|
||||
{
|
||||
using command::command;
|
||||
|
||||
SERVICE_TYPE get_service_type() { return SERVICE_TYPE::PROD_SCAPI_AMC; }
|
||||
|
||||
virtual string execute(const vector<string>& args)
|
||||
{
|
||||
map<string, string> map;
|
||||
map["title"] = "gtav";
|
||||
map["platform"] = "pc";
|
||||
map["includeCommentCount"] = "false";
|
||||
//map["searchTerm"] = "looping";
|
||||
//map["sort"] = "membercount";
|
||||
//map["dateRange"] = "any";
|
||||
//map["pageSize"] = "1";
|
||||
//map["crewtype"] = "rockstar";
|
||||
|
||||
return run("https://scapi.rockstargames.com/search/crew", map);
|
||||
}
|
||||
};
|
||||
|
||||
SearchCrew g_search_crew("searchcrew");
|
@ -13,6 +13,12 @@ class SearchMission : command
|
||||
map["title"] = "gtav";
|
||||
map["platform"] = "pc";
|
||||
map["includeCommentCount"] = "false";
|
||||
map["searchTerm"] = "looping";
|
||||
//map["sort"] = "date";
|
||||
//map["dateRange"] = "any";
|
||||
//map["creatorRockstarId"] = "12345678";
|
||||
map["pageSize"] = "1";
|
||||
//map["filter"] = "friends";
|
||||
|
||||
return run("https://scapi.rockstargames.com/search/mission", map);
|
||||
}
|
||||
|
30
src/commands/scapi.rockstargames.com/Search/SearchPhoto.cpp
Normal file
30
src/commands/scapi.rockstargames.com/Search/SearchPhoto.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include "../../../command.hpp"
|
||||
#include <iostream>
|
||||
|
||||
class SearchPhoto : command
|
||||
{
|
||||
using command::command;
|
||||
|
||||
SERVICE_TYPE get_service_type() { return SERVICE_TYPE::PROD_SCAPI_AMC; }
|
||||
|
||||
virtual string execute(const vector<string>& args)
|
||||
{
|
||||
map<string, string> map;
|
||||
map["title"] = "gtav";
|
||||
map["platform"] = "pc";
|
||||
map["includeCommentCount"] = "false";
|
||||
//map["searchTerm"] = "looping";
|
||||
//map["sort"] = "date";
|
||||
//map["dateRange"] = "any";
|
||||
//map["creatorRockstarId"] = "12345678";
|
||||
//map["pageSize"] = "1";
|
||||
//map["filter"] = "friends";
|
||||
//map["regularPhoto"] = "true";
|
||||
//map["selfie"] = "true";
|
||||
//map["mugshot"] = "true";
|
||||
|
||||
return run("https://scapi.rockstargames.com/search/photo", map);
|
||||
}
|
||||
};
|
||||
|
||||
SearchPhoto g_search_photo("searchphoto");
|
27
src/commands/scapi.rockstargames.com/Search/SearchVideo.cpp
Normal file
27
src/commands/scapi.rockstargames.com/Search/SearchVideo.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include "../../../command.hpp"
|
||||
#include <iostream>
|
||||
|
||||
class SearchVideo : command
|
||||
{
|
||||
using command::command;
|
||||
|
||||
SERVICE_TYPE get_service_type() { return SERVICE_TYPE::PROD_SCAPI_AMC; }
|
||||
|
||||
virtual string execute(const vector<string>& args)
|
||||
{
|
||||
map<string, string> map;
|
||||
map["title"] = "gtav";
|
||||
map["platform"] = "pc";
|
||||
map["includeCommentCount"] = "false";
|
||||
//map["searchTerm"] = "looping";
|
||||
//map["sort"] = "date";
|
||||
//map["dateRange"] = "any";
|
||||
//map["creatorRockstarId"] = "12345678";
|
||||
//map["pageSize"] = "1";
|
||||
//map["filter"] = "friends";
|
||||
|
||||
return run("https://scapi.rockstargames.com/search/video", map);
|
||||
}
|
||||
};
|
||||
|
||||
SearchVideo g_search_video("searchvideo");
|
24
src/commands/scapi.rockstargames.com/UGC/MissionComments.cpp
Normal file
24
src/commands/scapi.rockstargames.com/UGC/MissionComments.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include "../../../command.hpp"
|
||||
#include <iostream>
|
||||
|
||||
class MissionComments : command
|
||||
{
|
||||
using command::command;
|
||||
|
||||
SERVICE_TYPE get_service_type() { return SERVICE_TYPE::PROD_SCAPI_AMC; }
|
||||
|
||||
virtual string execute(const vector<string>& args)
|
||||
{
|
||||
cout << "Specify the contentId" << endl;
|
||||
string contentId;
|
||||
cin >> contentId;
|
||||
|
||||
map<string, string> map;
|
||||
map["title"] = "gtav";
|
||||
map["contentId"] = contentId;
|
||||
|
||||
return run("https://scapi.rockstargames.com/ugc/mission/comments", map);
|
||||
}
|
||||
};
|
||||
|
||||
MissionComments g_mission_comments("getmissioncomments");
|
24
src/commands/scapi.rockstargames.com/UGC/MissionDetails.cpp
Normal file
24
src/commands/scapi.rockstargames.com/UGC/MissionDetails.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include "../../../command.hpp"
|
||||
#include <iostream>
|
||||
|
||||
class MissionDetails : command
|
||||
{
|
||||
using command::command;
|
||||
|
||||
SERVICE_TYPE get_service_type() { return SERVICE_TYPE::PROD_SCAPI_AMC; }
|
||||
|
||||
virtual string execute(const vector<string>& args)
|
||||
{
|
||||
cout << "Specify the contentId" << endl;
|
||||
string contentId;
|
||||
cin >> contentId;
|
||||
|
||||
map<string, string> map;
|
||||
map["title"] = "gtav";
|
||||
map["contentId"] = contentId;
|
||||
|
||||
return run("https://scapi.rockstargames.com/ugc/mission/details", map);
|
||||
}
|
||||
};
|
||||
|
||||
MissionDetails g_mission_details("getmissiondetails");
|
42
src/main.cpp
42
src/main.cpp
@ -114,11 +114,15 @@ int main()
|
||||
SESSION_TICKET = string(session_ticket, 88);
|
||||
SESSION_KEY = Botan::base64_encode(reinterpret_cast<const Botan::byte*>(session_key), sizeof(session_key));
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "GTA5.exe was not found... trying to use cached session.";
|
||||
}
|
||||
#endif
|
||||
|
||||
cout << "Help:" << endl;
|
||||
for (auto& it : g_commands) {
|
||||
cout << it.second->get_name() << endl;
|
||||
cout << it.second->get_category() << " - " << it.second->get_name() << endl;
|
||||
}
|
||||
|
||||
if (!TICKET.empty())
|
||||
@ -126,29 +130,43 @@ int main()
|
||||
cout << "Ticket " << TICKET << endl;
|
||||
cout << "Session Ticket " << SESSION_TICKET << endl;
|
||||
cout << "Session Key " << SESSION_KEY << endl;
|
||||
|
||||
cout << "Enter the endpoint:" << endl;
|
||||
cin >> ws >> endpoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
string response = command::get(hash<string>()("createticket"))->execute({});
|
||||
else {
|
||||
cout << "Do you want to proceed without session credentials? (y/n)" << endl;
|
||||
cout << "If so you are not able to use most of the prod.ros endpoints" << endl;
|
||||
|
||||
if (TICKET.length() > 20)
|
||||
string skipSessionCredentials;
|
||||
cin >> skipSessionCredentials;
|
||||
|
||||
if (skipSessionCredentials != "y")
|
||||
{
|
||||
cout << "Ticket " << TICKET << endl;
|
||||
cout << "Session Ticket " << SESSION_TICKET << endl;
|
||||
cout << "Session Key " << SESSION_KEY << endl;
|
||||
string _temp = command::get(hash<string>()("createticket"))->execute({});
|
||||
|
||||
if (TICKET.length() > 20)
|
||||
{
|
||||
cout << "Ticket " << TICKET << endl;
|
||||
cout << "Session Ticket " << SESSION_TICKET << endl;
|
||||
cout << "Session Key " << SESSION_KEY << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cout << "Enter the endpoint:" << endl;
|
||||
cin >> ws >> endpoint;
|
||||
|
||||
while (true)
|
||||
{
|
||||
transform(endpoint.begin(), endpoint.end(), endpoint.begin(), ::tolower);
|
||||
static command* command = command::get(hash<string>()(endpoint));
|
||||
|
||||
if (command) {
|
||||
cout << command->execute({ }) << endl;
|
||||
string response = command->execute({ });
|
||||
if (command->get_service_type() == SERVICE_TYPE::PROD_SCAPI_AMC && response.starts_with("{") && response.ends_with("}"))
|
||||
{
|
||||
response = nlohmann::json::parse(response).dump(4);
|
||||
}
|
||||
|
||||
cout << response << endl;
|
||||
}
|
||||
cout << "Enter the endpoint:" << endl;
|
||||
cin >> ws >> endpoint;
|
||||
|
Loading…
Reference in New Issue
Block a user