Rename announce-url, use variable for JWT retrieval url

This commit is contained in:
fearlessTobi 2018-08-27 23:09:29 +02:00
parent 73a38c6244
commit d408f89a91
2 changed files with 9 additions and 9 deletions

View File

@ -42,7 +42,7 @@ static void PrintHelp(const char* argv0) {
"--preferred-game-id The preferred game-id for this room\n"
"--username The username used for announce\n"
"--token The token used for announce\n"
"--announce-url The url to the announce server\n"
"--endpoint-url The endpoint url to the announce server\n"
"-h, --help Display this help and exit\n"
"-v, --version Output version information and exit\n";
}
@ -65,7 +65,7 @@ int main(int argc, char** argv) {
std::string preferred_game;
std::string username;
std::string token;
std::string announce_url;
std::string endpoint_url;
u64 preferred_game_id = 0;
u32 port = Network::DefaultRoomPort;
u32 max_members = 16;
@ -79,7 +79,7 @@ int main(int argc, char** argv) {
{"preferred-game-id", required_argument, 0, 'i'},
{"username", required_argument, 0, 'u'},
{"token", required_argument, 0, 't'},
{"announce-url", required_argument, 0, 'a'},
{"endpoint-url", required_argument, 0, 'a'},
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'v'},
{0, 0, 0, 0},
@ -114,7 +114,7 @@ int main(int argc, char** argv) {
token.assign(optarg);
break;
case 'a':
announce_url.assign(optarg);
endpoint_url.assign(optarg);
break;
case 'h':
PrintHelp(argv[0]);
@ -160,13 +160,13 @@ int main(int argc, char** argv) {
announce = false;
std::cout << "token is empty: Hosting a private room\n\n";
}
if (announce_url.empty() && announce) {
if (endpoint_url.empty() && announce) {
announce = false;
std::cout << "announce url is empty: Hosting a private room\n\n";
std::cout << "endpoint url is empty: Hosting a private room\n\n";
}
if (announce) {
std::cout << "Hosting a public room\n\n";
Settings::values.web_services_endpoint_url = announce_url;
Settings::values.web_services_endpoint_url = endpoint_url;
Settings::values.citra_username = username;
Settings::values.citra_token = token;
}

View File

@ -25,8 +25,8 @@ std::string UpdateCoreJWT(bool force_new_token, const std::string& username,
static std::string jwt;
if (jwt.empty() || force_new_token) {
if (!username.empty() && !token.empty()) {
std::future<Common::WebResult> future =
PostJson("https://api.citra-emu.org/jwt/internal", username, token);
std::future<Common::WebResult> future = PostJson(
Settings::values.web_services_endpoint_url + "/jwt/internal", username, token);
jwt = future.get().returned_data;
}
}